Más contenido relacionado
La actualidad más candente (20)
Similar a GWT 2 Is Smarter Than You (20)
GWT 2 Is Smarter Than You
- 1. GWT 2.0 is Smarter than You Robert “kebernet” Cooper Internap Network Services Inc. GWT in Practice (http://manning.com/cooper)
- 26. Compiled Stylesheets (Examples) MyModule.css: @def smallText 10px; @def baseText #00CCCC; .myLabelText { font-size: smallText; Color: baseText; } .myUnderline { Border-bottom: 1px solid baseText; }
- 27. Compiled Stylesheets (Examples) interface MyModuleCss extends CssResource { String myLabelText; @ClassName(“myUnderline”) //Optional (name) String myUnderlineClass; }
- 28. Compiled Stylesheets (Examples) /* @if (compile property) (match value)... */ @if user.agent msie msie8 { .halfOpaque { filter: alpha(opacity = 50); } } @ else { .halfOpaque { opacity: 0.5; } }
- 33. Compiled Resources (Examples) interface MyResources extends ClientBundle { @Source(“MyModule.css”) @Strict Css myCss; // Depends on below! @Source(“MyEditIcon.png”) ImageResource editIcon; @Source(“SomeTextFile.txt”) //LOAD FROM WEB! ExternalTextResource configFile; }
- 41. 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>
- 42. 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;
- 43. UIBinder (Examples) MyWidget.java (cont): public MyWidget(String label,String... options){ setElement(BINDER.createAndBindUI(this)); for(String option : options){ this.listBox.addItem(option); } this.label.setInnerText(label); } }
- 49. Anonymous classes follow Java spec of custom <init> based on final availability as constructor args and Pass-By-(Pointer-)Value states
- 52. GWT proxies the current pointer references into a callback JavaScript method
- 61. Math between fixed pixel size panels and “rest” isn't cleanly supported by CSS and requires .reflow() handlers
- 68. GWT 2.0 LayoutPanel (Examples) DockPanel.java: DockLayoutPanel p = new DockLayoutPanel(Unit.EM); p.addNorth(new HTML("header"), 2); p.addSouth(new HTML("footer"), 2); p.addWest(new HTML("navigation"), 10); p.add(new HTML(content));
- 71. Internals use CSS to handle fill sizes, so OpenGL/PDF/Whatever rendering systems apply and doesn't require a separate eventing chain
- 76. New Layout system is faster and requires less “onAttach()/onWindowResize()” hackery