org.apache.tapestry.annotations
Annotation Type EventListener


@Target(value=METHOD)
@Retention(value=RUNTIME)
@Documented
public @interface EventListener

Annotation used to connect an event on a component / page with a particular listener method. This is currently intended to be used to connect client side events to listener methods but may have uses elsewhere.


Required Element Summary
 String[] events
          The list of events that should cause this listener to invoke.
 
Optional Element Summary
 boolean async
          If used in conjunction with submitForm() (or just targeting a IFormComponent), will either submit the form normally or asynchronously.
 boolean autoSubmit
          When any of the components targeted for an event is an instance of IFormComponent this setting can allow the form to be automatically discovered when wiring this listener up to the event such that it is submitted for you automatically without having to specify a submitForm() parameter.
 String[] elements
          The unique html element ids to listen to the events on.
 boolean focus
          Controls whether or not any forms being submitted as part of this event will request focus as per normal form semantics.
 String submitForm
          The form id of the form that should have its data submitted when one of the specified events is triggered.
 String[] targets
          The unique IComponent ids of the targeted sources that this listener will be listening to events on.
 boolean validateForm
          Whether or not to perform form validation if the submitForm() parameter has been set.
 

Element Detail

events

public abstract String[] events
The list of events that should cause this listener to invoke. Ie events = {"onClick", "onOptionSelect"} etc..

targets

public abstract String[] targets
The unique IComponent ids of the targeted sources that this listener will be listening to events on.

Default:
{}

elements

public abstract String[] elements
The unique html element ids to listen to the events on.

Default:
{}

submitForm

public abstract String submitForm
The form id of the form that should have its data submitted when one of the specified events is triggered.

Returns:
The form name (or id of component) to submit when event is triggered.
Default:
""

autoSubmit

public abstract boolean autoSubmit
When any of the components targeted for an event is an instance of IFormComponent this setting can allow the form to be automatically discovered when wiring this listener up to the event such that it is submitted for you automatically without having to specify a submitForm() parameter. The default is true.

Returns:
True if IFormComponents should submit their containing forms by default, false otherwise.
Default:
true

validateForm

public abstract boolean validateForm
Whether or not to perform form validation if the submitForm() parameter has been set. Default is false.

Returns:
Whether or not to validate the form.
Default:
false

focus

public abstract boolean focus
Controls whether or not any forms being submitted as part of this event will request focus as per normal form semantics. The default is false.

Returns:
True if the form should get focus, false otherwise. The default is false.
Default:
false

async

public abstract boolean async
If used in conjunction with submitForm() (or just targeting a IFormComponent), will either submit the form normally or asynchronously. Default is asyncrhonous.

Returns:
True if form should be submitted asynchronously, false otherwise.
Default:
true


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.