with GWT 2.0, they have added RunAsync functionality. RunAsync gives you the ability to split your javascript into chunks of files. Which allows you, not to load the entire JS from the start.
They have added ClientBundle functionality. ClientBundle includes ImageBundle, ResourceBundle and CssResource (The killer feature). ImageBundle combines individual images into a single image in multiple dimensions. Simply lining up images left-to-right to create an image strip is sufficient. This will make fewer HTTP round-trips. This is what the code looks like:
Interface MyBundle extends ClientBundle {
public static final MyBundle INSTANCE = GWT.create(MyBundle.class);
@Source(“smiley.gif”)
ImageResource smileyImage();
@Source(“frowny.png”)
ImageResource frownlyImage();
@Source(“app_config.xml”)
TextResource appConfig();
@Source(“wordlist.txt”)
ExternalTextResource wordlist();
@Source("my.css")
public CssResource css();
@Source("config.xml")
public TextResource initialConfiguration();
@Source("manual.pdf")
public DataResource ownersManual();
}
This is how you would use it:
Window.alert(MyResources.INSTANCE.css().getText());
Frame myFrame = new Frame(MyResources.INSTANCE.ownersManual().getURL());
TextResource configs = MyBundle.INSTANCE. InitialConfiguration();
String configXml = configs.getText();
Document doc = XMLParser.parse(configXml);
The CSSResource compiles CSS with an enhanced syntax. It defines and uses constants in CSS. E.g.
@define myBorder 8px;
@define myColor #FDD;
.error-border { border:myBorder solid:myColor; }
It also uses conditions for user agent, locale or anything.
/* Runtime evaluation in a static context */
@if (com.module.Foo.staticBooleanFunction()) {
... css rules ...
}
/* Compile-time evaluation */
@if{
... css rules ...
}
@if user.agent safari gecko1_8 { ... }
@if locale en { ... }
/* Negation is supported */
@if !user.agent ie6 opera { ... }
GWT 2.0 have updated sets of Panel that fix the Layout. The example given is the new and improve DockPanel. It doesn’t run javascript during resize. Constraints-based layout similar to Cocoa on OSX.
GWT2.0 have added option in the compiler is: -XdisableClassMetaData. Calling obj.getClass() or clazz.getName() forces class objects and their names to be generated into javascript. It has Size, speed and obscurity benefits.
GWT2.0 added options in the compiler is: -XdisableCastChecking. Nobody actually catches ClassCastException in app code. (I hope you are not doing this):
Void makeItQuak(Animal animal) {
Try {
((Quaker) animal).quak();
}catch(ClassCastException c ) {
Window.alert(“doesn’t quak!”);
}
The above example generates a call like this (compiled JS)
DynamicCast(animal, 2).quak();
But when the flag is turned on, you only get this:
animal.quak();
How does this help you? In real-world (and very large) google app:
-1% script size reduction
-10% speed improvement in performance-sensitive code.
GWT have added RPC blacklist. Tell the RPC subsystem to skip types that you know aren’t ever sent across the wire:
<extend-configuration-property name="”rpc.blacklist”" value="”com.example.client.WidgetList”">
-Added Client side stackTrace on some browsers.
Throwable#getStackTrace() actually does something sometimes )
-Added interfaces on JavaScript Overlay Types.