Dynamic CSS class names in GWT
- by Anupam Jain
I am in the process of porting a simple CSS grid system to GWT. My CSS file currently has classes like .size1, .size2 etc., and I have a CSS resource that looks like -
class MyResource extends CSSResource {
@ClassName("size1")
String size1();
@ClassName("size2")
String size2();
// And so on
}
However what I really want, is to have a single function like the following -
String size(int size);
which will generate the appropriate class when passed the size as an integer at runtime. This is needed as I perform some calculations to determine the actual space available/needed for a widget in javascript and then attach the appropriate class name.
Is this something that is even possible with GWT?