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
A base class for tasks that need to be able to access the TaskIterator that contains them.
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.
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>-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIf this is true, we should abort whatever theTaskis currently doing in the run() method. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Calling this attempts to abort the currentTask.protected final voidinsertTasksAfterCurrentTask(Task... newTasks) Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class.protected final voidinsertTasksAfterCurrentTask(TaskIterator newTasks) Inserts "newTasks" after the current Task, in the TaskIterator that is being managed by this class.abstract voidrun(TaskMonitor taskMonitor) This method is called when theTaskbegins execution.final voidsetTaskIterator(TaskIterator taskIterator) This method is used by aTaskIteratorto set itself on the newly added Task.
-
Field Details
-
cancelled
protected volatile boolean cancelledIf this is true, we should abort whatever theTaskis currently doing in the run() method.
-
-
Constructor Details
-
AbstractTask
public AbstractTask()
-
-
Method Details
-
setTaskIterator
This method is used by aTaskIteratorto 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
-
insertTasksAfterCurrentTask
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
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
Description copied from interface:TaskThis method is called when theTaskbegins execution. This method should not be called by the programmer, as it will be called by theTaskManager.- Specified by:
runin interfaceTask- Parameters:
taskMonitor- TheTaskMonitorprovided byTaskManager. to allow theTaskto modify its user interface.- Throws:
Exception- TheTaskis at liberty to throw an exception inrun. The exception is caught byTaskManagerand is displayed in the interface. If aTaskdoes not throw an exception, theTaskimplementation does not need to specify thethrows Exceptionclause for therunmethod. Moreover, exceptions should be the way theTaskcommunicates the occurrence of a fatal error, like a low-level exception or an invalid parameter, to theTaskManager.
-
cancel
public void cancel()Calling this attempts to abort the currentTask. How well this works depends on the granularity of the implementingTaskchecking whether the "canceled" is true or not and then taking appropriate action.
-