org.geworkbench.engine.config.events
Interface ListenerRegistry

All Known Implementing Classes:
ListenerRegistryImpl

public interface ListenerRegistry

Registry for application event listeners. It maintains the link between individual application event listeners and the corresponding event types the listeners have registered to listen for.


Method Summary
 void addEventListener(java.lang.Class listenerClass, AppEventListener listener)
          Verifies that listener implements the sub-interface of AppEventListener desribed by the listenerClass.
 java.lang.Class[] getEventsForListener(AppEventListener listener)
          Recovers all sub-interfaces of AppEventListener that are implemented by listener and have also been registered in this registry.
 AppEventListener[] getListenersForEvent(java.lang.Class listenerClass)
           
 void removeListener(AppEventListener listener)
          Removes the specified component from the registry, thus precluding that component from receiving any more events from this registry.
 

Method Detail

addEventListener

void addEventListener(java.lang.Class listenerClass,
                      AppEventListener listener)
                      throws ListenerEventMismatchException,
                             AppEventListenerException
Verifies that listener implements the sub-interface of AppEventListener desribed by the listenerClass. In that event, registers listener as a component that receives events that are handled by the listenerClass interface.

Parameters:
listenerClass - Describes a sub-interface of AppEventListener.
listener - A plugin component.
Throws:
ListenerEventMismatchException - Thrown if listener does not implement the interface described by listenerClass.
AppEventListenerException - Thrown if listenerClass is not a sub-interface of AppEventListener.

getListenersForEvent

AppEventListener[] getListenersForEvent(java.lang.Class listenerClass)
                                        throws AppEventListenerException
Parameters:
listenerClass - Described a sub-interface of AppEventListener.
Returns:
The list of all application listeners that are registered as implementing the interface described by the listenerClass.
Throws:
AppEventListenerException

removeListener

void removeListener(AppEventListener listener)
Removes the specified component from the registry, thus precluding that component from receiving any more events from this registry.

Parameters:
listener - The component to be removed.

getEventsForListener

java.lang.Class[] getEventsForListener(AppEventListener listener)
Recovers all sub-interfaces of AppEventListener that are implemented by listener and have also been registered in this registry.

Parameters:
listener - A plugin component.
Returns:
Array of sub-interfaces of AppEventListener.