Re: Conditional Properties
D'oh, think I got caught out by GWT's optimization. Apparently it
doesn't mention the new permutations until you add rules that force a
genuinely new set of code to be generated. Now I've added some extra
replacement rules that use the new property it seems to be working,
creating the 8 permutations as expected.
-Shaun
On Jan 26, 5:27 pm, Shaun <fas...@gmail.com> wrote:
> Hi,
>
> I started a thread a while back asking for some way to support sub-
> types of properties (e.g. for mobile Safari/Android). I got a quick
> response saying that Conditional Properties were the answer, and that
> they were in GWT 2.0.
>
> Thread:http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
>
> Conditional Properties:http://code.google.com/p/google-web-toolkit/wiki/ConditionalProperties
>
> Now GWT 2.0 is out, I'm trying to get conditional properties to work
> but not having much luck. I added the following to my gwt.xml file.
> It happily compiles but says it's only compiling the usual 6
> permutations rather than the expected 8. In fact, even if I remove
> the set-property declaration, I still only get 6 permutations so maybe
> I'm doing something wrong here.
>
> <define-property name="mobile.user.agent"
> values="android,iphone,none" />
> <property-provider name="mobile.user.agent"><![CDATA[
> {
> var ua = window.navigator.userAgent.toLowerCase();
> if (ua.indexOf('android') != -1) { return 'android'; }
> if (ua.indexOf('iphone') != -1) { return 'iphone'; }
> return 'none';
> }
> ]]></property-provider>
>
> <!-- Constrain the value for non-webkit browsers -->
> <set-property name="mobile.user.agent" value="none" >
> <none>
> <when-property-is name="user.agent" value="safari" />
> </none>
> </set-property>
>
> Has anyone managed to get this to work? Does anyone know if
> conditional properties were indeed implemented or whether they were
> shelved for some reason?
>
> Thanks,
>
> -Shaun
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home