Reputation: 2189
I have a ClientBundle:
public interface Resources extends ClientBundle {
@Source("styles/styles.css")
Layout styles();
@Source("styles/styles2.css")
Styles styles2();
}
In my UiBinder xml I use this class like this:
<ui:with field='resources' type='com.nordea.omega.gwt.client.ui.AppResources' />
...
<div class="{resources.styles.label}">Text</div>
Standard is that styles.css is used, but is it possible at runtime change to use styles2.css instead?
Upvotes: 3
Views: 3422
Reputation: 5707
If you use CSS resources it's quite easy to access them programmatically: check this http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Programmatic_access
The key code being:
@UiField AppResources resources;
Upvotes: 1
Reputation: 18347
If you use GWT-style annotations, AFAIK it will not be possible to change that dynamically because the annotations/classes are resolved statically, ie, when GWT compiles (last time I used GWT it was around a year or so).
The best way would be to navigate the DOM and change the linked style.css to another stylesheet. Check the showcase src for an example of how to do this:
Upvotes: 1