|
Cytoscape 3.0.0-beta1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cytoscape.work.AbstractTask
public abstract class AbstractTask
A base class for tasks that need to be able to access the TaskIterator that contains them.
Field Summary | |
---|---|
protected boolean |
cancelled
If this is true, we should abort whatever the Task is currently doing in the run() method. |
Constructor Summary | |
---|---|
AbstractTask()
|
Method Summary | |
---|---|
void |
cancel()
Calling this attempts to abort the current Task . |
protected void |
insertTasksAfterCurrentTask(Task... newTasks)
Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class. |
protected void |
insertTasksAfterCurrentTask(TaskIterator newTasks)
Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class. |
abstract void |
run(TaskMonitor taskMonitor)
This method is called when the Task begins execution. |
void |
setTaskIterator(TaskIterator taskIterator)
This method is typically used by a TaskIterator to set itself on the newly added Task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected volatile boolean cancelled
Task
is currently doing in the run() method.
Constructor Detail |
---|
public AbstractTask()
Method Detail |
---|
public final void setTaskIterator(TaskIterator taskIterator)
TaskIterator
to set itself on the newly added Task.
taskIterator
- TaskIterator that will set itself on the newly added task.protected final void insertTasksAfterCurrentTask(Task... newTasks)
newTasks
- tasks to insert after the current task in the TaskIterator that is being managed by
this class.protected final void insertTasksAfterCurrentTask(TaskIterator newTasks)
newTasks
- the TaskIterator to insert after the current task in the TaskIterator that is being
managed by this class.public abstract void run(TaskMonitor taskMonitor) throws Exception
Task
begins execution.
This method should not be called by the programmer, as it will be called by the TaskManager
.
run
in interface Task
taskMonitor
- This is provided by TaskManager
to allow the Task
to modify its user interface.
Exception
- The Task
is at liberty to
throw an exception in run
. The exception is
caught by TaskManager
and is displayed in the interface.
If a Task
does not throw an exception,
the Task
implementation does not
need to specify the throws Exception
clause
for the run
method. Moreover, exceptions
should be the way the Task
communicates
the occurrence of a fatal error, like a low-level exception or an invalid parameter,
to the TaskManager
.public void cancel()
Task
. How well this works depends on the granularity of
a Task
's checking whether "canceled" is true or not and then taking appropriate action.
cancel
in interface Task
|
Cytoscape 3.0.0-beta1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |