Monday, November 29, 2010

GWT 2.1 Activities – nesting? YAGNI ? - an example of where you NEED it !

Hello Everyone,

GWT MVP 2.1 has no direct support for complex layout/views and nested/
composite activities.
ActivityManager only AcceptsOneWidget.

To get around this design limitation, it was suggested to have
multiple ActivityManagers, each responsible for a given display

The example given in the article below, talks about 4 Display Regions/
Activity Managers.

Having carefully read it, and trying to apply this in my application,
came across the limitation of this approach, and where it falls short.

first have a look at this mock-up to get an idea of what i'm going to
talk about:

lets think about the idea of workspace in UI design.
your application might have a number of workspaces.
each workspace focuses on one aspect of the problem your application
is designed to address.
a workspace, groups together a set of use cases that are closely
related, and work together to collaboratively accomplish the goal of
the workspace.

to put it in concrete terms, lets say your application requires User
Management feature.
creating groups, each group can have sub-groups (tree structure). each
user has certain roles within the group,
and certain access control. you want to CRUD "groups", "users",
"roles", "permissions".
these use cases are closely related. so we encapsulate them in User
Management Workspace.

your application might require other features: Document Management,
Task Management, Calendar,
we put all Task Management use cases in Task Management Workspace. and
so on.

in UI terms, each Workspace can have its own Regions: North, South,
East, West, Center
the number, size and arrangement of these regions might differ from
workspace to workspace.

One Workspace might require the West Region to have 3 sub-regions:
West North, West Center, West South.

Another Workspace might require East Region to have 2 sub-regions:
East North, East Main
and i am not going to talk about cases where you might need 2 West
Regions !

as you can see with , 1 North, 1 West(3 subregions) , 1 Center (2 sub-
regions), 1 East (2 subregions)
1 + 1x3 + 1x2 + 1x2 = 8
we need at least 8 display regions, and in complex cases, this might
get to 14 !
and we have to size these regions explicitly upfront. (what if for one
workspace East Region needs to be X width, and for another it needs to
be Y width ?)

to implement this with GWT MVP, according to the approach suggested in
the article,
we need 8 Activity Managers, 8 Activity Mappers.
even though regions of a workspace are closely related, since you had
to split your layout up front,
instead of grouping related regions/activities in one place, they get
NorthRegionActivityMapper, WestNorthActivityMapper,
WestCenterActivityMapper, WestSouthActivityMapper,
CenterNorthActivityMapper, CenterMainActivityMapper,
EastNorthActivityMapper, EastCenterActivityMapper

and for example for our User Management Workspace,
we would have code like this:


if(place instanceof UserManagementWorkspace)
new GroupsTreeActivity() // a tree of groups, each group sub-group,
selection of each updates center region

if (place instanceof UserManagementWorkspace)
new ToolbarActivity()

since we have 8 ActivityMappers, it is difficult to keep track of
which activity is in what region .

do you think having 8 ActivityManagers/Mappers is a good idea ?!
What if an application needs 10 ?!

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment