com.sdm.quasar.client.core.common.event
Class DefaultEventDispatchThreadService

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.event.DefaultEventDispatchThreadService
All Implemented Interfaces:
EventDispatchThreadService, Service

public class DefaultEventDispatchThreadService
extends java.lang.Object
implements EventDispatchThreadService

Version:
1.$Revision$
Author:
Thomas Wolf

Constructor Summary
DefaultEventDispatchThreadService()
          Creates a new DefaultEventDispatchThreadService.
 
Method Summary
 boolean isEventDispatchThread()
          Returns true if the current thread is an AWT event dispatching thread.
 java.lang.Object runInEventDispatchThread(ExceptionRunnable runnable)
          Runs the given ExceptionRunnable in the event dispatch thread.
 void runInEventDispatchThread(java.lang.Runnable runnable)
          Runs the given Runnable in the event dispatch thread.
 void runLaterInEventDispatchThread(java.lang.Runnable runnable)
          Causes runnable to have its run() method called in the event dispatch thread.
 void runLaterNotInEventDispatchThread(java.lang.Runnable runnable)
          Causes runnable to have its run() method called outside the event dispatch thread.
 java.lang.Object runNotInEventDispatchThread(ExceptionRunnable runnable)
          Runs the given ExceptionRunnable not in the event dispatch thread.
 void runNotInEventDispatchThread(java.lang.Runnable runnable)
          Runs the given Runnable not in the event dispatch thread.
 void runOrRunLaterInEventDispatchThread(java.lang.Runnable runnable)
          Causes runnable to have its run() method called in the dispatch thread of the EventQueue.
 void waitForCondition(Condition condition)
          Waits for the condition given without blocking event processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventDispatchThreadService

public DefaultEventDispatchThreadService()
Creates a new DefaultEventDispatchThreadService.

Method Detail

runOrRunLaterInEventDispatchThread

public void runOrRunLaterInEventDispatchThread(java.lang.Runnable runnable)
Description copied from interface: EventDispatchThreadService
Causes runnable to have its run() method called in the dispatch thread of the EventQueue. This will happen eighter immediately on method execution (if called from the event dispatch thread) or after all pending events are processed (if called from another thread).

Note: This method may or may not return before the runnable gets executed within the EDT. In opposite to EventDispatchThreadService.runLaterInEventDispatchThread(Runnable) it calls the runnable faster (immediately), if called within the EDT.

Specified by:
runOrRunLaterInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the Runnable whose run() method should be executed synchronously on the EventQueue
See Also:
EventDispatchThreadService.runOrRunLaterInEventDispatchThread(java.lang.Runnable)

runLaterInEventDispatchThread

public void runLaterInEventDispatchThread(java.lang.Runnable runnable)
Description copied from interface: EventDispatchThreadService
Causes runnable to have its run() method called in the event dispatch thread. This will happen after all pending events are processed.

Specified by:
runLaterInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the Runnable whose run() method should be executed
See Also:
EventDispatchThreadService.runLaterInEventDispatchThread(java.lang.Runnable)

runLaterNotInEventDispatchThread

public void runLaterNotInEventDispatchThread(java.lang.Runnable runnable)
Description copied from interface: EventDispatchThreadService
Causes runnable to have its run() method called outside the event dispatch thread.

Specified by:
runLaterNotInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the Runnable whose run() method should be executed
See Also:
EventDispatchThreadService.runLaterNotInEventDispatchThread(java.lang.Runnable)

isEventDispatchThread

public boolean isEventDispatchThread()
Description copied from interface: EventDispatchThreadService
Returns true if the current thread is an AWT event dispatching thread.

Specified by:
isEventDispatchThread in interface EventDispatchThreadService
See Also:
EventDispatchThreadService.isEventDispatchThread()

runInEventDispatchThread

public java.lang.Object runInEventDispatchThread(ExceptionRunnable runnable)
                                          throws java.lang.Exception
Description copied from interface: EventDispatchThreadService
Runs the given ExceptionRunnable in the event dispatch thread.

Specified by:
runInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the ExceptionRunnable to run
Returns:
the return value returned by ExceptionRunnable.run()
Throws:
java.lang.Exception - any exception thrown by the ExceptionRunnable
See Also:
EventDispatchThreadService.runInEventDispatchThread(com.sdm.quasar.client.core.common.event.ExceptionRunnable)

runInEventDispatchThread

public void runInEventDispatchThread(java.lang.Runnable runnable)
Description copied from interface: EventDispatchThreadService
Runs the given Runnable in the event dispatch thread.

Specified by:
runInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the Runnable to run
See Also:
EventDispatchThreadService.runInEventDispatchThread(java.lang.Runnable)

runNotInEventDispatchThread

public java.lang.Object runNotInEventDispatchThread(ExceptionRunnable runnable)
                                             throws java.lang.Exception
Description copied from interface: EventDispatchThreadService
Runs the given ExceptionRunnable not in the event dispatch thread.

Specified by:
runNotInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the ExceptionRunnable to run
Returns:
the return value returned by ExceptionRunnable.run()
Throws:
java.lang.Exception - any exception thrown by the ExceptionRunnable
See Also:
EventDispatchThreadService.runNotInEventDispatchThread(com.sdm.quasar.client.core.common.event.ExceptionRunnable)

runNotInEventDispatchThread

public void runNotInEventDispatchThread(java.lang.Runnable runnable)
Description copied from interface: EventDispatchThreadService
Runs the given Runnable not in the event dispatch thread.

Specified by:
runNotInEventDispatchThread in interface EventDispatchThreadService
Parameters:
runnable - the Runnable to run
See Also:
EventDispatchThreadService.runNotInEventDispatchThread(java.lang.Runnable)

waitForCondition

public void waitForCondition(Condition condition)
                      throws java.lang.InterruptedException
Description copied from interface: EventDispatchThreadService
Waits for the condition given without blocking event processing.

Note: Implementation might wait on the object given.

Specified by:
waitForCondition in interface EventDispatchThreadService
Parameters:
condition - the Condition to wait for (until Condition.isFulfilled() returns true)
Throws:
java.lang.InterruptedException - if waiting was interrupted
See Also:
EventDispatchThreadService.waitForCondition(com.sdm.quasar.client.core.common.event.Condition)