org.apache.tapestry.services.impl
Class ComponentEventInvoker

java.lang.Object
  extended by org.apache.tapestry.services.impl.ComponentEventInvoker
All Implemented Interfaces:
EventListener, ResetEventListener

public class ComponentEventInvoker
extends Object
implements ResetEventListener

Managed and handles invoking listener methods for components in response to requested event listener invocations.

Author:
jkuhnert

Constructor Summary
ComponentEventInvoker()
           
 
Method Summary
 void addElementEventListener(String elementId, String[] events, String methodName, String formId, boolean validateForm, boolean async)
          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)
          Adds a deferred event listener binding for the specified component.
 ComponentEventProperty getComponentEvents(String id)
          Gets event properties fro the specified component, creates a new instance if one doesn't exist already.
 Map getElementEvents()
          Returns the Map being managed for element events.
 ComponentEventProperty getElementEvents(String id)
          Gets event properties for the specified component, creates a new instance if one doesn't exist already.
 boolean hasElementEvents()
           
 boolean hasElementEvents(String id)
           
 boolean hasEvents(String componentId)
          Returns whether or not the specified component has any connected events.
 void invokeFormListeners(FormSupport formSupport, IRequestCycle cycle, BrowserEvent event)
          Causes the configured listeners for the passed FormSupport's {@link IForm) to be invoked, if mapped to this request/event.
 void invokeListeners(IComponent component, IRequestCycle cycle, BrowserEvent event)
          Causes the configured listeners for the passed component to be invoked.
 void resetEventDidOccur()
           
 void setListenerInvoker(ListenerInvoker invoker)
          Injected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentEventInvoker

public ComponentEventInvoker()
Method Detail

invokeListeners

public void invokeListeners(IComponent component,
                            IRequestCycle cycle,
                            BrowserEvent event)
Causes the configured listeners for the passed component to be invoked.

Parameters:
component - The component that recieved the invocations.
cycle - The associated request.
event - The event that started it all.

invokeFormListeners

public void invokeFormListeners(FormSupport formSupport,
                                IRequestCycle cycle,
                                BrowserEvent event)
Causes the configured listeners for the passed FormSupport's {@link IForm) to be invoked, if mapped to this request/event.

Parameters:
formSupport - The form support object being rendered.
cycle - The associated request.
event - The event that started it all.

addEventListener

public void addEventListener(String componentId,
                             String[] events,
                             String methodName,
                             String formId,
                             boolean validateForm,
                             boolean async)
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.
async - If submitting a form, whether or not to do it asynchronously.

addElementEventListener

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

Parameters:
elementId -
events -
methodName -
async - If submitting a form, whether or not to do it asynchronously.

hasEvents

public boolean hasEvents(String componentId)
Returns whether or not the specified component has any connected events.

Parameters:
componentId - The unique component id to check.
Returns:
True, if at least one listener is connected to the specified component.

hasElementEvents

public boolean hasElementEvents()
Returns:
True, if any html element events exist.

hasElementEvents

public boolean hasElementEvents(String id)
Returns:
True, if the html element has events.

getComponentEvents

public ComponentEventProperty getComponentEvents(String id)
Gets event properties fro the specified component, creates a new instance if one doesn't exist already.

Parameters:
id - The component id
Returns:
A new/existing instance.

getElementEvents

public ComponentEventProperty getElementEvents(String id)
Gets event properties for the specified component, creates a new instance if one doesn't exist already.

Parameters:
id - The component id
Returns:
A new/existing instance.

getElementEvents

public Map getElementEvents()
Returns the Map being managed for element events.

Returns:

resetEventDidOccur

public void resetEventDidOccur()
Specified by:
resetEventDidOccur in interface ResetEventListener

setListenerInvoker

public void setListenerInvoker(ListenerInvoker invoker)
Injected.

Parameters:
invoker -


Copyright © 2006 Apache Software Foundation. All Rights Reserved.