borland Packages  Class Hierarchy  jb.util Package 

EventMulticaster class

java.lang.Object
   +----com.borland.jb.util.EventMulticaster

About the EventMulticaster class

Variables  Properties  Methods  

EventMulticaster is a multicaster for all user-defined events. All events, such as model and selection events, use EventMulticaster, which sends an event to all listeners. EventMulticaster maintains an array of listeners. The add(), remove(), and find() methods maintain this list.

The hasListeners() method determines whether any objects are listening for events. EventMulticaster has a dispatch() method and two specialized dispatch methods: exceptionDispatch(), which is used for events that can throw exceptions, and vetoableDispatch(), which is used for events that can decline an event.


EventMulticaster variables

Variables implemented in this class

EventMulticaster properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

EventMulticaster methods

Methods implemented in this class

Methods implemented in java.lang.Object


EventMulticaster variables

listeners

  protected transient EventListener[]listeners

The array of action listeners.


EventMulticaster properties

listenerCount

 public int getListenerCount()
Returns the number of event listeners in the array of listeners.

EventMulticaster methods

add(com.borland.jb.util.EventMulticaster, java.util.EventListener)

  public static final EventMulticaster add(EventMulticaster caster, EventListener listener)
Adds an object to the array of listeners. It is used for efficiency to avoid allocating an EventMulticaster until there are listeners. The allocated EventMulticaster can be tested for null to see if there are any listeners, thereby improving efficiency again.

Parameters:

caster
The multicaster that is allocated.
listener
The object that is added to the list of listeners for events.

add(java.util.EventListener)

  public final synchronized void add(EventListener listener)
Adds an object to the array of listeners.

Parameters:

listener
The object that is added to the list of listeners for events.

dispatch(com.borland.jb.util.DispatchableEvent)

  public final void dispatch(DispatchableEvent e)
Sends a DispatchableEvent to all listeners. This method is a high-speed dispatcher that does not need to be synchronized.

Parameters:

e
The dispatchable event sent to all listeners.

exceptionDispatch(com.borland.jb.util.ExceptionDispatch)

  public final void exceptionDispatch(ExceptionDispatch e)
Sends an ExceptionDispatch event to all listeners. It is used for all events that can throw exceptions. This method is a high-speed dispatcher that does not need to be synchronized.

Parameters:

e
The exception event sent to all listeners.

find(java.util.EventListener)

  public int find(EventListener listener)
Searches for the specified listener among the array of listening objects.

Parameters:

listener
The object being searched for in the list of listeners.

hasListeners()

  public final boolean hasListeners()
Determines if there are any listeners for events. If the method returns true, one or more event listeners are present.

remove(com.borland.jb.util.EventMulticaster, java.util.EventListener)

  public static final EventMulticaster remove(EventMulticaster caster, EventListener listener)
Removes the specified listening object from the array of event listeners. This remove() method is the counterpart of the the add() method that allocates an event multicaster and improves efficiency.

Parameters:

caster
The event multicaster object.
listener
The listening object that is removed from the array of event listeners.

remove(java.util.EventListener)

  public final synchronized void remove(EventListener listener)
Removes the specified listening object from the array of event listeners.

Parameters:

listener
The listening object that is removed from the array of event listeners.

vetoableDispatch(com.borland.jb.util.VetoableDispatch)

  public final boolean vetoableDispatch(VetoableDispatch e)
Sends a VetoableDispatch event to all listeners. It is used for all events that can throw VetoException and therefore decline the event. This method is a high-speed dispatcher that does not need to be synchronized.

vetoableDispatch() returns false if an event listener throws a VetoException. A return value of true indicates the listener accepted the event.

Parameters:

e
The VetoableDispatch event sent to all listeners.