On 14 oct, 06:38, ailinykh <[email protected]> wrote: > Hello, everybody! > I'm confused with latest MVP pattern. My problem is: > Let's say I have main layout which consists of several widgets. > Something like this > > <g:DockLayoutPanel unit='EM'> > <g:north size="4"> > <my:MyNorthWidget/> > > </g:north> > <g:west size="20"> > <my:MyWestWidget/> > > </g:west> > <g:center> > <my:MyCenterWidget/> > </g:center> > </g:DockLayoutPanel> > > So, I have three widgets- MyNorthWidget, MyWestWidget and > MyCenterWidget. I would like to have a presenter (Activity) for each > of them. > But I have only one Place, which means I may have only one Activity > and this Activity is aware about all widgets. Is there a way to make > widgets reusable?
Place <-> Activity is *not* a 1:1. Its' hard to tell from your example how it'd better be done, so I'll try to guess. Case 1: you don't really have those widgets, but rather "placeholders" where you'll put them on place change (what I call "display regions"). In other words, this is the layout of your app, at the "top level" of your widget hierarchy In this case, you'll have 3 ActivityManager, one for each display region, and each one with its ActivityMapper. Case 2: the DockLayoutPanel is the "view" of an activity, and you want to subdivide it into 3 "subactivities". In this case, your "docklayoutpanel activity" should probably instantiate and manage the lifecycle of the subactivities itself; or maybe you shouldn't even use the Activity interface for your "sub parts". The idea anyway is that your "docklayoutpanel activity" *knows* the "sub parts" and manages them, whether they're "just widgets" (or components composed of a presenter and a view). Maybe this can help you: http://tbroyer.posterous.com/gwt-21-activities-nesting-yagni (it was written for 2.1 M3 and I haven't updated it yet, you'll find the list of changes between M3 and RC1 at http://tbroyer.posterous.com/gwt-21-places-activities-what-changed-between ) -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
