GWT 2.0 - OSCON 2010

50
GWT 2.0 Sean C. Sullivan OSCON July 23, 2010

description

GWT 2.0 OSCON 2010 Portland Oregon July 23 2010

Transcript of GWT 2.0 - OSCON 2010

Page 1: GWT 2.0 - OSCON 2010

GWT 2.0

Sean C. SullivanOSCON

July 23, 2010

Page 2: GWT 2.0 - OSCON 2010

About me

Page 3: GWT 2.0 - OSCON 2010
Page 4: GWT 2.0 - OSCON 2010
Page 5: GWT 2.0 - OSCON 2010
Page 6: GWT 2.0 - OSCON 2010

• write AJAX applications in Java

• compile to JavaScript

• open source

http://code.google.com/webtoolkit/

Page 7: GWT 2.0 - OSCON 2010

released on December 8, 2009

GWT 2.0

Page 8: GWT 2.0 - OSCON 2010

GWT SDK

Page 9: GWT 2.0 - OSCON 2010
Page 10: GWT 2.0 - OSCON 2010

New features in GWT 2.0

• Development Mode

• Speed Tracer

• Developer guided code splitting

Page 11: GWT 2.0 - OSCON 2010

New features in GWT 2.0

• Compiler optimizations

• Draft Compile

• Declarative User Interfaces (UiBinder)

Page 12: GWT 2.0 - OSCON 2010

New features in GWT 2.0

• Layout panels

• Bundled resources via ClientBundle

• HtmlUnit for testing

Page 13: GWT 2.0 - OSCON 2010

Development Mode

Page 14: GWT 2.0 - OSCON 2010

Development Mode

Page 15: GWT 2.0 - OSCON 2010

Development Mode

Page 16: GWT 2.0 - OSCON 2010

Development Mode

Page 17: GWT 2.0 - OSCON 2010

Development Mode

Page 18: GWT 2.0 - OSCON 2010

Google Plugin for Eclipse

Page 19: GWT 2.0 - OSCON 2010

Google Plugin for Eclipse

Page 20: GWT 2.0 - OSCON 2010

Google Plugin for Eclipse

Page 21: GWT 2.0 - OSCON 2010

Google Plugin for Eclipse

Page 22: GWT 2.0 - OSCON 2010

Layout panels in GWT 2.0

• relies on the browser’s layout engine

• works correctly in browser’s standards mode

Page 23: GWT 2.0 - OSCON 2010

Layout panels in GWT 2.0

• com.google.gwt.user.client.RootLayoutPanel

• com.google.gwt.user.client.LayoutPanel

• com.google.gwt.user.client.ui.DockLayoutPanel

Page 24: GWT 2.0 - OSCON 2010

Layout panels in GWT 2.0

• com.google.gwt.user.client.ui.SplitLayoutPanel

• com.google.gwt.user.client.ui.StackLayoutPanel

• com.google.gwt.user.client.ui.TabLayoutPanel

Page 25: GWT 2.0 - OSCON 2010

UiBinder

• declarative layout

• XML

• UiBinder constructs HTML at compile time

Page 26: GWT 2.0 - OSCON 2010

UiBinder

<!-- HelloWorld.ui.xml -->

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'>  <div>    Hello, <span ui:field='nameSpan'/>.  </div></ui:UiBinder>

Page 27: GWT 2.0 - OSCON 2010

UiBinder

public class HelloWorld extends Widget {   interface MyUiBinder extends UiBinder<DivElement, HelloWorld> {}  private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

  @UiField SpanElement nameSpan;

  public HelloWorld() {    // createAndBindUi initializes this.nameSpan    setElement(uiBinder.createAndBindUi(this));  }

  public void setName(String name) { nameSpan.setInnerText(name); }}

Page 28: GWT 2.0 - OSCON 2010

UiBinder

• com.google.gwt.uibinder.client.UiBinder

• com.google.gwt.uibinder.client.UiField

Page 29: GWT 2.0 - OSCON 2010

ClientBundle

• bundle images, CSS, data, and other resources

• For more information, seehttp://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html

Page 30: GWT 2.0 - OSCON 2010

ClientBundle

Page 31: GWT 2.0 - OSCON 2010

Unit testing with GWT 2.0

As of 2.0, GWTTestCase no longer uses SWT or native code. Instead, it uses HtmlUnit as the built-in browser. [...] Debugging GWT Tests in development mode can be done entirely in a Java debugger

source: google.com

Page 32: GWT 2.0 - OSCON 2010

By default, GWT runs HtmlUnit in the Firefox3 emulation mode

source: google.com

Unit testing with GWT 2.0

Page 33: GWT 2.0 - OSCON 2010

Because HtmlUnit is a GUI-less browser, layout cannot be tested on HtmlUnit.

source: google.com

Unit testing with GWT 2.0

Page 34: GWT 2.0 - OSCON 2010

... correct tests can sometimes fail on HtmlUnit, either because the HtmlUnit support for that feature is lacking or because of HtmlUnit’s issues with flakiness when running asynchronous tests

source: google.com

Unit testing with GWT 2.0

Page 35: GWT 2.0 - OSCON 2010

Code splitting

• allows you to chunk your GWT code into multiple fragments for faster startup

• aka “developer guided code splitting”

• For more information, seehttp://code.google.com/webtoolkit/doc/latest/DevGuideCodeSplitting.html

Page 36: GWT 2.0 - OSCON 2010

Speed Tracer

Page 37: GWT 2.0 - OSCON 2010

Speed Tracer

Page 38: GWT 2.0 - OSCON 2010

Speed Tracer

Page 39: GWT 2.0 - OSCON 2010

Demo #1

• GWT 2.0

• HTML 5

• WebSockets

Page 40: GWT 2.0 - OSCON 2010
Page 41: GWT 2.0 - OSCON 2010
Page 42: GWT 2.0 - OSCON 2010
Page 43: GWT 2.0 - OSCON 2010

Demo #2

Page 44: GWT 2.0 - OSCON 2010
Page 45: GWT 2.0 - OSCON 2010
Page 46: GWT 2.0 - OSCON 2010

What’s new in GWT 2.1

• Data presentation widgets

• Model-View-Presenter framework

• Server-side Speed Traces

Page 47: GWT 2.0 - OSCON 2010

Questions?

Page 48: GWT 2.0 - OSCON 2010

Thank you

Page 49: GWT 2.0 - OSCON 2010
Page 50: GWT 2.0 - OSCON 2010