How to navigate
To navigate to a new Place in your application, call the goTo()
method on your PlaceController. This is illustrated above in the goTo()
method of HelloActivity. PlaceController warns the current Activity that
it may be stopping (via a PlaceChangeRequest event) and once allowed,
fires a PlaceChangeEvent with the new Place. The PlaceHistoryHandler
listens for PlaceChangeEvents and updates the URL history token
accordingly. The ActivityManager also listens for PlaceChangeEvents and
uses your app's ActivityMapper to start the Activity associated with the
new Place.
Rather than using PlaceController.goTo(), you can also create a
Hyperlink containing the history token for the new Place obtained by
calling your PlaceHistoryMapper.getToken(). When the user navigates to a
new URL (via hyperlink, back button, or bookmark), PlaceHistoryHandler
catches the ValueChangeEvent from the History object and calls your
app's PlaceHistoryMapper to turn the history token into its
corresponding Place. It then calls PlaceController.goTo() with the new
Place.
What about apps with multiple panels in the same window whose
state should all be saved together in a single URL? GWT 2.1 does not
attempt to provide a generic implementation of a composite Place;
however, your app could create a CompositePlace, CompositeActivity, and
CompositePlace.Tokenizer classes that delegate to the constituent
members. In this case, only the composite objects would need to be
registered with your app's ActivityMapper and PlaceHistoryMapper.