FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Web Development
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
December 10, 2007

Hands-On Google Web Toolkit

(Page 5 of 5)

Fit and Polish

Support for browser history has always been tricky in web applications, especially in the Ajax world ("please use my special previous arrow, not the big one you click everywhere else!"). Thankfully, GWT provides easy integration with browser history. As users navigate through their pictures, GWTFlow pushes entries onto the browser history stack. By implementing HistoryListener in the GWTFlow.java controller, the application receives notification of history events. This lets users navigate the application like a traditional website: Pushing the back button shows the previous image or dialog screen, not the previous website.

Because the URL is changing in the browser bar, a nice side effect is that bookmark support comes for free. Users returning to the site will see the exact same state of the application where they bookmarked it. Figure 4 is the completed application.

[Click image to view at full size]

Figure 4: You can see a few images before and after the current one. Click on any image to move to it or press the browser's Back button to go back to the last picture selected.

Conclusion

JavaScript is the new Assembly language. Google Web Toolkit lets you create Ajax programs in Java and compile them into browser-specific JavaScript, hiding most of the browser quirks that unnecessarily complicate Ajax development. Using GWT, you can create highly interactive applications that run on all major browsers with no plug-ins. Most importantly, you can do it with a portable, object-oriented language and mature tools that you already know.

References

A live demo of GWTFlow and source code is available at www.adamhoughton.com/GWTFlow. Here are a few resources to help you learn more about GWT:

  • The GWT homepage is at code.google.com/webtoolkit.
  • The GWT team blog is available at googlewebtoolkit.blogspot.com.
  • The GWT Forum is at groups.google.com/group/Google-Web-Toolkit.
  • The GWT Widget Library is at gwt-widget .sourceforge.net.
  • Ed's book Google Web Toolkit: Taking the Pain Out of Ajax is available at pragmaticprogrammer.com/titles/ebgwt.
  • Robert Hanson and Adam Tacy's book GWT in Action book is available at www.manning.com/hanson.
  • GWT Designer is at www.instantiations.com/gwtdesigner.

Previous Page | 1 Why GWT? | 2 Getting Started | 3 Hosted versus Web Mode | 4 Designing the User Interface | 5 Fit and Polish
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK