How to add styleDependent names programmatically?

scan06disk

New Member
I'm trying to create a separate Button css class, that should be accessible by a \[code\]ClientBundle\[/code\]. My goal is to change button styles programmatically by application state.The following applies the button style, but does not change the background, so somehow the \[code\]-ok\[/code\] dependent stylename is not taken into account. Why?\[code\].myButton { background: white;}.myButton-ok { background: green;}public interface MyButtonResource extends ClientBundle { public static final MyButtonResource INSTANCE = GWT.create(MyButtonResource.class); @Source("MyButtonResource.css") Style css(); interface Style extends CssResource { @ClassName("myButton") String buttonStyle(); @ClassName("myButton-ok") String buttonStyleOK(); }}MyButtonResource.INSTANCE.css().ensureInjected();setStyleName(MyButtonResource.INSTANCE.css().buttonStyle());button.addStyleDependentName(MyButtonResource.INSTANCE.css().buttonStyleOK());\[/code\]
 
Top