I'm finally starting to "get" GWT. At any time, a PlaceChangeEvent can be fired on the app's EventBus like so:
History.newItem("token-for-some-new-place");
This adds the event to the bus, whereby a registered ActivityManager scoops it up and consults its internal ActivityMapper to give it the Activity associated with the PlaceChangeEvent's Place.
The Activity (similar to a presenter or controller object from MVP/MVC) then obtains any data that is needed (via RPC calls to the server) and executes any business logic and configures the final view (typically a Composite of some sort) to display.
As long as we're talking about a super-simple GWT app that only has one display region on its host page, then like I said, I "get" it.
Where I am choking now is what happens when you have an app that contains multiple display regions (areas that can be updated asynchronously from one another).
So I ask:
- How granular are
ActivityMappers supposed to be? Is there just one app-wideAppActivityMapperthat maps allPlaces to allActivityies, or should there be some sort ofActivityMapperhierarchy/decomposition, where you have multiple mappers? (And if your answer to this is something along the lines of "this depends on the needs of your application" then please explain what requirements/needs drive the appropriate level of granularity!) - If a
Placerepresents a URL token in your app (for the sake of making thePlacea bookmarkable state), then what happens when you have a more complex app that has multiple display regions (D1, D2, D3). How does one URL token (i.e.http://myapp.com/#token-for-some-new-place) map to D1, D2 and D3? Wouldn't that meanActivityMapper#getActivitywould have to be capable of returning a list of activities (List<Activity>) whosestart(AcceptsOneWidget, EventBus)methods would all get callled?
Thanks for any help here - code examples always rock.