Skip to main content

Exploring GWT

Posted by mjeffw on September 15, 2008 at 7:21 AM PDT

This JavaOne I finally got to check out Google Web Toolkit. After hearing David Geary speak, I have to confess the next day I made a beeline to the bookstore and picked up his excellent book, Google Web Toolkit Solutions and stayed up late each night in the hotel working through the examples in the book.

One of the things I have discovered since starting to experiment with GWT is that it is missing some key framework support. That is, the basics are there: rich desktop-like widgets, a serviceable RPC mechanism, etc. But some basic support for managing a desktop application, like property binding support, is missing.

I suspect much of this is simply because the technology is still pretty young, and there's a lot of work to be done on it before it will really be able to compete against Adobe's Flex.

Still, I'm pretty stoked about this technology, and I am willing to work a bit to make up for some of the missing pieces. There is also a growing community of projects working to close up some of the holes.

Property Binding

As I mentioned above, one the first things I found missing in GWT was property binding. If you don't know, property binding is a way of making state changes in one representation of data show up in another representation of the same data. This is commonly done in GUI code that uses the venerable MVC pattern. For example, say you had data that represented the personal information of somebody. That data would include stuff like their first, middle, and last names, street address, city, state or region, and postal code.

In MVC, you'd have a model, an object that captured just this information. A simple Person model might look like this:

public class Person
   public String firstName;
   public String middleName;
   public String lastName;
   public String address;
   public String city;
   public String region;
   public String postalCode;

You'd also have a GUI form that contained text controls for each one of these fields. In most GUI frameworks, including GWT, each of these controls (or widgets, in GWT terminology) contains a copy of that same data. A lot of GUI code is written that copies code from one to the other. Property binding is way to automate (some) of that boilerplate code and automatically copy the data from the first name widget to the Person.firstName field whenever the user enters a new value.

Right now, property binding support is missing in GWT. In my next few posts, I plan to talk about ways to address this shortcoming.

Related Topics >>


Sorry - forgot the link: InsiTech:

You might want to check out InsiTech's GWT binding solution. I'm currently using their automatic Swing binding for a number of WebStart applications and they have a pretty slick implementation. Drag and drop GUI design and binding. I haven't tried their GWT binding solution yet. It's payware - but it works well and is well worth a look.

yep, part of the inspiration for my blog about copy came from GWT: I am creating a soap web-service, and integrating XML services with GWT is something weird.. hoping to read the tricks of your next blog entries...