UIThreadManager (Griffon 0.9.5-rc2)
Date: 2012-03-09

Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## griffon.core
[Java] Class UIThreadManager

    java.lang.Object
      griffon.core.UIThreadManager

    public final class UIThreadManager
    extends Object

Helper class that can execute code inside the UI thread.

Authors:
  Andres Almiray

Nested Class Summary
`private static class` | `UIThreadManager.ScriptOrRunnableRunner`

Field Summary
`private static ExecutorService` | `DEFAULT_EXECUTOR_SERVICE`
`private static String` | `EXECUTE_FUTURE`
`private static CallableWithArgsClosure` | `EXECUTE_FUTURE_RUNNER`
`private static String` | `EXECUTE_INSIDE_UI_ASYNC`
`private static RunnableWithArgsClosure` | `EXECUTE_INSIDE_UI_ASYNC_RUNNER`
`private static String` | `EXECUTE_INSIDE_UI_SYNC`
`private static RunnableWithArgsClosure` | `EXECUTE_INSIDE_UI_SYNC_RUNNER`
`private static String` | `EXECUTE_OUTSIDE_UI`
`private static RunnableWithArgsClosure` | `EXECUTE_OUTSIDE_UI_RUNNER`
`private static UIThreadManager` | `INSTANCE`
`private static String` | `IS_UITHREAD`
`private static CallableWithArgsClosure` | `IS_UITHREAD_RUNNER`
`private static org.slf4j.Logger` | `LOG`
`private UIThreadHandler` | `uiThreadHandler`

Constructor Summary
`private UIThreadManager()`

Method Summary
`static void` | `enhance(Script script)`
`static void` | `enhance(MetaClass metaClass)`
`void` | `executeAsync(Runnable runnable)` Executes a code block asynchronously on the UI thread.
`void` | `executeAsync(Script script)` Executes a code block asynchronously on the UI thread.
`Future` | `executeFuture(Callable callable)` Executes a code block as a Future on an ExecutorService.
`Future` | `executeFuture(ExecutorService executorService, Callable callable)` Executes a code block as a Future on an ExecutorService.
`void` | `executeOutside(Runnable runnable)` Executes a code block outside of the UI thread.
`void` | `executeOutside(Script script)` Executes a code block outside of the UI thread.
`void` | `executeSync(Runnable runnable)` Executes a code block synchronously on the UI thread.
`void` | `executeSync(Script script)` Executes a code block synchronously on the UI thread.
`static UIThreadManager` | `getInstance()`
`UIThreadHandler` | `getUIThreadHandler()`
`boolean` | `isUIThread()` True if the current thread is the UI thread.
`void` | `setUIThreadHandler(UIThreadHandler threadHandler)`

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Field Detail

### DEFAULT_EXECUTOR_SERVICE

    private static final ExecutorService DEFAULT_EXECUTOR_SERVICE

### EXECUTE_FUTURE

    private static final String EXECUTE_FUTURE

### EXECUTE_FUTURE_RUNNER

    private static final CallableWithArgsClosure EXECUTE_FUTURE_RUNNER

### EXECUTE_INSIDE_UI_ASYNC

    private static final String EXECUTE_INSIDE_UI_ASYNC

### EXECUTE_INSIDE_UI_ASYNC_RUNNER

    private static final RunnableWithArgsClosure EXECUTE_INSIDE_UI_ASYNC_RUNNER

### EXECUTE_INSIDE_UI_SYNC

    private static final String EXECUTE_INSIDE_UI_SYNC

### EXECUTE_INSIDE_UI_SYNC_RUNNER

    private static final RunnableWithArgsClosure EXECUTE_INSIDE_UI_SYNC_RUNNER

### EXECUTE_OUTSIDE_UI

    private static final String EXECUTE_OUTSIDE_UI

### EXECUTE_OUTSIDE_UI_RUNNER

    private static final RunnableWithArgsClosure EXECUTE_OUTSIDE_UI_RUNNER

### INSTANCE

    private static final UIThreadManager INSTANCE

### IS_UITHREAD

    private static final String IS_UITHREAD

### IS_UITHREAD_RUNNER

    private static final CallableWithArgsClosure IS_UITHREAD_RUNNER

### LOG

    private static final org.slf4j.Logger LOG

### uiThreadHandler

    private UIThreadHandler uiThreadHandler

Constructor Detail

### UIThreadManager

    private UIThreadManager()

Method Detail

### enhance

    public static void enhance(Script script)

### enhance

    public static void enhance(MetaClass metaClass)

### executeAsync

    public void executeAsync(Runnable runnable)

  Executes a code block asynchronously on the UI thread.
  Parameters:
    `runnable` - a code block to be executed

### executeAsync

    public void executeAsync(Script script)

  Executes a code block asynchronously on the UI thread.
  Parameters:
    `script` - a code block to be executed

### executeFuture

    public Future executeFuture(Callable callable)

  Executes a code block as a Future on an ExecutorService.
  Parameters:
    `callable` - a code block to be executed
  Returns:
    a Future that contains the result of the execution

### executeFuture

    public Future executeFuture(ExecutorService executorService, Callable callable)

  Executes a code block as a Future on an ExecutorService.
  Parameters:
    `executorService` - the ExecutorService to use. Will use the default ExecutorService if null.
    `callable` - a code block to be executed
  Returns:
    a Future that contains the result of the execution

### executeOutside

    public void executeOutside(Runnable runnable)

  Executes a code block outside of the UI thread.
  Parameters:
    `runnable` - a code block to be executed

### executeOutside

    public void executeOutside(Script script)

  Executes a code block outside of the UI thread.
  Parameters:
    `script` - a code block to be executed

### executeSync

    public void executeSync(Runnable runnable)

  Executes a code block synchronously on the UI thread.
  Parameters:
    `runnable` - a code block to be executed

### executeSync

    public void executeSync(Script script)

  Executes a code block synchronously on the UI thread.
  Parameters:
    `script` - a code block to be executed

### getInstance

    public static UIThreadManager getInstance()

### getUIThreadHandler

    public UIThreadHandler getUIThreadHandler()

### isUIThread

    public boolean isUIThread()

  True if the current thread is the UI thread.
  Returns:
    true if the current thread is the UI thread, false otherwise.

### setUIThreadHandler

    public void setUIThreadHandler(UIThreadHandler threadHandler)

Groovy Documentation