de.sciss.app
Class LaterInvocationManager
java.lang.Object
de.sciss.app.EventManager
de.sciss.app.LaterInvocationManager
- All Implemented Interfaces:
- EventManager.Processor, java.lang.Runnable
public class LaterInvocationManager
- extends EventManager
- implements EventManager.Processor
The LaterInvocationManager is a utility
bastard synthesized from an EventManager
and a Runnable. It's useful for queueing activities
from outside the Swing event thread to be processed later
in the event thread.
Note that in test scenarios on apple's VM, PreferenceChangeEvents
were dispatched in a thread different from the normal Swing event
thread. Due to this fact a lot of synchronization issues arise,
so we decided to pass more or less all preference changes to a
LaterInvocationManager.Listener instance...
- Version:
- 0.13, 05-May-06
- Author:
- Hanns Holger Rutz
- Todo:
- conduct further research on the preference dispatching thread
and the necessity to invoke processing on the swing thread
Nested Class Summary |
static interface |
LaterInvocationManager.Listener
A simple interface describing
the method that gets called from
the event dispatching thread when
new objects have been queued. |
Method Summary |
void |
processEvent(BasicEvent e)
This is called by the EventManager
which is in fact ourself ;-)
if new events are to be processed. |
void |
queue(java.lang.Object o)
Queues an object for later processing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LaterInvocationManager
public LaterInvocationManager(LaterInvocationManager.Listener listener)
- Constructs a new
LaterInvocationManager
with one particular listener. Note that it's possible
to add more listeners through the standard mechanism
of EventManager
, however situations
are rare where this would be useful.
- Parameters:
listener
- This listener's laterInvocation method
gets called, when new objects have been
queued and the VM arrives at the event
dispatching thread.
queue
public void queue(java.lang.Object o)
- Queues an object for later processing. The listener's
laterInvocation method will be called later in the
event dispatcher thread
- Parameters:
o
- the object to pass to the laterInvocation method.
beware not to pass a null value which will
result in an IllegalArgumentException.
processEvent
public void processEvent(BasicEvent e)
- This is called by the EventManager
which is in fact ourself ;-)
if new events are to be processed. This
will invoke the listener's
laterInvocation
method.
- Specified by:
processEvent
in interface EventManager.Processor