Cytoscape 3.0.1 API

org.cytoscape.work
Interface Task

All Known Subinterfaces:
CyNetworkReader, CyPropertyReader, CySessionReader, CyTableReader, CyWriter, VizmapReader
All Known Implementing Classes:
AbstractEdgeViewTask, AbstractLayoutTask, AbstractNetworkCollectionTask, AbstractNetworkTask, AbstractNetworkViewCollectionTask, AbstractNetworkViewTask, AbstractNodeViewTask, AbstractPartitionLayoutTask, AbstractRowTask, AbstractTableCellTask, AbstractTableColumnTask, AbstractTableTask, AbstractTask

public interface Task

This interface specifies a unit of work to be executed asynchronously in its own Thread along with a user interface to display its progress, provide a means for the user to cancel the Task, and show information about any Exceptions thrown during its execution. Tasks are executed as part of a TaskIterator which will be passed into a TaskManager's execute method.

Some hints for writing a Task:


Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.

Method Summary
 void cancel()
          This method is called by the TaskManager when the user chooses to cancel the Task.
 void run(TaskMonitor taskMonitor)
          This method is called when the Task begins execution.
 

Method Detail

run

void run(TaskMonitor taskMonitor)
         throws Exception
This method is called when the Task begins execution. This method should not be called by the programmer, as it will be called by the TaskManager.

Parameters:
taskMonitor - The TaskMonitor provided by TaskManager. to allow the Task to modify its user interface.
Throws:
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.

cancel

void cancel()
This method is called by the TaskManager when the user chooses to cancel the Task.

This method should not be called by the programmer, as it might be called by the TaskManager.

This method should inform the Task that it must terminate execution cleanly and do any necessary cleanup work required.

WARNING: this method is called by a different thread than the thread executing run. The programmer must be aware of concurrency issues!


Cytoscape 3.0.1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.