GWT meets HTML5 by compiling Java code to optimized JavaScript that can take advantage of HTML5 features like Canvas. GWT uses deferred binding to generate different JavaScript implementations for different browsers to support a wide range of devices from desktop to mobile.
12. “Deferred Binding is Google Web Toolkit's answer to
Java reflection.”
http://code.google.com/webtoolkit/doc/1.6/FAQ_Client.html#What_is_Deferred_Binding?
13. http://www.youtube.com/watch?v=nvti32k4xyU
Your Code Download exactly what you Your Code
need in a single, optimized,
can’t-go-wrong chunk
FireFox IE6
en_US en_UK
Single Java
1D04ADDA.cache.html
Code Base 15F361B8.cache.html
Your Code Your Code
Then cache it on the client
Safari until the sun explodes Opera 9
fr_FR fr_CA
7EFE4D24.cache.html D415D917.cache.html
14. private static final PopupImpl impl = GWT.create(PopupImpl.class);
<module>
<!-- Fall through to this rule is the browser isn't IE or Mozilla -->
<replace-with class="com.google.gwt.user.client.ui.impl.PopupImpl">
<when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
</replace-with>
<!-- Mozilla needs a different implementation due to issue #410 -->
<replace-with class="com.google.gwt.user.client.ui.impl.PopupImplMozilla">
<when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
<any>
<when-property-is name="user.agent" value="gecko"/>
<when-property-is name="user.agent" value="gecko1_8"/>
</any>
</replace-with>
<!-- IE has a completely different popup implementation -->
<replace-with class="com.google.gwt.user.client.ui.impl.PopupImplIE6">
<when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
<when-property-is name="user.agent" value="ie6" />
</replace-with>
</module>
15.
16. Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
GWT.runAsync(new RunAsyncCallback() {
public void onFailure(Throwable caught) {
Window.alert("Code download failed");
}
public void onSuccess() {
Window.alert("Hello, AJAX");
}
});
}
});