MASTER-DETAIL with MVP

174 views
Skip to first unread message

sampath sai

unread,
Dec 16, 2011, 1:34:35 AM12/16/11
to google-we...@googlegroups.com


Hi,


I am trying to implement Master and Details using activities and places. Below are code snippets

 

     <g:FlowPanel>

        <g:SimplePanel styleName="{style.entityDetails}" ui:field='master'></g:SimplePanel>

              </g:FlowPanel>

        <g:SimplePanel styleName="{style.entityDetails}" ui:field='details'></g:SimplePanel>

      </g:FlowPanel>

 

 

Attached each activity mappers for views

final ActivityManager masterActivityManager = new ActivityManager(applicationMasterActivities, eventBus);

             

masterActivityManager.setDisplay(shell.getMasterPanel());

             

 

             

              final ActivityManager detailsActivityManager = new ActivityManager(applicationDetailsActivities, eventBus);

 

              detailsActivityManager.setDisplay(shell.getDetailsPanel());

 

 

Problem is when I got any place both the activities are getting evoked.  I want details activity only when someone  selects on celltable(which will be attached to master display)

 

Thanks,
Sai

Jens

unread,
Dec 16, 2011, 8:52:00 AM12/16/11
to google-we...@googlegroups.com
Your activity mappers are responsible to do this. If you dont need an activity for a given place then just return null (or a placeholder activity that can show a custom message or something, e.g. "Please select an entry in the table above"). If you return null in your details activity mapper then your details panel will be empty.

-- J.

David

unread,
Dec 16, 2011, 11:17:37 AM12/16/11
to Google Web Toolkit
I usually associate the url/token in the browser address with a single
Activity/Place. I usually just revert back to the old style
Presenters , rather than attempting to nest additional Activity/
Place(s).

Most of my apps use this pattern:
Activity/Place associated with the url / Activity making rpc and
loading a View
This also works if multiple Views need to be managed from the same
Activity.

If however different Views require their own data sources then the
pattern changes to:
Activity/Place associated with the url / Activity managing
multiple Presenters / Presenter making rpc and loading a View

Reply all
Reply to author
Forward
0 new messages