org.geworkbench.engine.config.events
Class EventSource

java.lang.Object
  extended by org.geworkbench.engine.config.events.EventSource

public abstract class EventSource
extends java.lang.Object

Base class for all application plugins that throw events. Maintains an event dispatching registry (an implementation of ListenerRegistry) that manages which components should receive which events. In order to receive an event of type XXX from this event source, a component must:


Constructor Summary
EventSource()
           
 
Method Summary
 void addEventListener(java.lang.Class listenerClass, AppEventListener listener)
          Delegates to the same name mathod of coupledListenerRegistry.
 void debugPrint()
          For debugging purposes only.
 java.lang.Class[] getEventsForListener(AppEventListener listener)
          Delegates to the same name mathod of coupledListenerRegistry.
 AppEventListener[] getListenersForEvent(java.lang.Class listenerClass)
          Delegates to the same name mathod of coupledListenerRegistry.
 void removeListener(AppEventListener listener)
          Delegates to the same name method of coupledListenerRegistry.
 void throwEvent(java.lang.Class listenerClass, java.lang.String method, Event event)
          Implementation of application event firing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventSource

public EventSource()
Method Detail

addEventListener

public void addEventListener(java.lang.Class listenerClass,
                             AppEventListener listener)
                      throws ListenerEventMismatchException,
                             AppEventListenerException
Delegates to the same name mathod of coupledListenerRegistry.

Throws:
ListenerEventMismatchException
AppEventListenerException

getListenersForEvent

public AppEventListener[] getListenersForEvent(java.lang.Class listenerClass)
                                        throws AppEventListenerException
Delegates to the same name mathod of coupledListenerRegistry.

Throws:
AppEventListenerException

removeListener

public void removeListener(AppEventListener listener)
Delegates to the same name method of coupledListenerRegistry.


getEventsForListener

public java.lang.Class[] getEventsForListener(AppEventListener listener)
Delegates to the same name mathod of coupledListenerRegistry.


throwEvent

public void throwEvent(java.lang.Class listenerClass,
                       java.lang.String method,
                       Event event)
                throws AppEventListenerException
Implementation of application event firing. The method will throw the event to (1) all listeners of type listenerClass that have registered themselves with this EventSource object, and (2) all listeners that have requested to listening to events of this type in a broadcast mode.

The event is thrown by invoking the method on the corresponding listener and passsing event as an argument.

Parameters:
listenerClass - The Class of the listener. This class is expected to be implementing AppEventListener.
method -
event -
Throws:
AppEventListenerException

debugPrint

public void debugPrint()
For debugging purposes only.