All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class openstar.util.EventSupport

java.lang.Object
   |
   +----openstar.util.EventSupport

public class EventSupport
extends Object
This is a utility class (similar, for example, to java.beans.PropertyChangeSupport) that can be used to delegate the event-related work.

You can either inherit from this class (as long as you fire only one type of event) or you can use one or more instances of this class as members of your event-generating class.

Version:
11 Jun 1997
Author:
Nils Schwabe

Variable Index

 o listeners
The list of registered listeners for the event.

Constructor Index

 o EventSupport()

Method Index

 o addEventListener(EventListener)
Adds a listener to the event listener list.
 o fireEvent(Event, EventDelivery)
Fires the specified event.
 o getListeners()
Returns a copy of the list of listeners.
 o removeEventListener(EventListener)
Removes the (first matching) listener from the event listener list.

Variables

 o listeners
  protected TypedList listeners
The list of registered listeners for the event.

All listeners are required to be derived from java.util.EventListener.

Constructors

 o EventSupport
  public EventSupport()

Methods

 o addEventListener
  public void addEventListener(EventListener listener)
Adds a listener to the event listener list.

No checks for multiple occurences are made.

 o removeEventListener
  public void removeEventListener(EventListener listener)
Removes the (first matching) listener from the event listener list.

No checks for multiple occurences are made.

 o fireEvent
  public void fireEvent(Event event,
                        EventDelivery delivery)
Fires the specified event.

The event is delivered using the given EventDelivery object which is responsible to cast the generic Event to the appropriate derived type and to call the appropriate method of the EventListener.

The event is delivered to the set of listeners that are registered at the moment. Changes to the list of listeners that occur indirectly from the event processing methods do not effect the set of listeners that get the event.

 o getListeners
  public TypedList getListeners()
Returns a copy of the list of listeners. All objects in this list can be safely casted to java.util.EventListener.


All Packages  Class Hierarchy  This Package  Previous  Next  Index