|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwt.events.StandardKeyedEventDispatcher
public class StandardKeyedEventDispatcher
Reference implementation of a KeyedEventDispatcher. This class implements a synchronous "in thread/transaction" dispatch of event notifications. There are two forms of dispatch, vetoable and non-vetoable. Vetoable event dispatches provide the ability for listeners to object to the consequence of an event by throwing an exception of a type prescribed by the event generator.
Events are dispatched synchronously in the thread of the event generator. Consequently, listeners are expected to respond to the event quickly. All side effects of the listeners actions will be in the same thread and transaction of the event generator and so the listener must be desiged to "play nice".
Veto listeners are notified of vetoable events when their notifyVetoableEvent method is invoked. Veto listeners may object to the event by throwing an exception of a type prescribed by the event generator. Note that since the events package is a general purpose package it cannot enforce type safe exceptions. It is up to the developer to make sure that an exception of the correct type is thrown.
Supported API: true
Extendable: false
KeyedEvent,
KeyedEventDispatcher| Method Summary | |
|---|---|
KeyedEventBranch |
addEventBranch(String eventKey,
String eventClassName,
String eventType)
Create and register an event key branch. |
void |
dispatchEvent(Object event,
String eventKey)
Dispatch a non-vetoable single-object event to all listeners for the event key. |
void |
dispatchMultiObjectEvent(Object event,
String eventKey)
Dispatch a non-vetoable multi-object event to all listeners for the event key. |
void |
dispatchVetoableEvent(Object event,
String eventKey)
Dispatch a vetoable single-object event to all listeners for the event key. |
void |
dispatchVetoableMultiObjectEvent(Object event,
String eventKey)
Dispatch a vetoable multi-object event to all listeners for the event key. |
Enumeration |
getAllEventBranches()
Return all event branches Supported API: true |
KeyedEventBranch |
getEventBranch(String eventKey)
Return the event key branch which exactly matches the event key. |
KeyedEventBranch |
removeEventBranch(String eventKey)
Locate and remove the event key branch which exactly matches the event key. |
void |
removeEventListener(KeyedEventListener listener,
String eventKey)
Remove an event listener. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public KeyedEventBranch addEventBranch(String eventKey,
String eventClassName,
String eventType)
throws IllegalArgumentException
addEventBranch in interface KeyedEventDispatchereventKey - eventClassName - eventType -
IllegalArgumentExceptionpublic KeyedEventBranch getEventBranch(String eventKey)
getEventBranch in interface KeyedEventDispatchereventKey -
public KeyedEventBranch removeEventBranch(String eventKey)
removeEventBranch in interface KeyedEventDispatchereventKey -
public Enumeration getAllEventBranches()
getAllEventBranches in interface KeyedEventDispatcher
public void removeEventListener(KeyedEventListener listener,
String eventKey)
removeEventListener in interface KeyedEventDispatcherlistener - the listener to be removedeventKey - the key which identifies the branch from wihch to remove
public void dispatchEvent(Object event,
String eventKey)
Perform a synchronous "in thread/transaction" notification of each
event listener for the event branch identified by the event key.
Call the notifyEvent operation on each subscriber. If a multi-object
notifyMultiObjectEvent exists for a subscriber, convert the single-object
event to an multi-object event and call the multi-object subscriber's
notifyMultiObjectEvent.
Supported API: true
dispatchEvent in interface KeyedEventDispatcherevent - the event to be dispatchedeventKey - the key of the event branch which has the subscribers
public void dispatchVetoableEvent(Object event,
String eventKey)
throws WTException
Perform a synchronous "in thread/transaction" notification of each
event listener for the event branch identified by the event key.
Call the notifyVetoableEvent operation on each subscriber. If a multi-object
notifyVetoableMultiObjectEvent exists for a subscriber, convert the
single-object event to an multi-object event and call the multi-object
subscriber's notifyVetoableMultiObjectEvent. If the subscriber objects
to the event is may throw an excpetion which will be returned to the
operation invoker. It is upto the dispatch invoker and the exception
thrower to agree on what exception is to be thrown.
Supported API: true
dispatchVetoableEvent in interface KeyedEventDispatcherevent - eventKey -
WTException
public void dispatchMultiObjectEvent(Object event,
String eventKey)
Perform a synchronous "in thread/transaction" notification of each
event listener for the event branch identified by the event key.
Call the notifyMultiObjectEvent operation on each subscriber. If
a single-object notifyEvent exists for a subscriber, convert the multi-object
event to an array of single-object events and loop over the single-object
subscriber's notifyEvent.
Supported API: true
dispatchMultiObjectEvent in interface KeyedEventDispatcherevent - the event to be dispatchedeventKey - the key of the event branch which has the subscribers
public void dispatchVetoableMultiObjectEvent(Object event,
String eventKey)
throws WTException
Perform a synchronous "in thread/transaction" notification of each
event listener for the event branch identified by the event key.
Call the notifyVetoableMultiObjectEvent operation on each subscriber.
If a single-object notifyVetoabelEvent exists for a subscriber, convert
the multi-object event to an array of single-object events and loop
over the single-object subscriber's notifyVetoableEvent. If the subscriber
objects to the event is may throw an excpetion which will be returned
to the operation invoker. It is upto the dispatch invoker and the
exception thrower to agree on what exception is to be thrown.
Supported API: true
dispatchVetoableMultiObjectEvent in interface KeyedEventDispatcherevent - eventKey -
WTException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||