It seems to me like you need a supervising presenter to coordinate
interactions among each of the panes of the application, in a
DockPanel as you suggest. The AppController would then bootstrap this
instead of managing what is shown in the root panel. Finally, the
logic that is in the AppController of the Contacts example would need
to be pushed down into this presenter or something that sits between
that and the contacts widget.

Doing this, though, removes a lot of responsibility from the
AppController. I don't know that the AppController is a bad idea. It
may be useful for a simple example. However, I think it would be more
useful to have a more self-contained contacts widget that could be
reused without having to worry about the AppController.

I haven't tried any of this myself yet, but I've been thinking about
similar issues related to managing view state when composing widgets
using MVP.

-Brian

On Feb 27, 12:32 pm, Andrew <[email protected]> wrote:
> The idea is to have multiple presenters throwing views up into their
> own little piece of real estate on the screen, then depending on
> different events, swap out presenters. For instance I want user
> information in one little box on the screen, and a header across the
> top. I want the user information screen to disappear and show a modify
> user screen in it's place when they click the modify user button, but
> I don't want anything to happen to the header when that happens. I
> have a different presenter for each piece of the application, for
> instance the User Screen, a Header, a part that shows a list of items.
> I already tried to do this, but when an event happened, a new screen
> would show and wipe out another one. In my case the modify user button
> was clicked, and it wiped out the header.
>
> I don't know how passing multiple containers to a presenter would
> solve this problem unless it was just a reference to a structure that
> was housing all of them. For instance a whole DockPanel gets passed
> down to each presenter and they all add themselves to the dock panel.
> I might try that and see what happens, but if anyone else has a better
> idea please let me know!
>
> Andy
>
> On Feb 26, 8:06 pm, Jim <[email protected]> wrote:
>
>
>
> > modify Presenter.go(HasWidget container) to Presenter.go(HasWidget...
> > containers).
>
> > On Feb 26, 5:18 pm, Andrew <[email protected]> wrote:
>
> > > Hey all. I've got a question about the GWT and more specifically the
> > > mvp architecture tutorial
>
> > >http://code.google.com/webtoolkit/doc/latest/tutorial/mvp-architectur...
>
> > > I've been messing around with this, and extending it for my own
> > > project, but i've run into a little problem.
>
> > > if (token != null){
> > >         Presenter presenter = null;
>
> > >         if (token == "user"){
> > >                 presenter = new UserPresenter(userRpcService, eventBus, 
> > > new
> > > UserView());
> > >         }
> > >         if (token == "edit"){
> > >                 presenter = new EditUserPresenter(userRpcService, 
> > > eventBus, new
> > > EditUserView());
> > >         }
>
> > >         if (presenter != null){
> > >                 presenter.go(root);
> > >         }
>
> > > In this code, we are passing the root panel to the presenter in order
> > > to tell it which panel to attach to. The problem is that I've tried
> > > attaching a couple of vertical panels to the root panel, then passing
> > > those into separate presenters so that I can display multiple
> > > presenter simultaneously, but it doesn't work. When the app loads, it
> > > will load all the seperate panels successfully, but when it tries to
> > > switch between the UserPresenter and the EditUserPresenter, all my
> > > other panels are removed from the screen.
>
> > > Does anyone have an answer for me why this won't work? I'm pretty
> > > stumped right now. Thanks!

-- 
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.

Reply via email to