Dynamic CSS class names in GWT

Posted by Anupam Jain on Stack Overflow See other posts from Stack Overflow or by Anupam Jain
Published on 2012-03-19T10:01:56Z Indexed on 2012/03/19 10:03 UTC
Read the original article Hit count: 252

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about css

Related posts about gwt