Cytoscape 2.2 (c) 2004 ISB, MSKCC, UCSD

cytoscape.util
Interface MonitoredTask

All Known Subinterfaces:
LayoutAlgorithm
All Known Implementing Classes:
AbstractLayout

public interface MonitoredTask


Method Summary
 void cancel()
          Gets called by the CytoscapeProgressMonitor when the user click on the Cancel button.
 boolean done()
          Returns true if the task is done.
 int getCurrent()
          Returns the currentProgress parameter.
 int getLengthOfTask()
          Returns the lenghtOfTask parameter.
 String getMessage()
          Returns a String, possibly the message to be printed on a dialog.
 String getTaskName()
          Returns a String, possibly the message that describes the task being performed.
 void go(boolean wait)
          Initializes currentProgress (generally to zero) and then spawns a SwingWorker to start doing the work.
 void incrementProgress()
          Increments the progress by one
 void stop()
          Stops the task by simply setting currentProgress to lengthOfTask, or if a boolean "done" variable is used, setting it to true.
 boolean wasCanceled()
           
 

Method Detail

done

public boolean done()
Returns true if the task is done. Otherwise false. This can be done by either returning (currentProgress == lengthOfTask) or having a boolean "done" variable that is set to true in the code whenever the task is done, and returning it here.


getCurrent

public int getCurrent()
Returns the currentProgress parameter.


getLengthOfTask

public int getLengthOfTask()
Returns the lenghtOfTask parameter.


getMessage

public String getMessage()
Returns a String, possibly the message to be printed on a dialog. Example: "Completed 12%"


getTaskName

public String getTaskName()
Returns a String, possibly the message that describes the task being performed. Example: "Calculating connecting paths."


go

public void go(boolean wait)
Initializes currentProgress (generally to zero) and then spawns a SwingWorker to start doing the work.

Parameters:
wait - whether or not the method should wait for the task to be done before returning if true, should call SwingWorker.get() before returning

incrementProgress

public void incrementProgress()
Increments the progress by one


stop

public void stop()
Stops the task by simply setting currentProgress to lengthOfTask, or if a boolean "done" variable is used, setting it to true.


cancel

public void cancel()
Gets called by the CytoscapeProgressMonitor when the user click on the Cancel button.


wasCanceled

public boolean wasCanceled()
Returns:
whether the task was canceled while running or not.

www.cytoscape.org