On 30 nov, 22:39, Dalla <dalla_man...@hotmail.com> wrote:
> I´ve been working on some small projects using GWT 1.6.4 and 1.7.1.
> I know alot of people tried their best to pick up on Ray Ryans "GWT
> Best practice" from Google IO 2009,
> where using MVP was one of the main guidelines.
>
> I recently started looking at GWT RC1 and the new UiBinder.
> Using the UiBinder it seems like the only way to handle events from
> the components defined
> are to handle them with the @UiHandler annotation inside the view
> class.
> This seems to move things away from MVP, at least the way I learned,
> or did I miss something here?

You can very well just have your components have a ui:field attribute,
with the corresponding @UiField-annotated field on your View class,
and then return the component from a getter method (defined on the
Display interface implemented by the View); then on your presenter,
call the addXXXHandler to add your event handler.
That's what we're doing for 2 months now (as soon as 2.0 MS1 were
available) and it works very well.

> What are your thoughts on this?

There was a discussion some weeks ago about optimization of handlers
and implementing them all in one inner-class instead of using multiple
anonymous classes (one at each addXXXHandler call point generally),
and some one (Ray Ryan?) responded that UiBinder's @UiHandler could do
this automatically (in the future), or could even come with something
even more optimized, so that if you really wanted to optimize your
code you'd rather use @UiHandler than creating such an inner class by
hand.
Now, that effectively doesn't fit very well with Ray's presentation at
I/O, but it still puts layout management out of your view (java code;
pun intended) and pushed in to the ui.xml file; so, the ui.xml would
somehow be the view and the java class that calls it via UiBinder the
presenter. But this effectively defeats unit testing using mocks such
as with EasyMock.

--

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