Wednesday, March 2, 2011

Re: View-Presenter Interaction Patterns in Google Web Toolkit (GWT)

The official UiBinder docs are valid for guit, the ui.xml part is 100% valid but the java part of the docs is not, you can easily translate it.


@UiField -> @ViewField

The difference between this two is that a @UiField can be of any type (i.e Button, Label) and a @ViewField can also be an interface (i.e HasText, HasHtml), as I mention before you also get interface emulation. As you can only bind interface you also get to bind the same field twice:
{{{
@ViewField 
HasText username; 

@ViewField("username") 
HasFocus usernameFocus; 
}}}

@UiHandler -> @ViewHandler

Here the difference is that the way you declare the binding:
//UiHandler
  @UiHandler("button")
 
void handleClick(ClickEvent e) {
   
Window.alert("Hello, AJAX");
 
}

// ViewHandler: two ways of doing it:
  @ViewHandler
 
void button$click() {
    Window.alert("Hello, AJAX");
 
}
  @ViewHandler(event=ClickEvent.class, fields="button")
 
void handleClick() {
    Window.alert("Hello, AJAX");
 
}

The other difference is the @ViewHandler supports a plugin system based on annotations, guits plugins:
  • @StopPropagation : call event.stopPropagation();
  • @PreventDefault : call event.preventDefault();
  • @KeyCode : only valid for key events, filters the key code 
  • @MouseButton : only valid for mouse events, filters the mouse button
  • @HasAttribute : filters that the element that cause the event have some dom attributes
  • @HasClass : filters that the element that cause the event have some classes
  • @RunAsync : run the method async 
  • @UserAction : fire a user action event when the event happens
You can also write your own plugins.

Regards

On Wed, Mar 2, 2011 at 2:45 PM, Kayode Odeyemi <dreyemi@gmail.com> wrote:
Gal, guit seems to be heavily dependent on uibinder. Can you help with
a full online/offline reference of uibinder?

Regards

On 3/2/11, Brian Reilly <brian.ireilly@gmail.com> wrote:
>> Hi,
>> so is this the correct approach for it http://tinypic.com/r/236vq0/7 ?
>>
>> When the Activity is created it gets the instance of the view and
>> creates a new presenter. It binds these two together. When the
>> activity is stopped (by place change) the presenter has to be set to
>> null.
>
> That seems about right to me. Both activities and presenters are
> considered lightweight objects and are therefore disposable. In fact,
> for your highest level widgets, a single class may fill the roles of
> both activity and presenter.
>
> -Brian
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>


--
Odeyemi 'Kayode O.

B.Sc(Hons) Econs, Application Developer & Systems Engineer (Sun Certified
Professional),
Oracle Certified Associate, Solaris Systems Administrator, Drupal Developer

Website: http://sinati.com <http://www.sinati.com>
Socialize with me: http://profile.to/charyorde, http://twitter.com/charyorde,

http://www.google.com/profiles/dreyemi
Skype:drecute

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/




--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment