artofillusion.ui
Class ActionProcessor

java.lang.Object
  extended by artofillusion.ui.ActionProcessor

public class ActionProcessor
extends java.lang.Object

This class processes "discardable" events. This is typically used for mouse-moved or mouse-dragged events, where significant time is needed to process each event, and they might be delivered faster than they can be processed.

Callback objects corresponding to particular events are passed to addEvent() as they occur. They are called one at a time. If several new events are delivered before the last one has been finished, all but the most recent one are discarded.

This class is not thread safe. addEvent() and stopProcessing() should only ever be invoked from the event dispatch thread. In turn, all processing of events is guaranteed to be done on the event dispatch thread.


Constructor Summary
ActionProcessor()
           
 
Method Summary
 void addEvent(java.lang.Runnable event)
          Add an event to the queue.
 boolean hasBeenStopped()
          Determine whether this stopProcessing() has been invoked.
 boolean hasEvent()
          Determine whether there is an event waiting to be processed.
 void stopProcessing()
          Halt processing, and discard any further events that are added to the queue.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionProcessor

public ActionProcessor()
Method Detail

addEvent

public void addEvent(java.lang.Runnable event)
Add an event to the queue.


stopProcessing

public void stopProcessing()
Halt processing, and discard any further events that are added to the queue.


hasBeenStopped

public boolean hasBeenStopped()
Determine whether this stopProcessing() has been invoked.


hasEvent

public boolean hasEvent()
Determine whether there is an event waiting to be processed.



Copyright © 1999-2011 by Peter Eastman.