|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Source of real-time events that are to be passed to
RTEventListener
objects that have subscribed on such
events. In the simplest case, the listener register itself to
receive all ordinary (not EceptionEvent
s or
ActivityEvent
s), by calling addListener
with the lister itself as a the subscriber argument. With a
RTEventSource
called producer the call will be
producer.addListener(this);This should be equivalent to
producer.getDispatcher().addListener(this);if the other method defined by this interface,
getDispatcher
, returns a non-null object.
The dispatcher object provides additionally functionality that could have been part of this interface. The reason for this simple two-method interface, instead of declaring all event subscription methods, is to simplify the implementation of event sources. That is, an event source can simply reuse an available dispatcher and add a two-line getter method returning it.
For simple statically defined one-to-one communication (one producer to one consumer), the listener (consumer) is typically created first (avoiding timing dependent problems during startup) and then given to the constructor of the event source (producer). Using an event dispatcher is good for more flexible situations with run-time changes or one-to-many communication.
RTEventListener
,
RTEventDispatcher
Method Summary | |
void |
addListener(RTEventListener subscriber)
Subscribe on RTEvents from this source. |
RTEventDispatcher |
getDispatcher()
Obtain object used for event subscription. |
Method Detail |
public void addListener(RTEventListener subscriber)
subscriber
- the object interested in getting the events
via its putEvent
method.public RTEventDispatcher getDispatcher()
putEvent
of the subscribing object.
RTEvent
listeners. The returned dispatcher corresponds to the
javax.swing.event.EventListenerList
, but enhanced
for real-time usage.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |