net.sf.tacos.demo.partial
Class ProgressWorkThread

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.tacos.demo.partial.ProgressWorkThread
All Implemented Interfaces:
Serializable, Runnable, ProgressWorker

public class ProgressWorkThread
extends Thread
implements ProgressWorker, Serializable

Demonstration of ProgressWorker.

Author:
jkuhnert
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProgressWorkThread()
          Default constructor
 
Method Summary
 void cancelTask()
          Can be invoked by a user inpatient to see the request completed.
 double getCurrentProgress()
          Should represent a number value indicating the current progress value out of the total derived in ProgressWorker.getTotalProgress().
 String getCurrentStatus()
          If value not null will be used to display any textual information that may be useful to see along with the basic numeric values.
 double getTotalProgress()
          The total value that this progress represents.
 boolean isComplete()
          Should return true once the task is completed.
 void run()
          
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProgressWorkThread

public ProgressWorkThread()
Default constructor

Method Detail

getTotalProgress

public double getTotalProgress()
The total value that this progress represents. This should be specific to your task, not in terms of percent complete, as the percentage values will be calculated automatically by the ProgressBar.

Specified by:
getTotalProgress in interface ProgressWorker
Returns:
Number representing the total value for this progress bar.

getCurrentProgress

public double getCurrentProgress()
Should represent a number value indicating the current progress value out of the total derived in ProgressWorker.getTotalProgress().

Specified by:
getCurrentProgress in interface ProgressWorker
Returns:
The current progress value.

getCurrentStatus

public String getCurrentStatus()
If value not null will be used to display any textual information that may be useful to see along with the basic numeric values.

Specified by:
getCurrentStatus in interface ProgressWorker
Returns:
String representation of what is currently being worked on by this task.

isComplete

public boolean isComplete()
Should return true once the task is completed.

Specified by:
isComplete in interface ProgressWorker
Returns:
True, if and only if the thread represented by this task is complete.

cancelTask

public void cancelTask()
Can be invoked by a user inpatient to see the request completed. Method doesn't have to cancel exactly when called, or at all, but it is expected that this method will block at least until the task is complete. Only return from this call if calling ProgressWorker.isComplete() will return true.

Specified by:
cancelTask in interface ProgressWorker

run

public void run()

Specified by:
run in interface Runnable
Overrides:
run in class Thread