ConditionalProperties

73 views
Skip to first unread message

Gal Dolber

unread,
Jul 13, 2011, 6:47:58 PM7/13/11
to google-we...@googlegroups.com
Hi,


<define-property name="mobile.user.agent" values="android, iphone, not_mobile" />
<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 'not_mobile';
  }
]]>
</property-provider>

<!-- Constrain the value for non-webkit browsers -->
<set-property name="mobile.user.agent" value="not_mobile" >
 
<none> <!-- Actually means NOR, in this case "not safari" -->
   
<when-property-is name="user.agent" value="safari" />
 
</none>
</set-property>

I made a small project example but when I compile it I get only 6 permutations, when I should get 8? (5 other browsers + (safari * mobile.user.agent))? the documentation says that this example should generate 9 permutations...
I am testing with gwt trunk compiled yesterday.

What am I doing wrong?
Thanks in advnc

--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/




Gal Dolber

unread,
Jul 19, 2011, 9:01:01 AM7/19/11
to google-we...@googlegroups.com
nobody?

Thomas Broyer

unread,
Jul 19, 2011, 10:15:02 AM7/19/11
to google-we...@googlegroups.com
It is working. Apache Wave uses it. I believe I successfully used it too.

Have a look at the top of the generated symbolMaps files, they'll tell you which deferred binding property leads to a particular permutation, along with its value.

Gal Dolber

unread,
Jul 19, 2011, 6:23:49 PM7/19/11
to google-we...@googlegroups.com
Thanks!

I still don't understand what I am doing wrong. I even can't get working a normal selection property.

{{{
<define-property name="my.property" values="default" />
<property-provider name="my.property" generator="com.myPropertyGenerator" />
<extend-property name="my.property" values="value1, value2" />
<set-property-fallback name="my.property" value="default" />
}}}

Shouldn't this be enough to get an extra 12 permutation (18 in total)? I am getting only 6

On Tue, Jul 19, 2011 at 11:15 AM, Thomas Broyer <t.br...@gmail.com> wrote:
It is working. Apache Wave uses it. I believe I successfully used it too.

Have a look at the top of the generated symbolMaps files, they'll tell you which deferred binding property leads to a particular permutation, along with its value.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ood3SvTuXHIJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Thomas Broyer

unread,
Jul 19, 2011, 6:33:42 PM7/19/11
to google-we...@googlegroups.com
Could it be that GWT optimizes the case where the property isn't used in any <generate-with> or <replace-with> rule?

Gal Dolber

unread,
Jul 19, 2011, 6:58:30 PM7/19/11
to google-we...@googlegroups.com
Yes, I though that, but then I saw the i18n "locale" property, that is the most similar to the one I am trying to do and It doesn't use <when-property-is>

<generate-with class="com.google.gwt.i18n.rebind.LocalizableGenerator">

    <when-type-assignable class="com.google.gwt.i18n.shared.Localizable" />

  </generate-with>


On Tue, Jul 19, 2011 at 7:33 PM, Thomas Broyer <t.br...@gmail.com> wrote:
Could it be that GWT optimizes the case where the property isn't used in any <generate-with> or <replace-with> rule?

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Reply all
Reply to author
Forward
0 new messages