Building a GAE+GWT application using the best practices, Part 1

This is the first installment of the series “Building a GAE+GWT application using the best practices“.

Introduction

In the next few blog posts, I’m going to present my experience building a simple (but non-trivial) web application using GWT and Google App Engine, while applying the best practices introduced by Ray Ryan in his excellent presentation at Google IO last year.

The application I’m going to build is called RateChecker. It’s simply a tool that goes fetches the posted USD/CAD exchange rate from a bank website, persists the rate to the data store, and present the user with the recent rates when requested. It can potentially do more (like generating a histogram of the rates, etc), but for the purpose of blog series, I’m going with the basics to illustrate the implementation pattern without losing my bearings in the embellishing.

Here’s a screenshot of the finished application:

The Goals

I intend to use this minimal application to practice using the following technologies/techniques:

  • Server/Persistence tier:
    • Google Guice as dependency injection container on the server side
    • JDO as the persistence layer
    • AppEngine Cron task
    • Command pattern for request handling
  • Client tier:
    • Google GIN as dependency injection container on the client side
    • Model-View-Presenter pattern on the client side
    • EventBus to decouple components
    • Command pattern for remote service calls
  • Unit Testing on both Client/Server side with mock objects

Also I plan to rewrite the service layer with one of the alternate JVM language, such as Scala or Clojure, if I my schedule allows and I have enough motivation.

GXT Widget Expander 1.0 release

This project aims to add flexibility to GXT row expander by enabling putting arbitrary widgets in the expanded row.

GXT’s grid widget is great, especially with the RowExpander plugin, it allows the creation of a Google Reader style grid (a list with expandable rows). However, the current GXT’s RowExpander design only allows rendering by XTemplate. XTemplate falls short in a number of ways, especially when it comes to user interaction inside the expanded rows.

Using the WidgetExpander, you’ll write something similar to the following

    WidgetExpander<SomeModel> expander = new WidgetExpander<SomeModel>(new WidgetRowRenderer<SomeModel>() {

        public Widget render(final SomeModel model, final int rowIdx) {
            // Create and return a widget according to the model
        }
    });

    // Add expander into a list of ColumnConfigs
    // Create a grid with the ColumnConfig list
    grid.addGridPlugin(expander);

With this enhancement, we’re now able to do this:

Check it out here on Github: http://github.com/kevinjqiu/gxt-widget-expander