Hi Mr. Broyer, I've updated gwt-mvp-sample following your tips. Do you have any other tip?
Thanks at all and I hope it could help someone. If someone else have any other tip or want to discuss about it, please just reply this e-mail. Best Regards On Fri, Jul 10, 2009 at 12:11 PM, Thomas Broyer<t.bro...@gmail.com> wrote: > > > > On 10 juil, 15:15, Eduardo Nunes <esnu...@gmail.com> wrote: >> On Fri, Jul 10, 2009 at 7:10 AM, Thomas Broyer<t.bro...@gmail.com> wrote: >> >> >> > 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). > [...] >> > 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. > > Pretty easy: > - first, replace "Widget getWidget()" in your presenters with "View > getView()" and simply implement it as "return view" (instead of > "return view.getWidget()"); eventually introduce a generic View > interface with a single getWidget() method, and a generic Presenter > interface with a single getView() method. > - next, introduce a MainPresenter.View interface, and move all the > code in MainPresenter dealing Widgets into an implementation of > MainPresenter.View; the MainPresenter.View will have methods taking > views in argument, and the implementation of MainPresenter.View will > get their respective widgets using their getWidget() method. > > ...and instead of your "Widget go(Issue)" method, I'd have two > methods: getView() as above (with the view having a getWidget() > method) and showIssue(issue). > (In Ray Ryan's I/O presentation, see slide #62 which shows an editPhone > (Phone) method's implementation) > > > -- 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 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 -~----------~----~----~----~------~----~------~--~---