I used GWT at 1.2.x for a while and did a little project on that. and then never use GWT too much. Recently,
GWT 2.1 RC 1 is released. I think why not pick it up. This blog aims to summary some related infos and my tips on GWT2.1 RC 1 MVP (Modle-View-Presenter) subject.
Since Ran Ryan's
gwt best practices talk at Google IO 09, the gwt community has some implementations over the MVP ideas:
GWTP and
MVP4g . GWT team decided to put MVP into the gwt-2.1, named as
MVP framework (Activity and Place)
As every other new framework or technology, GWT MVP framework has many terms and some of them are not so intuitive. However, Google alway offers documentations and examples.
Here is a list of google references on this subject:
Thomas Broyer on his blog wrote a serie of
article over the MVP concept
In this blog, I am going to try explain the concept very briefly and give a example.
Place:
one place is one bookmark-able URL of your GWT app, each place has its own String token, and each place can be accessed via a URL. For example, you application URL is localhost:8888, your place A's string token is "home", the URL for this place is localhost:8888#home.
Place is just a java class, you put state information into it.
Activity:
IMO really a bad naming, Activity is a presenter in MVP term. one place should point to a activity. It is possible to point multiple place to the same activity. As mentioned, place can contains state, so you choose activity to response different state.
View:
In GWT MVP, Activity supposes to fetch the view, and add the view to the page.
so Place-->Act-->View-->Other Places
Next blog will give a example using gwt mvp framework