|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
jaxx.runtime.swing.AbstractActionThread
public abstract class AbstractActionThread
An abstract action thread to consume actions in a non Swing event thread.
Implements the methodonActionXXX(ActionWorker) to hook on action
status.
To consume an action, use the method addAction(String, Runnable).
TODO Make this multi-action enable
| Nested Class Summary | |
|---|---|
static class |
AbstractActionThread.ActionWorker
Action worker to execute a incoming action. |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected AbstractActionThread.ActionWorker |
worker
current worker to execute action |
protected PropertyChangeListener |
workerListener
the listener of running action |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
protected |
AbstractActionThread(String name)
|
| Method Summary | |
|---|---|
AbstractActionThread.ActionWorker |
addAction(String actionLabel,
Runnable action)
Add an new action to perform. |
void |
cancel()
Cancel the thread, this will release any lock of the tread. |
protected void |
close()
La méthode pour nettoyer le thread, a la fermeture. |
Runnable |
createRunnable(Object methodContainer,
String methodName,
Object... arguments)
Creates a runnable instance (via a Proxy) to a method given by his name ( methodName) to invoke on methodcontainer with given
arguments. |
protected void |
lockThread()
To lock the thread. |
abstract void |
onActionCancel(AbstractActionThread.ActionWorker source)
Hook when a action has been canceled. |
abstract void |
onActionEnd(AbstractActionThread.ActionWorker source)
Hook when a action has end with no failure or cancel. |
abstract void |
onActionFail(AbstractActionThread.ActionWorker source)
Hook when a action has failed. |
abstract void |
onActionStart(AbstractActionThread.ActionWorker source)
Hook when a action is about to start. |
void |
run()
|
protected void |
setWaiting(boolean waiting)
Mutates the waiting state of the thread. |
protected void |
unlockThread()
To unlock the thread. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected AbstractActionThread.ActionWorker worker
protected final PropertyChangeListener workerListener
| Constructor Detail |
|---|
protected AbstractActionThread(String name)
| Method Detail |
|---|
public Runnable createRunnable(Object methodContainer,
String methodName,
Object... arguments)
methodName) to invoke on methodcontainer with given
arguments.
This is a great feature to create runnable code with a real context.
methodContainer - the container of the method to invokemethodName - the name of the method to invokearguments - parameters to pass to method to invke.
public AbstractActionThread.ActionWorker addAction(String actionLabel,
Runnable action)
actionLabel - the name of the action to performaction - the action to perform
public abstract void onActionStart(AbstractActionThread.ActionWorker source)
source - the action worker containing the action to performpublic abstract void onActionFail(AbstractActionThread.ActionWorker source)
source - the action worker containing the action to performpublic abstract void onActionCancel(AbstractActionThread.ActionWorker source)
source - the action worker containing the action to performpublic abstract void onActionEnd(AbstractActionThread.ActionWorker source)
source - the action worker containing the action to performpublic void run()
run in interface Runnablerun in class Threadpublic void cancel()
protected void close()
protected void setWaiting(boolean waiting)
waiting is to true, then will lock the
thread, otherwise will unlock the thread.
waiting - true if a lock is required
protected void lockThread()
throws InterruptedException
InterruptedException - if locking was interrupedprotected void unlockThread()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||