Professional Documents
Culture Documents
GWT 2.0 Is Smarter Than You: Robert "Kebernet" Cooper
GWT 2.0 Is Smarter Than You: Robert "Kebernet" Cooper
• Deferred Binding
• Code pruning/staticification/inlining/etc
Google Institutional Knowledge
• Cache Strategy (Out of the Box)
• I18n Strategy (Out of the Box)
• Image DL optimization (Out of the Box)
• Two iterations of compression optimization
Testing, Packaging, Client/Server modules
GWT 1.x: Progress
UIBinder
• Declarative UI support
• Integrates better with standard methodology
• Can make UI binding easier
Developer Guided Code Pointcuts
• runAsync allows for jit code loading inside an
application
LayoutPanel
• Absolutely positioned with CSS-driven size
hinting (awesome sauce)
OOPHM
Compiled Styesheets
MyModule.css:
.myLabelText {
font-size: smallText;
Color: baseText;
}
.myUnderline {
Border-bottom: 1px solid baseText;
}
Compiled Stylesheets (Examples)
String myLabelText;
}
Compiled Stylesheets (Examples)
} @ else {
.halfOpaque {
opacity: 0.5;
}
}
Compiled Stylesheets (Examples)
@sprite .myEditButton {
border: 1px outset silver;
background: silver;
Gwt-image: “edit-icon”;
}
Compiled Resource
@Source(“MyEditIcon.png”)
ImageResource editIcon;
}
Compiled Resources
Declarative UIs
• Work from XHTML source
• Easy process integration with designers
New HTML DOM classes
• Easier to work with native DOM without user.ui.*
classes
Namespacing in XML allows for easy use of
GWT widgets
(Better than Android :/)
Cleaner than using Widgets everywhere
UIBinder (Examples)
MyWidget.xml:
<!DOCTYPE ui:UiBinder SYSTEM
"http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<g:HTMLPanel>
<span ui:field=”label”/> <g:ListBox
ui:field='listBox' visibleItemCount='1'/>.
</g:HTMLPanel>
</ui:UiBinder>
UIBinder (Examples)
MyWidget.java:
class MyWidget extends Widget { //Or UIObject
interface Binder extends UIBinder<Widget,
MyWidget>{} // forces compile generation;
private static final Binder BINDER =
GWT.create(Binder.class);
@UiField
SpanElement label;
@UiField
ListBox listBox;
UIBinder (Examples)
MyWidget.java (cont):
DockPanel.java: