On Fri, Jul 10, 2009 at 7:10 AM, Thomas Broyer<[email protected]> wrote: > > > > On 10 juil, 08:40, Gert <[email protected]> wrote: >> On Jul 10, 12:47 am, Eduardo Nunes <[email protected]> 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...)
I didn't realize how to implement what you described. Please, if you have time for it, modify my sample application to follow the things you pointed out, our if you want to I can add you to the project, so you can create a branch with this modification. What do you think? > > > -- Eduardo S. Nunes http://e-nunes.com.br --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
