Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Huge amount of GWT permutations when using GXT

Tags:

war

gwt

I have insane number of permutations by compiling the project. if i set the option:

<set-property name="user.agent" value="gecko1_8" />

i get: Compiling 1008 permutations

if i set:

<set-property name="locale" value="de"/>
<set-property name="user.agent" value="gecko1_8" />

i get: Compiling 36 permutations

here is the full .gwt.xml

<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />

<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<inherits name='com.google.gwt.junit.JUnit' />

   <!-- GXT Theme -->
<inherits name='com.sencha.gxt.theme.gray.Gray' />

<!-- caneldar -->
<inherits name='com.bradrydzewski.gwt.calendar.Calendar' />
<inherits name='com.bradrydzewski.gwt.calendar.theme.google.Google' />
<inherits name='com.allen_sauer.gwt.dnd.gwt-dnd' />

<!-- Other module inherits -->
<inherits name="com.google.gwt.json.JSON" />
<inherits name='com.google.gwt.visualization.Visualization' />
<inherits name='com.chap.links.Timeline' />

<!-- Locale -->
<inherits name="com.google.gwt.i18n.I18N"/>
<set-property name="locale" value="de"/>
<set-property name="user.agent" value="gecko1_8" />

What could cause the high number of permutations ?

like image 524
kozla13 Avatar asked Dec 08 '22 11:12

kozla13


1 Answers

Looks like you are using GXT (from the Gray inherits statement), but not actually inheriting GXT itself (step three in the setup.txt). This isn't necessarily a bad thing, but avoiding that statement means that you are skipping some setup that restricts the possible number of permutations. Add this just before your Gray line:

<inherits name='com.sencha.gxt.ui.GXT'/>

Then, in addition to the user.agent=gecko1_8, add this instead (or in addition to) in order to limit the GXT permutation (more on this below):

<set-property name="gxt.user.agent" value="gecko1_9" />

(note that we reference Gecko 1.9 instead of 1.8, as there is at least one bug in 1.8 that we have a workaround for that is not required in 1.9.)


Why does GXT add additional properties, and not use user.agent?

It turns out that user.agent can't be extended easily - the fallback system does nothing helpful for existing CssResource declarations. This means that if GXT added a ie10 permutation (which it did in 3.0), or wants to have a distinct ie7 permutation (instead of lumping in with ie6), or separate Chrome vs Safari permutations (chrome zoom issues anyone?), we might break existing code in your project.

Additionally, GXT adds a 'os' property to let us deal with platform issues. This can be 'mac', 'linux', or 'windows' (or 'unknown' after 3.0.3 to deal with Solaris, Chrome OS, etc). There aren't a ton of cases where this is needed, but one example include native OS X checkboxes, which blur as soon as you click them, as opposed to windows, linux, or firefox on mac.

Why don't I need to set user.agent if I set gxt.user.agent?

Since the set of GXT user agent properties is more extensive than GWT user agents, we set the GWT user agent based on the GXT user agent setting with these lines:

<!-- From /com/sencha/gxt/core/Core.gwt.xml about line 110 -->
<!-- Restrict the permutation explosion -->
<set-property name="user.agent" value="ie6">
  <any>
    <when-property-is name="gxt.user.agent" value="ie6" />
    <when-property-is name="gxt.user.agent" value="ie7" />
  </any>
</set-property>
<set-property name="user.agent" value="ie8">
  <when-property-is name="gxt.user.agent" value="ie8" />
</set-property>
<set-property name="user.agent" value="ie9">
  <any>
    <when-property-is name="gxt.user.agent" value="ie9" />
    <when-property-is name="gxt.user.agent" value="ie10" />
  </any>
</set-property>
<set-property name="user.agent" value="gecko1_8">
  <any>
    <when-property-is name="gxt.user.agent" value="gecko1_8" />
    <when-property-is name="gxt.user.agent" value="gecko1_9" />
  </any>
</set-property>
<set-property name="user.agent" value="safari">
  <any>
    <when-property-is name="gxt.user.agent" value="safari3" />
    <when-property-is name="gxt.user.agent" value="safari4" />
    <when-property-is name="gxt.user.agent" value="safari5" />
    <when-property-is name="gxt.user.agent" value="air" />
    <when-property-is name="gxt.user.agent" value="chrome" />
  </any>
</set-property>
<set-property name="user.agent" value="opera">
  <when-property-is name="gxt.user.agent" value="opera" />
</set-property>

How does GXT.gwt.xml limit the number of permutations, and how can I do it myself?

Thirteen browser properties times three operating systems should then give about 39 permutations unless something is done to restrict those properties. By default, GXT.gwt.xml limits these to the basic 6 permutations with these lines:

<collapse-property name="user.agent.os" values="*" />
<collapse-property name="gxt.user.agent" values="air, safari*, chrome" />
<collapse-property name="gxt.user.agent" values="ie6, ie7" />
<collapse-property name="gxt.user.agent" values="ie9, ie10" />
<collapse-property name="gxt.user.agent" values="gecko*" />

By not inheriting GXT, you are given the chance to set up your own restriction of permutations. If you don't wish to set those up for yourself, go ahead and inherit GXT itself. More information using <collapse-property> and <collapse-all-properties /> can be found at http://code.google.com/p/google-web-toolkit/wiki/SoftPermutations

like image 197
Colin Alworth Avatar answered Jan 25 '23 16:01

Colin Alworth