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 -
interface 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?
Edit: To clarify, I can easily write such a method myself like so -
String size(int size) {
switch(size) {
case 1: return size1();
case 2: return size2();
... and so on
}
}
However MyResource
is an interface and its implementation is generated at runtime by GWT. This means I cannot add my size
method to the MyResource
type. So I guess I am asking for a way to add custom methods to the MyResource
class.