I'm going to ignore the Place/Activity nomenclature, as I don't use
that code.  Application architecture should be readily portable to
whatever framework you are using, however.

In my application, I have many pages with multiple presenters.  In
fact, I'd say thats the norm, and having only one is an oddity.
Creating sub-presenters (I call them panel presenters, as opposed to
page presenters) allows for some good code reuse in my project,
although it does come at the cost of making it a bit harder to follow
when going through the code.

My page view has methods on it to access the panel view interfaces,
and I grab those and pass them onto the panel presenters that I create
in the start method of my page presenter.

So, in pseudocode:

class BigPagePresenter {
  private final BigPageView view;
  start(){
    new PanelPresenter1(this.view.getPanelView1()).start();
    new PanelPresenter2(this.view.getPanelView2()).start();
    ...
    new PanelPresenterN(this.view.getPanelViewN()).start();
  }
}

I usually also hold onto references to these panel presenters so I can
coordinate with them for things like updates, etc.  I handle repeating
panels by having a collection of panel presenters.

This scheme seems to be working quite well for me.  I'm sure there is
a relatively straightforward way to implement something like this in
GWT-Place/Activity-land.

The worry about huge dependencies could be solved in 2 ways, I
figure.  The first way, is to not inject anything.  I normally have
very little to no code in the page presenters, due to most of the
logic residing in all of the panels.  While this is leaving code not
covered, I've never really been a proponent of 100% coverage anyway.
The second way, which I have started to use more heavily, is to use a
factory object to create your sub-presenters.  Then you can simply
inject a different factory for testing.  Still the same literal number
of dependencies, but it is bundled together rather nicely.

I personally don't use any dependency injection frameworks either, as
I prefer to manage that myself.  I find simply creating an
ApplicationResourceBundle (or whatever else you want to call it)
interface, and passing that to all of the presenters pretty much
handles everything that a framework would do for you, while at the
same time keeping it all in nice, simple POJOs, which I greatly
appreciate.

-Ben

On Jan 24, 12:36 pm, Jeroen Wolff <jeroen.wo...@gmail.com> wrote:
> Hi, i've got the same question.
>
> Now i use sub presenters to show repeating panel with the same widgets
> and ui handling.
> A repeating panel is now a sub presenter of my presenter.
>
> Wat is the best way to approach this with activities?
>
> Regards,
>
> Jeroen

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to