Package org.cytoscape.work
Class AbstractTask
- java.lang.Object
-
- org.cytoscape.work.AbstractTask
-
- All Implemented Interfaces:
Task
- Direct Known Subclasses:
AbstractCyNetworkReader
,AbstractEdgeViewTask
,AbstractLayoutTask
,AbstractNetworkCollectionTask
,AbstractNetworkTask
,AbstractNetworkViewCollectionTask
,AbstractNetworkViewTask
,AbstractNodeViewTask
,AbstractRootNetworkCollectionTask
,AbstractRowTask
,AbstractTableCellTask
,AbstractTableColumnTask
,AbstractTableTask
public abstract class AbstractTask extends Object implements Task
A base class for tasks that need to be able to access the TaskIterator that contains them.Module:
work-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>work-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (Abstract Class): This class is abstract and meant to be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
cancelled
If this is true, we should abort whatever theTask
is currently doing in the run() method.
-
Constructor Summary
Constructors Constructor Description AbstractTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cancel()
Calling this attempts to abort the currentTask
.TaskIterator
getTaskIterator()
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 theTask
begins execution.void
setTaskIterator(TaskIterator taskIterator)
This method is used by aTaskIterator
to set itself on the newly added Task.
-
-
-
Method Detail
-
setTaskIterator
public final void setTaskIterator(TaskIterator taskIterator)
This method is used by aTaskIterator
to set itself on the newly added Task. This method should not be called by otherwise.- Parameters:
taskIterator
- TaskIterator that will set itself on the newly added task.
-
getTaskIterator
public TaskIterator getTaskIterator()
-
insertTasksAfterCurrentTask
protected final void insertTasksAfterCurrentTask(Task... newTasks)
Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class.- Parameters:
newTasks
- tasks to insert after the current task in the TaskIterator that is being managed by this class.
-
insertTasksAfterCurrentTask
protected final void insertTasksAfterCurrentTask(TaskIterator newTasks)
Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class.- Parameters:
newTasks
- the TaskIterator to insert after the current task in the TaskIterator that is being managed by this class.
-
run
public abstract void run(TaskMonitor taskMonitor) throws Exception
Description copied from interface:Task
This method is called when theTask
begins execution. This method should not be called by the programmer, as it will be called by theTaskManager
.- Specified by:
run
in interfaceTask
- Parameters:
taskMonitor
- TheTaskMonitor
provided byTaskManager
. to allow theTask
to modify its user interface.- Throws:
Exception
- TheTask
is at liberty to throw an exception inrun
. The exception is caught byTaskManager
and is displayed in the interface. If aTask
does not throw an exception, theTask
implementation does not need to specify thethrows Exception
clause for therun
method. Moreover, exceptions should be the way theTask
communicates the occurrence of a fatal error, like a low-level exception or an invalid parameter, to theTaskManager
.
-
-