Package de.sciss.app

Class 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...

    • 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