gwtXPDownloadsBlog

Actions and Handlers

Event handling methods

gwtXP generate code to register handlers to the widgets. The handler in turn will call appropriate Controller method for handling user’s actions. We name this method  event handler or event handling method. Requirements for event handling method:

  • Must be a public method
  • Must have zero parameter or one parameter of type com.google.gwt.event.shared.GwtEvent

Examples for valid event handling method:

public void save(){
  ...
}
public void fetchRoles(){
  ...
}

Event name

Event name in gwtXP follows the GWT one. Table below list common event names.

Handler Event name Description
ChangeHandler onChange Called when a change event is fired.
ClickHandler onClick Called when a native click event is fired.
KeyPressHandler onKeyPress Called when KeyPressEvent is fired.
ResizeHandler onResize Fired when the widget is resized.
SelectionHandler onSelection Called when SelectionEvent is fired.
ValueChangeHandler onValueChange Called when ValueChangeEvent is fired.

Please note: this table is adopted from GWT EventHandler API document.

Setup event handler

In gwtxp.xml file, we can define event handler as below:

<button onClick="#{fetchRoles}" />

References

See References for complete document of widget properties and event names.

Share and Enjoy:

  • Google Bookmarks
  • Twitter
  • Facebook
  • Digg
  • Technorati
  • Live
  • DZone
  • Reddit
  • del.icio.us
  • Mixx
  • Netvibes
  • StumbleUpon
  • Yahoo! Bookmarks
  • Yahoo! Buzz
  • email


Recent Comments:

  • Colin: @Piotr Szaranski: I had the same issue with authentication, and I also was looking for...
  • Ora Finona: This is a bit off discussion, which I apologize for, but would you and your readers...
  • Amos: First, thanks for some great software. This is great to have. Here are collection of notes...
  • Peter Frankmann: Hallo zusammen, Sehr gute Beiträge. Danke dafür. Werde wohl noch öfters mal...
  • Trung: SyncProxy depends in gdata java client, thus download it from code.google.com Hope this...