On 10 juil, 15:15, Eduardo Nunes <[email protected]> wrote:
> On Fri, Jul 10, 2009 at 7:10 AM, Thomas Broyer<[email protected]> 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)
--~--~---------~--~----~------------~-------~--~----~
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