com.glaivestone.javax.util
Class EventManager

java.lang.Object
  |
  +--com.glaivestone.javax.util.EventManager
Direct Known Subclasses:
ApplicationModel, SessionManager

public class EventManager
extends java.lang.Object

An EventManager manages event listener lists for one or more types of events.

Intended for use as the superclass for implementations of event source objects which trigger one or more events. Subclasses are responsible for implementing event firing logic to trigger their supported events. Subclasses should also implement type-specific listener registration add and remove operations for specific event types which conform to the conventional pattern of addFooListener(FooListener) and removeFooListener(FooListener) for an event type Foo.

The event type with which a listener list is associated is ordinarily the Class of the event listener interface type.

Origins

This class was inspired by mechanisms in the Visual Smalltalk event system.

Author:
Deb Lewis
See Also:
EventListenerList

Constructor Summary
EventManager()
          Construct a new EventManager.
 
Method Summary
 void addFirstListener(java.util.EventListener aListener, java.lang.Object eventType)
          Add an event listener to the start of the list of listeners registered for the specified event.
 void addListener(java.util.EventListener aListener, java.lang.Object eventType)
          Add an event listener to the end of the list of listeners registered for the specified event.
 java.util.Map getEventTable()
          Answer the event table which maps listener types to their listener lists.
 java.util.Map getEventTableForEdit()
          Answer the event table which maps listener types to their listener lists.
 java.util.EventListener[] getListeners(java.lang.Object eventType)
          Answer the listeners for the specified type of event.
 void removeListener(java.util.EventListener aListener, java.lang.Object eventType)
          Remove an event listener from the list of listeners registered for the specified event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventManager

public EventManager()
Construct a new EventManager.

Method Detail

addFirstListener

public void addFirstListener(java.util.EventListener aListener,
                             java.lang.Object eventType)
Add an event listener to the start of the list of listeners registered for the specified event.

Parameters:
aListener - the listener to be added
eventType - the event type (usually an EventListener interface type)

addListener

public void addListener(java.util.EventListener aListener,
                        java.lang.Object eventType)
Add an event listener to the end of the list of listeners registered for the specified event.

Parameters:
aListener - the listener to be added
eventType - the event type (usually an EventListener interface type)

getEventTable

public java.util.Map getEventTable()
Answer the event table which maps listener types to their listener lists. Allocate the table if it does not already exist.

This service is intended for use by subclasses. It should not ordinarily be used by external clients.


getEventTableForEdit

public java.util.Map getEventTableForEdit()
Answer the event table which maps listener types to their listener lists. Allocate the table if it does not already exist.

This service is intended for use by subclasses. It should not ordinarily be used by external clients.


getListeners

public java.util.EventListener[] getListeners(java.lang.Object eventType)
Answer the listeners for the specified type of event. Returns an empty array if no listeners have registered for this event.

Parameters:
eventType - the event type (usually an EventListener interface type)

removeListener

public void removeListener(java.util.EventListener aListener,
                           java.lang.Object eventType)
Remove an event listener from the list of listeners registered for the specified event.

Parameters:
aListener - the listener to be added
eventType - the event type (usually an EventListener interface type)

GFL 1.1 API