GWT using Activities and Places

I’ve tried to simplify and categorize my vision of “Activities and Places” in real application since HelloWorld app from Google’s page doesn’t provide overview of the full-cycle development and shows us only 10% of the iceberg. Maybe this diagram will help someone either. Although in most cases the whole page can be one active area, example shows how to use two independent displays on the page (in this case Menu and Content). It can be useful, for example if you have completely different page views for site-administrator and user.

GWT: client code optimization

I’d like to share with you one tip which I’ve learned only yesterday, in spite of the fact that you may already know it.

Our GWT project is written with a lot of modules that include initialization of child modules in their constructors which initialize a lot of another modules in their constructors and so on… Some modules can load different data for initial rendering, despite the fact that user won’t see them in current session, however this data and asynchronous calls are forcing application server to do unuseful job and weighty client code makes some delays on application start up in user’s browser.

Here is the solution! Recently I read about ReadAsyncCallback interface which allows to easily make deferred calls right in the client code. Just imagine, it allows you to make deferred method call in a client code in the same way as you make requests to your remote services:

GWT.runAsync(new RunAsyncCallback() {
    public void onSuccess() {
      new SomeModule().show();
    }
    public void onFailure(Throwable ohNoes) {
    }
  });

This really simple method tells compiler to split your code into parts if it possible without any bad consequences.

To learn some details and limitations of this feature read the official documentation.