Thursday, December 24, 2015

GSS eval not evaluating

I have a method that calculates a box shadow. To use it, I call getShadow(int depth). If I call this, I get the expected result. Now, I'd like to create a few predefined constants in GSS. So, I do this:

public interface ColorResources extends CssResource
{
   
String shadowZ0();
   
String shadowZ1();
   
String shadowZ2();
   
String shadowZ3();
   
String shadowZ4();
   
String shadowZ5();

   
public static class Util
   
{
       
private Util() {}


       
public static String getShadow(int dp)
       
{
           
return shadow;
       
}

       
public static String shadowZ0()  { return getShadow(0); }
       
public static String shadowZ1()  { return getShadow(1); }
       
public static String shadowZ2()  { return getShadow(2); }
       
public static String shadowZ3()  { return getShadow(3); }
       
public static String shadowZ4()  { return getShadow(4); }
       
public static String shadowZ5()  { return getShadow(5); }
   
}
}


colors.gss:

@def SHADOW_Z0 eval('path.to.ColorResources.Util.shadowZ0()');
@def SHADOW_Z1 eval('path.to.ColorResources.Util.shadowZ1()');
@def SHADOW_Z2 eval('path.to.ColorResources.Util.shadowZ2()');
@def SHADOW_Z3 eval('path.to.ColorResources.Util.shadowZ3()');
@def SHADOW_Z4 eval('path.to.ColorResources.Util.shadowZ4()');
@def SHADOW_Z5 eval('path.to.ColorResources.Util.shadowZ5()');


But if I do GWT.log(Resources.colors().shadowZ0()) (Where Resources is my ClientBundle that ColorResources is in), the print value is:

"Java expression : path.to.ColorResources.Util.shadowZ0()"

It should be evaluating the expression, not just returning it.... anyone know what's up?

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment