|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.townleyenterprises.swing.AbstractMonitoredTask
This is an implementation of the MonitoredTask interface which requires only that a single method be implemneted.
Constructor Summary | |
AbstractMonitoredTask()
|
Method Summary | |
void |
addTaskListener(TaskListener listener)
This method is used to register a new task listener. |
protected void |
fireTaskAborted()
This method is used to fire the task aborted event. |
protected void |
fireTaskCompleted()
This method is used to fire the task completed event. |
protected void |
fireTaskStarted()
This method is used to fire the task started event. |
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. |
protected void |
initialize()
This method can be overridden to add extra initialization prior to the iterations performed by the thread. |
boolean |
isComplete()
This method returns true if the task has completed. |
protected abstract int |
performWork(boolean stop)
This method is the actual re-entrant method that is called for each chunk of work that should be done. |
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. |
protected void |
setComplete(boolean val)
This method is used to indicate that the task is complete and should be stopped. |
protected void |
setError(java.lang.Throwable error)
This method is used to set the error encountered by the task. |
protected void |
setProgress(int progress)
This method is used to set the progress of the current task. |
protected void |
setStatus(java.lang.String s)
This method is used to set the status text |
protected void |
setTaskLength(int length)
This method is used to set the length of the task. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AbstractMonitoredTask()
Method Detail |
public boolean shouldStop()
shouldStop
in interface MonitoredTask
public boolean isComplete()
isComplete
in interface MonitoredTask
public boolean hasError()
hasError
in interface MonitoredTask
public int getTaskLength()
getTaskLength
in interface MonitoredTask
public java.lang.Throwable getError()
getError
in interface MonitoredTask
public int getCurrentProgress()
getCurrentProgress
in interface MonitoredTask
public java.lang.String getStatus()
getStatus
in interface MonitoredTask
public final void start()
start
in interface MonitoredTask
public void requestStop()
requestStop
in interface MonitoredTask
public void addTaskListener(TaskListener listener)
addTaskListener
in interface MonitoredTask
listener
- the listener to addpublic java.util.List getTaskListeners()
getTaskListeners
in interface MonitoredTask
public void removeTaskListener(TaskListener listener)
removeTaskListener
in interface MonitoredTask
listener
- the listener to removeprotected void initialize()
protected abstract int performWork(boolean stop)
stop
- indicates that the task should stop
protected void setComplete(boolean val)
val
- true to indicate task is finishedprotected void setError(java.lang.Throwable error)
error
- the throwableprotected void setProgress(int progress)
progress
- the new valueprotected void setTaskLength(int length)
protected void setStatus(java.lang.String s)
protected void fireTaskStarted()
protected void fireTaskAborted()
protected void fireTaskCompleted()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |