Meaning of @ImportedWithPrefix?

51 views
Skip to first unread message

Slava Imeshev

unread,
May 18, 2021, 6:42:09 PM5/18/21
to GWT Users
I'm trying to understand how styling works in CellTable. The line # 298 has BasicStyle annotated with @ImportedWithPrefix("gwt-CellTable"). I'm curious, how's 'gwt-CellTable' literal come into picture, and what does it do?

/**
* Styles used by {@link BasicResources}.
*/
@ImportedWithPrefix("gwt-CellTable")
interface BasicStyle extends Style {
/**
* The path to the default CSS styles used by this resource.
*/
String DEFAULT_CSS = "com/google/gwt/user/cellview/client/CellTableBasic.css";

}

Thanks!

Slava

lofid...@gmail.com

unread,
May 19, 2021, 5:24:45 AM5/19/21
to GWT Users

Slava Imeshev

unread,
May 19, 2021, 7:42:12 PM5/19/21
to GWT Users
Yes, thank you.

Actually, I was trying to figure out how to style CellTable (or DataGrid) so I started digging into the code. I found this thread, is this the right way to go about it?

Thomas Broyer

unread,
May 20, 2021, 9:05:16 AM5/20/21
to GWT Users
Yes.
Note that you can put CellTable.Style.DEFAULT_CSS into your @Source to combine the default styles with yours.

Slava Imeshev

unread,
May 20, 2021, 12:07:19 PM5/20/21
to GWT Users
Understood. While we are here, is it possible to switch CellTable or DataGrid to the same external CSS model used by Panels, Dialogs etc?

Thomas Broyer

unread,
May 25, 2021, 11:40:21 AM5/25/21
to GWT Users
Yes, make a dummy style resource where all class names are marked @external (http://www.gwtproject.org/doc/latest/DevGuideClientBundle.html#External_and_legacy_scopes) and override the methods of CellTable.Style to annotate them with @ClassName to match the CSS class names you used in the stylesheet.
(technically, you could also probably pass your own implementation of CellTable.Resources where the CellTable.Style methods return constants and ensureInjected() is a no-op)

Reply all
Reply to author
Forward
0 new messages