com.townleyenterprises.swing
Interface MonitoredTask

All Known Implementing Classes:
AbstractMonitoredTask

public interface MonitoredTask

The interface which provides monitoring feedback for long running operations.

Since:
2.1
Version:
$Id: MonitoredTask.java,v 1.4 2004/07/28 10:33:59 atownley Exp $
Author:
Andrew S. Townley

Method Summary
 void addTaskListener(TaskListener listener)
          This method is used to register a new task listener.
 int getCurrentProgress()
          This method returns the current progress of the task.
 java.lang.Throwable getError()
          This method is used to return a reference to the throwable encountered during the performing of the task.
 java.lang.String getStatus()
          This method is used to return the last status message associated with the task.
 int getTaskLength()
          This method returns the length of the current task.
 java.util.List getTaskListeners()
          This method is used to return the list of task listeners.
 boolean hasError()
          This method returns true if the task encountered any errors.
 boolean isComplete()
          This method returns true if the task has completed.
 void removeTaskListener(TaskListener listener)
          This method is used to remove a specific listener.
 void requestStop()
          This method is used to request that the task be stopped.
 boolean shouldStop()
          This method returns true if the task has received a request to be cancelled.
 void start()
          This method is used to start the task.
 

Method Detail

shouldStop

public boolean shouldStop()
This method returns true if the task has received a request to be cancelled.

Returns:
true if should stop; false otherwise

isComplete

public boolean isComplete()
This method returns true if the task has completed.

Returns:
true if done; false if not

hasError

public boolean hasError()
This method returns true if the task encountered any errors.

Returns:
true if errors; false if no

getTaskLength

public int getTaskLength()
This method returns the length of the current task.

Returns:
an integer indicating the length of the task

getCurrentProgress

public int getCurrentProgress()
This method returns the current progress of the task. In cases where the current progress is unknown, this method can indicate this state by returning a value < 0.

Returns:
positive integer < the task length or -1 if unknown

getError

public java.lang.Throwable getError()
This method is used to return a reference to the throwable encountered during the performing of the task.

Returns:
the Throwable

getStatus

public java.lang.String getStatus()
This method is used to return the last status message associated with the task. Useful for tasks that perform a number of steps.

Returns:
the message

start

public void start()
This method is used to start the task.


requestStop

public void requestStop()
This method is used to request that the task be stopped.


addTaskListener

public void addTaskListener(TaskListener listener)
This method is used to register a new task listener.

Parameters:
listener - the listener to add

getTaskListeners

public java.util.List getTaskListeners()
This method is used to return the list of task listeners.

Returns:
the list of listeners

removeTaskListener

public void removeTaskListener(TaskListener listener)
This method is used to remove a specific listener.

Parameters:
listener - the listener to remove


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.