On 10 juil, 08:40, Gert <gsch...@gmail.com> wrote:
> On Jul 10, 12:47 am, Eduardo Nunes <esnu...@gmail.com> wrote:
>
> > Hello guys,
>
> > I had a little difficulty to define how establish a communication
> > between the Presenters. When you deal with just one Presenter, the MVP
> > pattern is very simple to understand. After a while I found my
> > solution and I decided to share it with you all. I created a simple
> > application that contains just four Presenters. It's a small piece of
> > a briefing issue tracker - well the application domain itself doesn't
> > matter.
>
> > Please, take a look on it and gimme some feedbacks, the idea is to
> > discuss about it to improve the pattern knowledge at all. In the main
> > page of the project you will find a brief description of it, the
> > screens shots, svn access and a simple download.
>
> >http://gwt-mvp-sample.googlecode.com
>
> > I'm looking forward to your replies.

I wouldn't have used an addClickHandler on the View, but rather a
"HasClickHandlers getAddIssueButton()". Also, I would have named the
EditIssuePresenter method showIssue(Issue issue) instead of go(Issue
issue).

> Without looking into the inter-presenter communication, I think you
> missed a pretty important point made in the google IO vid (25m1s into
> it,http://www.youtube.com/watch?v=PDuhR18-EdM#t=25m1):Your
> presenters and their views should not deal with widgets, but with
> abstracts like HasValue.

I guess it's the crux of Eduardo's experiment: instantiating a new
presenter is easy, as well as registering event handlers and getting/
setting view "values" from the presenter (all of this was explained by
Ray during his I/O session). Putting a component within a RootPanel
isn't that difficult (the .go() method used by Ray) but you introduce
a depending from your presenter on HasWidgets (this has been discussed
already, with no real solution).
Actually, the problem is not really about *communicating* between
presenters (this is the event bus' role) but adding presenters to your
"views": the .go(HasWidget) method is a bit too restrictive: you want
to show/hide (call it activate/deactivate if you prefer) components (I
don't need the ContactDetails when the user is looking at the
ContactList, and I therefore want the ContactDetails to disappear from
screen), you want to add them to complex panels (a Grid or FlexTable,
a DockPanel, a TabPanel, an AbsolutePanel, etc.) where HasWidgets and
a single .add(Widget) isn't enough; and you probably don't want to
wrap your components into SimplePanel's just for the sake of having a
simple .add(Widget).
I do think it's the View's responsibility to attach a "child View" at
the correct "location", maybe along with setting its size and other
"presentation" properties, but yet the parent View still have to cast
the child View into a Widget, or each View has to provide a getWidget
() method just like Eduardo did (the fact that the Presenter also has
a getWidget() is a different thing, but it would at least have to have
a getView() method so you can instantiate a "child Presenter" and pass
it's view to your view to add the view's widget into your own view's
widgets...)
--~--~---------~--~----~------------~-------~--~----~
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