Class AjaxEventBehavior

All Implemented Interfaces:
Serializable, IComponentAwareEventSink, IRequestListener, IComponentAwareHeaderContributor, IClusterable
Direct Known Subclasses:
AjaxEditableLabel.LabelAjaxBehavior, AjaxFileDropBehavior, AjaxFormComponentUpdatingBehavior, AjaxFormSubmitBehavior, AjaxPagingNavigationBehavior, AjaxPreventSubmitBehavior

public abstract class AjaxEventBehavior extends AbstractDefaultAjaxBehavior
An ajax behavior that is attached to a certain client-side (usually javascript) event, such as click, change, keydown, etc.

Example:

         WebMarkupContainer div=new WebMarkupContainer(...);
         div.setOutputMarkupId(true);
         div.add(new AjaxEventBehavior("click") {
             protected void onEvent(AjaxRequestTarget target) {
                 System.out.println("ajax here!");
             }
         }
 
This behavior will be linked to the click javascript event of the div WebMarkupContainer represents, and so anytime a user clicks this div the onEvent(AjaxRequestTarget) of the behavior is invoked.

Note: getEvent() method cuts any on prefix from the given event name(s). This is being done for easier migration of applications coming from Wicket 1.5.x where Wicket used inline attributes like 'onclick=...'. If the application needs to use custom events with names starting with on then getEvent() should be overridden.

Since:
1.2
Author:
Igor Vaynberg (ivaynberg)
See Also: