Griffon 1.2.0

griffon.core
[Java] Class UIThreadManager

java.lang.Object
  griffon.core.UIThreadManager

public final class UIThreadManager

Helper class that can execute code inside the UI thread.

Authors:
Andres Almiray


Nested Class Summary
private static class UIThreadManager.RunnableRunner

 
Field Summary
private static ExecutorService DEFAULT_EXECUTOR_SERVICE

private static String EXECUTE_FUTURE

private static Closure EXECUTE_FUTURE_CLOSURE

private static MetaMethod EXECUTE_FUTURE_METHOD1

private static MetaMethod EXECUTE_FUTURE_METHOD2

private static String EXECUTE_INSIDE_UI_ASYNC

private static Closure EXECUTE_INSIDE_UI_ASYNC_CLOSURE

private static MetaMethod EXECUTE_INSIDE_UI_ASYNC_METHOD

private static RunnableWithArgs EXECUTE_INSIDE_UI_ASYNC_RUNNER

private static String EXECUTE_INSIDE_UI_SYNC

private static Closure EXECUTE_INSIDE_UI_SYNC_CLOSURE

private static MetaMethod EXECUTE_INSIDE_UI_SYNC_METHOD

private static RunnableWithArgs EXECUTE_INSIDE_UI_SYNC_RUNNER

private static String EXECUTE_OUTSIDE_UI

private static Closure EXECUTE_OUTSIDE_UI_CLOSURE

private static MetaMethod EXECUTE_OUTSIDE_UI_METHOD

private static RunnableWithArgs EXECUTE_OUTSIDE_UI_RUNNER

private static Class[] EXEC_METHOD_ARGS

private static UIThreadManager INSTANCE

private static String IS_UITHREAD

private static CallableWithArgs IS_UITHREAD_CALLABLE

private static Closure IS_UITHREAD_CLOSURE

private static MetaMethod IS_UITHREAD_METHOD

private static Logger LOG

static String[] THREADING_METHOD_NAMES

private UIThreadHandler uiThreadHandler

 
Constructor Summary
private UIThreadManager()

 
Method Summary
static void enhance(Script script)

static void enhance(MetaClass mc)

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_CLOSURE

private static final Closure EXECUTE_FUTURE_CLOSURE


EXECUTE_FUTURE_METHOD1

private static final MetaMethod EXECUTE_FUTURE_METHOD1


EXECUTE_FUTURE_METHOD2

private static final MetaMethod EXECUTE_FUTURE_METHOD2


EXECUTE_INSIDE_UI_ASYNC

private static final String EXECUTE_INSIDE_UI_ASYNC


EXECUTE_INSIDE_UI_ASYNC_CLOSURE

private static final Closure EXECUTE_INSIDE_UI_ASYNC_CLOSURE


EXECUTE_INSIDE_UI_ASYNC_METHOD

private static final MetaMethod EXECUTE_INSIDE_UI_ASYNC_METHOD


EXECUTE_INSIDE_UI_ASYNC_RUNNER

private static final RunnableWithArgs EXECUTE_INSIDE_UI_ASYNC_RUNNER


EXECUTE_INSIDE_UI_SYNC

private static final String EXECUTE_INSIDE_UI_SYNC


EXECUTE_INSIDE_UI_SYNC_CLOSURE

private static final Closure EXECUTE_INSIDE_UI_SYNC_CLOSURE


EXECUTE_INSIDE_UI_SYNC_METHOD

private static final MetaMethod EXECUTE_INSIDE_UI_SYNC_METHOD


EXECUTE_INSIDE_UI_SYNC_RUNNER

private static final RunnableWithArgs EXECUTE_INSIDE_UI_SYNC_RUNNER


EXECUTE_OUTSIDE_UI

private static final String EXECUTE_OUTSIDE_UI


EXECUTE_OUTSIDE_UI_CLOSURE

private static final Closure EXECUTE_OUTSIDE_UI_CLOSURE


EXECUTE_OUTSIDE_UI_METHOD

private static final MetaMethod EXECUTE_OUTSIDE_UI_METHOD


EXECUTE_OUTSIDE_UI_RUNNER

private static final RunnableWithArgs EXECUTE_OUTSIDE_UI_RUNNER


EXEC_METHOD_ARGS

private static Class[] EXEC_METHOD_ARGS


INSTANCE

private static final UIThreadManager INSTANCE


IS_UITHREAD

private static final String IS_UITHREAD


IS_UITHREAD_CALLABLE

private static final CallableWithArgs IS_UITHREAD_CALLABLE


IS_UITHREAD_CLOSURE

private static final Closure IS_UITHREAD_CLOSURE


IS_UITHREAD_METHOD

private static final MetaMethod IS_UITHREAD_METHOD


LOG

private static final Logger LOG


THREADING_METHOD_NAMES

public static final String[] THREADING_METHOD_NAMES


uiThreadHandler

private UIThreadHandler uiThreadHandler


 
Constructor Detail

UIThreadManager

private UIThreadManager()


 
Method Detail

enhance

public static void enhance(Script script)


enhance

public static void enhance(MetaClass mc)


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