My understanding of GWT's Activities and Places is that for a given region on a screen you have an ActivityManager
and an ActivityMapper
. You can have multiple regions on the screen which means you can have multiple ActivityManagers
and ActivityMappers
(one per region). So, whenever there is a PlaceChange
the ActivityManagers
ask their respective ActivityMapper
what activity it is supposed to be showing given the Place
. This works great as long as your Places
all have a common layout that they reuse in different ways to perform different activities. My question is how do we handle the case where different Places
use radically different layouts? My first thought is to just have even more ActivityManagers
and ActivityMappers
, if the Place
doesn't use a particular region then the ActivityMapper
for that region will simply return null
when we change to that Place
. If there is a better way I would appreciate any wisdom.
GWT using Activities and Places when screen layout changes per place
329 views Asked by tleef At
1
I found it much easier to use a single ActivityMapper/ActivityManager pair for the entire app.
In a typical case you have a "menu" region and a "main" region. The menu region is very basic: a click on a menu item sends a user to a new place. It also highlights the newly selected item and resets the style of the previously selected item. All of this can be easily done in a simple widget that you can include in all views where this menu is required. Having separate ActivityMapper and ActivityManager for the menu region just complicates everything without providing any benefits.
I use the same approach for "top menu" region and "left menu/tree" region: a widget that tells the presenter which data to show in the "main" region.
I have over 50 different places in my app, and it really helps to have a simple architecture: each place corresponds to one view and one activity.