I'm looking for a way to do something like this:
// style CSS @ f border size '2px'; . Style (width: border + 2; height: border size + 2;}
where the width and height attributes have a value of 4px.
Sometimes I use the following:
@Eval BORDER_SIZE_PLUS_2 2 + 2 + "px"; / * GWT evaluates this compile timeline! * /
Strangely, it only works if you have a place between +
operator and operand In addition to this, you have a constant You can still use the constants that were previously defined by @def, which are defined as static fields in one of your Java classes:
< Code> @Eval BORDER_SIZE_PLUS_2 com.example.MyCssConstants.BORDER_SIZE + 2 + "px";
Or you can execute the calculation completely by Java:
@Eval WIDTH com.example.MyCssCalculations.width (); / * Fixed work, no parameters! * / @avl Highweight com.example.MyCssCalculations.height (); Style {width: WIDTH; Height: HEIGHT; }
But what I really want to do, is similar to your suggestion:
@def BORDER_SIZE 2; . Style {width: value (BORDER_SIZE + 2, 'px'); / * Not possible * / height: value (BORDER_SIZE + 3, 'px'); }
I do not think it is possible in GW 2.0. You may find a better solution - this is the page on this topic.
Comments
Post a Comment