If you need Windows / Unix / Mac recognition,you can use a property provider
to generate gwt module variables {used in the .nocache.js files}
<define-property name="user.os" values="win,mac,nix"/>
<property-provider name="user.os"><![CDATA[
var ua = navigator.platform.toLowerCase();
if (ua.indexOf("windows") != -1 &&
return 'win';
}
else if (ua.indexOf("mac") != -1 &&
return 'mac';
}
else return 'nix';
]]></property-provider>
This will generate seperate class files for each Operating System if and
only if you use these settings in DeferredBinding class replacements.
<replace-with class="com.example.osspecific.client.UnixClass">
<when-type-is class="com.example.ui.OSWidget" />
<any>
<property-is name="user.os" value="nix" />
</any>
</replace-with>
<replace-with class="com.example.osspecific.client.MacClass">
<when-type-is class="com.example.ui.OSWidget" />
<any>
<property-is name="user.os" value="mac" />
</any>
</replace-with>
By using this in your gwt modules, your compile time will TRIPLE {because
gwt generates a file for every combination of every variant of
property-provider variables. Most people just care about user.agent =
(gekco1_8 | gecko | safari | opera | ie6), as these are the rendering
engines that actually require seperate functionality hacks to make widgets
work standard across all browsers and OSes.
To cut your compile time, TARGET your currently used test browser. Most
sane humans develop in Firefox with Freibug until a new widget works, then
hack it out on Internet Explorer after.
TARGETTING:
<set-property name="user.agent" value="gecko1_8"/>
<set-property name="user.os" value="nix"/
This cuts my compile time to roughly 7% of a full compile.
I actually use the nix property to write pages that use apt:// install
instructions for power users, and notifications to urge everyone else to
download ubuntu and forget Internet Explorer, notepad and device drivers
forever...
...At least until they figure out how to run VirtualBox test suites for
their web applications, in which case virtual-environment device drivers
once again become a pain. {Any help for getting audio up in vBox Vista? I'm
working on a flash plugin that I can only test in XP until I have sound up}.
Did I forget to mention that XP and Vista versions of IE run differently
from each other? I'd make a better test to target them, but I don't feel
like it.
var y='',x; for(x in navigator)y+=x+": "+navigator[x]+'\n'; alert(y);
Long-Live Open Source!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---