org.fest.swing.edt
Class GuiActionRunner

java.lang.Object
  extended by org.fest.swing.edt.GuiActionRunner

@ThreadSafe
public class GuiActionRunner
extends Object

Understands running instances of GuiQuery and GuiTask.

Author:
Alex Ruiz

Constructor Summary
GuiActionRunner()
           
 
Method Summary
static
<T> T
execute(GuiQuery<T> query)
          Executes the given query in the event dispatch thread.
static void execute(GuiTask task)
          Executes the given task in the event dispatch thread.
static boolean executeInEDT()
          Returns whether instances of GuiQuery and GuiTask should be executed in the event dispatch thread or not.
static void executeInEDT(boolean b)
          Indicates GuiActionRunner if instances of GuiQuery and GuiTask should be executed in the event dispatch thread or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuiActionRunner

public GuiActionRunner()
Method Detail

executeInEDT

public static void executeInEDT(boolean b)
Indicates GuiActionRunner if instances of GuiQuery and GuiTask should be executed in the event dispatch thread or not.

Parameters:
b - if true, GUI actions are executed in the event dispatch thread. If false, GUI actions are executed in the current thread.

executeInEDT

public static boolean executeInEDT()
Returns whether instances of GuiQuery and GuiTask should be executed in the event dispatch thread or not.

Returns:
true if GUI actions are executed in the event dispatch thread, false otherwise.

execute

public static <T> T execute(GuiQuery<T> query)
Executes the given query in the event dispatch thread. This method waits until the query has finished its execution.

Type Parameters:
T - the generic type of the return value.
Parameters:
query - the query to execute.
Returns:
the result of the query executed in the main thread.
Throws:
UnexpectedException - wrapping any checked exception thrown when executing the given query in the event dispatch thread. Unchecked exceptions are re-thrown without any wrapping.
See Also:
executeInEDT()

execute

public static void execute(GuiTask task)
Executes the given task in the event dispatch thread. This method waits until the task has finished its execution.

Parameters:
task - the task to execute.
Throws:
UnexpectedException - wrapping any checked exception thrown when executing the given query in the event dispatch thread. Unchecked exceptions are re-thrown without any wrapping.
See Also:
executeInEDT()


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.