GWT 2.0 and CSS Resources

I have a GWT 2.0 ToggleButton that I created from a ResourceBundle:

ToggleButton tb = new ToggleButton();
tb.setStyleName(MyResources.INSTANCE.MyCssResource().TogBut());

Then, the client-side implementation adds additional styles to "TogBut-up" and "TogBut-down" to style button states.

I cannot, however, add the "TogBut-down" style to my css, because this is an invalid name for a field in my subclass of CssResource.

Does anyone know what is the best practice in this scenario? Should I just avoid obfuscation and stratification of resources?

+3
source share
2 answers

You can use any css class names you want using the @ClassName annotation

String TogBut();
@ClassName("TogBut-up")
String TogButUp();
@ClassName("TogBut-down")
String TogButDown();

In css you have:

.TogBut{
 ...
}
.TogBut-up{
 ...
}
.TogBut-down{
 ...
}

Google : http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#Constants

+3

, :

String TogBut();
String TogButUp();
String TogButDown();
+1

Source: https://habr.com/ru/post/1727433/


All Articles