Package com.nomagic.task
Class Task
java.lang.Object
com.nomagic.task.SwingWorker<Object>
com.nomagic.task.Task
Task for execution of some code on a separate thread.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class com.nomagic.task.SwingWorker
doFinishedReached, mName, THREAD_GROUP, THREAD_GROUP_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidMethod invoked on task's thread just beforeSwingWorker.finished()is called.final ObjectCompute the value to be returned by thegetmethod.static ProgressStatusReturns currently activeTaskprogress statusfinal voidabstract voidexecute()static voidexecuteTaskOnSameThread(Task task) Executes task on same thread.getName()getState()voidSets state to CANCELED.final voidDeprecated.See MDUML-57069 for deprecationstatic booleanbooleanbooleanbooleanbooleanbooleanbooleanisReady()booleanvoidvoidsetCancelable(boolean cancelable) voidsetDoFinishedExecuter(com.nomagic.task.Task.DoFinishedExecuter doFinishedExecuter) voidvoidsetFinished(boolean finished) voidsetInterruptThreadOnCancel(boolean interruptThreadOnCancel) voidvoidvoidsetStatus(ProgressStatus status) voidstopTask()Interrupt task and wait while it is workingMethods inherited from class com.nomagic.task.SwingWorker
finished, get, getThread, getValue, isStopped, newFixedThreadExecutor, newSerialExecutor, newSerialExecutor, newSerialExecutorWithPriority, resume, setPriority, start, startOn, suspend, threadInterrupt, threadJoin, threadStop
-
Field Details
-
STATE_CHANGED_PROPERTY
- See Also:
-
CANCELED
- See Also:
-
FINISHED
- See Also:
-
COMPLETED
- See Also:
-
WORKING
- See Also:
-
READY
- See Also:
-
EXCEPTION
- See Also:
-
-
Constructor Details
-
Task
-
-
Method Details
-
executeTaskOnSameThread
Executes task on same thread. Updates progress status from same thread.- Throws:
Exception
-
setInterruptThreadOnCancel
public void setInterruptThreadOnCancel(boolean interruptThreadOnCancel) -
currentTaskStatus
Returns currently activeTaskprogress status- Returns:
- currently active
Taskprogress status ornullif current thread is not executing aTask
-
setName
-
setException
-
getException
-
getName
-
getStatus
-
setStatus
-
isCompleted
public boolean isCompleted() -
isWorking
public boolean isWorking() -
isReady
public boolean isReady() -
isException
public boolean isException() -
isCanceled
public boolean isCanceled() -
setState
-
getState
-
construct
Description copied from class:com.nomagic.task.SwingWorkerCompute the value to be returned by thegetmethod.- Specified by:
constructin classcom.nomagic.task.SwingWorker<Object>- Returns:
- the result value
-
execute
- Throws:
Exception
-
interruptAndStop
Deprecated.See MDUML-57069 for deprecationDescription copied from class:com.nomagic.task.SwingWorkerA new method that interrupts ant stops the worker thread. Call this method to force the worker to stop what it's doing.- Overrides:
interruptAndStopin classcom.nomagic.task.SwingWorker<Object>
-
doFinished
public final void doFinished()- Overrides:
doFinishedin classcom.nomagic.task.SwingWorker<Object>
-
beforeFinished
protected void beforeFinished()Method invoked on task's thread just beforeSwingWorker.finished()is called. -
isFinished
public boolean isFinished()- Returns:
- true if task is completely finished (execute and finished methods are executed)
-
isCancelable
public boolean isCancelable()- Returns:
- Returns the cancelable.
-
setCancelable
public void setCancelable(boolean cancelable) - Parameters:
cancelable- The cancelable to set.
-
interrupt
public void interrupt()Sets state to CANCELED. Notifies all threads that are waiting on this object monitor.- Overrides:
interruptin classcom.nomagic.task.SwingWorker<Object>
-
isActiveTasks
public static boolean isActiveTasks() -
addPropertyChangedListener
-
removePropertyChangedListener
-
setFinished
public void setFinished(boolean finished) -
setDoFinishedExecuter
public void setDoFinishedExecuter(com.nomagic.task.Task.DoFinishedExecuter doFinishedExecuter) -
stopTask
public void stopTask()Interrupt task and wait while it is working
-