BT

GWT 2.0 Milestone 1 Released

by Dio Synodinos on Oct 06, 2009 |

The Google Web Toolkit team has announced the release of milestone 1 of the new version of GWT.  This version includes several new features and bug fixes.

Amit Manjhi explains that there are some changes in this version that might confuse users that are already familiar with the older version of GWT:

* Terminology changes: We're going to start using the term
"development mode" rather than the old term "hosted mode." The term
"hosted mode" was sometimes confusing to people, so we'll be using the
more descriptive term from now on. For similar reasons, we'll be using
the term "production mode" rather than "web mode" when referring to
compiled script.

* Changes to the distribution: Note that there's only one download,
and it's no longer platform-specific. You download the same zip file
for every development platform. This is made possible by the new
plugin approach used to implement development mode (see below). The
distribution file does not include the browser plugins themselves;
those are downloaded separately the first time you use development
mode in a browser that doesn't have the plugin installed. can be downloaded from Google Code, but as all milestone builds it is not recommend for production use.

Amit also describes the new features of GWT v2:

* In-Browser Development Mode: Prior to 2.0, GWT hosted mode provided
a special-purpose "hosted browser" to debug your GWT code. In 2.0, the
web page being debugged is viewed within a regular-old browser.
Development mode is supported through the use of a native-code plugin
for each browser. In other words, you can use development mode
directly from Safari, Firefox, IE, and Chrome.

* Code Splitting: Developer-guided code splitting allows you to chunk
your GWT code into multiple fragments for faster startup. Imagine
having to download a whole movie before being able to watch it. Well,
that's what you have to do with most Ajax apps these days -- download
the whole thing before using it. With code splitting, you can arrange
to load just the minimum script needed to get the application running
and the user interacting, while the rest of the app is downloaded as
needed.

* Declarative User Interface: GWT's UiBinder now allows you to create
user interfaces mostly declaratively. Previously, widgets had to be
created and assembled programmatically, requiring lots of code. Now,
you can use XML to declare your UI, making the code more readable,
easier to maintain, and faster to develop. The Mail sample has been
updated to use the new declarative UI.

* Bundling of resources (ClientBundle): GWT has shipped with
ImageBundles since GWT v1.4, giving developers automatic spriting of
images. ClientBundle generalizes this technique, bringing the power of
combining and optimizing resources into one download to things like
text files, CSS, and XML. This means fewer network round trips, which
in turn can decrease application latency -- especially on mobile
applications.

* Using HtmlUnit for running GWT tests: GWT 2.0 no longer uses SWT or
the old mozilla code (on linux) to run GWT tests. Instead, it uses
HtmlUnit as the built-in browser. HtmlUnit is 100% Java. This means
there is a single GWT distribution for linux, mac, and windows, and
debugging GWT Tests in development mode can be done entirely in a Java
debugger.

UiBinder which was recently moved to GWT’s trunk and generates Widget and DOM structures from XML markup, aims to provide an easier declarative way to create UIs:

A simple widget-based UI

<!-- HelloWidgetWorld.ui.xml -->

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
    xmlns:g='urn:import:com.google.gwt.user.client.ui'>
  <g:HTMLPanel>
    Hello, <g:ListBox ui:field='listBox'/>.
  </g:HTMLPanel>
</ui:UiBinder>

public class HelloWidgetWorld extends Composite {

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

  @UiField ListBox listBox;

  public HelloWidgetWorld(String... names) {
    // sets listBox
    initWidget(uiBinder.createAndBindUi(this));
    for (String name : names) { listBox.addItem(name); }
  }
}

// Use:

HelloWidgetWorld helloWorld =
  new HelloWidgetWorld("able", "baker", "charlie");

It seems that older GWT applications will not require significant amount of effort to be ported to the new version:

Breaking changes
* The way arguments are passed to the GWT testing infrastructure has
been revamped. There is now a consistent syntax to support arbitrary
"runstyles", including user-written with no changes to GWT.  Though
this does not affect common launch configs, some of the less common
ones will need to be updated. For example, '-selenium FF3' has become
'-runStyle selenium:FF3'

You can find more information about the Google Web Toolkit, right here at InfoQ!

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Sounds really great, especially the multitime downloaded function by Wang Simon

#, It will leverage the client side pressure

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT