Class GuiActionRunner

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

@ThreadSafe public class GuiActionRunner extends Object
Understands running instances of GuiQuery and GuiTask.
  • Field Details

    • executeInEDT

      private static boolean executeInEDT
  • Constructor Details

    • GuiActionRunner

      public GuiActionRunner()
  • Method Details

    • 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:
    • executeInCurrentThread

      private static <T> T executeInCurrentThread(GuiQuery<T> query)
    • 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:
    • executeInCurrentThread

      private static void executeInCurrentThread(GuiTask task)
    • run

      private static void run(GuiAction action)
    • resultOf

      private static <T> T resultOf(GuiQuery<T> query)
    • rethrowCatchedExceptionIn

      private static void rethrowCatchedExceptionIn(GuiAction action)
      Wraps (with a UnexpectedException) and retrows any catched exception in the given action.
      Parameters:
      action - the given action that may have a catched exception during its execution.
      Throws:
      UnexpectedException - wrapping any checked exception thrown when executing the given query in the event dispatch thread. Unchecked exceptions are rethrown without any wrapping.