In my app, I have MyAppResources
, which will mainly contain custom styles for the app. I am thinking about what is a good way to go about applying custom styles to standard widgets, such as a CellTable, along with custom styles on the layout and custom widgets?
My question:
Since MyAppResources is a singleton (it doesn't have to be, as mentioned in other posts), but CellTableResources
isn't, and CellTableResources
is a member of this instance that is an interface also extending ClientBundle
, will a proxy 'CellTableResources' be created on every MyAppResources.INSTANCE.cellTableResources().foo()
?
If so, could I create a MyAppResources.CELLTABLE_RESOURCE_INSTANCE
to get around this? Or would the creation of the proxy be negligible, even if there are plentiful calls to MyAppResources.INSTANCE.cellTableResources().#
?
Secondly, more of a discussion question: what is best practice in regards to using multiple ClientBundle
s in this case? Should I instead use CellTableResources
seperately (remove it from MyAppResources
), using GWT.create(CellTableResources.class);
in a widget that needs it (or using a singleton like I have for MyAppResources
)?
MyAppResources
:
public interface MyAppResources extends ClientBundle {
public static final MyAppResources INSTANCE = GWT.create(MyAppResources.class);
@Source("MyAppStyles.css")
public MyAppCssResource css();
public CellTableResources cellTableResources();
}
CellTableResources
:
public interface CellTableResources extends CellTable.Resources {
interface CellTableStyle extends CellTable.Style {
}
@Override
@Source({ CellTable.Style.DEFAULT_CSS, "CellTableStyles.css" })
CellTableStyle cellTableStyle();
@Source("green_light.png")
ImageResource getGreenLight();
//...
}
Thank you for reading.