borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.util 

EventMulticaster class

java.lang.Object
   +----borland.jbcl.util.EventMulticaster

About the EventMulticaster class

Properties  Methods  

EventMulticaster is a multicaster for all user-defined events. All JBCL 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.

See also: Standard Java events, Events in JBCL


EventMulticaster properties

*Read-only properties **Write-only properties

Properties implemented in java.lang.Object

EventMulticaster methods

Methods implemented in this class

Methods implemented in java.lang.Object


EventMulticaster methods

add(borland.jbcl.util.EventMulticaster, java.util.EventListener)

  public static final EventMulticaster add(borland.jbcl.util.EventMulticaster caster, java.util.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(java.util.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(borland.jbcl.util.DispatchableEvent)

  public final void dispatch(borland.jbcl.util.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(borland.jbcl.util.ExceptionDispatch)

  public final void exceptionDispatch(borland.jbcl.util.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(java.util.EventListener listener)
Searches for the specified listener among the array of listening objects.

Parameters:

listener
The object you are searching 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(borland.jbcl.util.EventMulticaster, java.util.EventListener)

  public static final EventMulticaster remove(borland.jbcl.util.EventMulticaster caster, java.util.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(java.util.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(borland.jbcl.util.VetoableDispatch)

  public final boolean vetoableDispatch(borland.jbcl.util.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.