de.sciss.app
Class LaterInvocationManager

java.lang.Object
  extended by de.sciss.app.EventManager
      extended by 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.
 
Nested classes/interfaces inherited from class de.sciss.app.EventManager
EventManager.Processor
 
Field Summary
 
Fields inherited from class de.sciss.app.EventManager
DEBUG_EVENTS, eventProcessor
 
Constructor Summary
LaterInvocationManager(LaterInvocationManager.Listener listener)
          Constructs a new LaterInvocationManager with one particular listener.
 
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 de.sciss.app.EventManager
addListener, countListeners, debugDump, dispatchEvent, dispose, getListener, pause, removeListener, resume, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

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