Thursday, April 16, 2015

Re: GSS condition with Variable not working ?


@Jens: Yes, I know that, but the exact syntax of the @if conditions isn't completely clear to me from the docs, so it tried several thinks.
Any idea how it can work ? (what is allowed to be contained in the @if condition ?)

Whats unclear? There are examples all over the doc.

For compile time conditions you can use

- @if (MY_GWT_PROPERTY) with MY_GWT_PROPERTY being defined in a GWT module and only has true/false as values
- @if (is("property-name", "property-value")) which has a shortcut for user.agent: @if (is("ie8"))

For runtime time conditions you can use

@if (eval("com.example.Foo.staticBoolMethod()"))


What you can not do is

@def MY_BOOL is(.....)
@def MY_BOOL eval("com.example.Foo.staticBoolMethod()")

and then use MY_BOOL in @if. 



So in your case you either live with

@if(is("browser.engine", "webkit"))

or you rewrite your GWT properties to be boolean flags, e.g. IS_WEBKIT, IS_PRESTO and then use

@if (IS_WEBKIT) 


-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment