org.apache.tapestry.spec
Interface IEventListener

All Known Subinterfaces:
IComponentSpecification
All Known Implementing Classes:
ComponentSpecification

public interface IEventListener

Specification for something that can listen to and act on client side generated browser events.


Method Summary
 void addElementEventListener(String elementId, String[] events, String methodName, String formId, boolean validateForm, boolean async, boolean focus)
          Adds a deferred event listener binding for the specified html element.
 void addEventListener(String componentId, String[] events, String methodName, String formId, boolean validateForm, boolean async, boolean focus, boolean autoSubmit)
          Adds a deferred event listener binding for the specified component.
 void connectAutoSubmitEvents(IComponent component, IForm form)
          Invoked during rendering when a component has been detected as a IFormComponent and may possibly need its events to be wired up as form events.
 Map getComponentEvents()
          Gets all component event mappings.
 ComponentEventProperty getComponentEvents(String componentId)
          Gets component bound event properties.
 Map getElementEvents()
          Gets all mapped element events for this component.
 ComponentEventProperty getElementEvents(String elementId)
          Gets element bound event properties.
 EventBoundListener[] getFormEvents(String formId, BrowserEvent event)
          Returns a list of element / component bound event listeners that were specified as invoking the form component with a matching id to formId of type EventBoundListener .
 boolean hasElementEvents()
          Checks if any element events are bound to this component.
 void rewireComponentId(String componentId, String extendedId, String idPath)
          Invoked during page load to map event connections previously made via the IComponent.getId() identifier to use the more unique IComponent.getIdPath().
 

Method Detail

addEventListener

void addEventListener(String componentId,
                      String[] events,
                      String methodName,
                      String formId,
                      boolean validateForm,
                      boolean async,
                      boolean focus,
                      boolean autoSubmit)
Adds a deferred event listener binding for the specified component.

Parameters:
componentId - The component this is for.
events - The events that should cause the listener to be executed.
methodName - The page/component listener name that should be executed when one of the supplied events occurs.
formId - The optional id of the form that should be submitted as part of this event invocation.
validateForm - If a formId was specified, whether or not that form should have client side valiation invoked during the process.
async - If submitting a form, whether or not to do it asynchronously.
focus - If submitting a form, controls whether or not to focus it after an update.
autoSubmit - If true - auto form wiring is performed on any component targets implementing IFormComponent so that the enclosing form is submitted as part of the event in order to maintain consistent form state as in normal listener method invocations.

addElementEventListener

void addElementEventListener(String elementId,
                             String[] events,
                             String methodName,
                             String formId,
                             boolean validateForm,
                             boolean async,
                             boolean focus)
Adds a deferred event listener binding for the specified html element.

Parameters:
elementId - The client side html element id to match against.
events - The client side events to bind to.
methodName - The listener that should be invoked when the event happens.
formId - The optional id of the form that should be submitted as part of this event invocation.
validateForm - If a formId was specified, whether or not that form should have client side valiation invoked during the process.
async - If submitting a form, whether or not to do it asynchronously.
focus - If submitting a form, controls whether or not to focus it after an update.

connectAutoSubmitEvents

void connectAutoSubmitEvents(IComponent component,
                             IForm form)
Invoked during rendering when a component has been detected as a IFormComponent and may possibly need its events to be wired up as form events.

Parameters:
component - The component to rewire form events for.
form - The form containing the component.

hasElementEvents

boolean hasElementEvents()
Checks if any element events are bound to this component.

Returns:
True if any element events are mapped from this component.

getComponentEvents

ComponentEventProperty getComponentEvents(String componentId)
Gets component bound event properties.

Parameters:
componentId - The component to get event listeners for.
Returns:
The bound component event property container, or null if none exist.

getElementEvents

ComponentEventProperty getElementEvents(String elementId)
Gets element bound event properties.

Parameters:
elementId - The element to get listeners for.
Returns:
The bound element event property container, or null if none exist.

getFormEvents

EventBoundListener[] getFormEvents(String formId,
                                   BrowserEvent event)
Returns a list of element / component bound event listeners that were specified as invoking the form component with a matching id to formId of type EventBoundListener .

Parameters:
formId - The form that the event listeners were bound to submit when the event occurs.
event - The event that caused the current invocation.
Returns:
A list of events bound to the specified form, empty if none exist.

getElementEvents

Map getElementEvents()
Gets all mapped element events for this component.

Returns:
Mapped elements events, if any.

getComponentEvents

Map getComponentEvents()
Gets all component event mappings.

Returns:
Map of component ComponentEventProperty values this component is listening to.

rewireComponentId

void rewireComponentId(String componentId,
                       String extendedId,
                       String idPath)
Invoked during page load to map event connections previously made via the IComponent.getId() identifier to use the more unique IComponent.getIdPath().

Parameters:
componentId - The base component id.
extendedId - The id of the component as returned by IComponent.getExtendedId()
idPath - The id of the component as returned by IComponent.getIdPath()


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