Ported Address Book to Google App Engine

I managed to port the Address Book (from the tutorial) to Google’s App Engine. It’s at

http://vaadin-app.appspot.com/

The main problem I had was the tree items didn’t work. It turned out to be (I assume) a serialization issue. The main class’ item listener compared itemId == string value which no longer worked so I changed the item listener to work with String objects, casting if itemId was a String and using equals(). Here’s the code snippet:

public void itemClick(ItemClickEvent event) {
// When I “ported” this to App Engine itemId no longer
// was the same as NavigationTree.SHOW_ALL (for example).
if (event.getSource() == tree) {
Object itemId = event.getItemId();
if (itemId != null) {
if (itemId instanceof String) {
if (((String)itemId).equals(NavigationTree.SHOW_ALL)) {

        // Clear previous filters.
        this.getDataSource().removeAllContainerFilters();
        showListView();
      } else if (((String)itemId).equals(NavigationTree.SEARCH)) {
        showSearchView();
      }
    } else if (itemId instanceof SearchFilter) {
      this.search((SearchFilter)itemId);
    }
  }
}

I’m pretty impressed with Vaadin so far.

Thank you for reporting this. Fixed in SVN with a slightly simpler construct:


if (itemId != null) {
    if (NavigationTree.SHOW_ALL.equals(itemId)) {
        // Clear previous filters.
        this.getDataSource().removeAllContainerFilters();
        showListView();
    } else if (NavigationTree.SEARCH.equals(itemId)) {
        showSearchView();
    } else if (itemId instanceof SearchFilter) {
        this.search((SearchFilter)itemId);
    }
}