DESY ACOP Beans Home

com.cosylab.gui.components
Class AbstractProgressTask

java.lang.Object
  extended by java.lang.Thread
      extended by com.cosylab.gui.components.AbstractProgressTask
All Implemented Interfaces:
ProgressMonitor, java.lang.Runnable

public abstract class AbstractProgressTask
extends java.lang.Thread
implements ProgressMonitor

Convenience implementation of ProgressMonitor. Contains methods for firing events.

Version:
$id$
Author:
Ales Pucelj

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractProgressTask()
          AbstractProgressTask constructor comment.
 
Method Summary
 void addProgressListener(ProgressListener listener)
          Adds listener.
protected  void fireProgressEvent(java.lang.String status, int current, int total)
          Notifies listeners that current progress has changed.
protected  void fireTaskComplete()
          Notifies listeners that a task has been completed.
protected  void fireTaskInterrupted(java.lang.String reason)
          Notifies listeners that a task has been interrupted during execution.
protected  void fireTaskStarted()
          Notify listeners that task has started execution.
protected  void immediateUpdate()
          Force listeners to update immediately.
 void removeProgressListener(ProgressListener listener)
          Removes listener.
 
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, run, 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
 
Methods inherited from interface com.cosylab.gui.components.ProgressMonitor
getCurrent, getStatus, getTotal
 

Constructor Detail

AbstractProgressTask

public AbstractProgressTask()
AbstractProgressTask constructor comment.

Method Detail

addProgressListener

public void addProgressListener(ProgressListener listener)
Adds listener. Listeners will be notified when task reports progress.

Specified by:
addProgressListener in interface ProgressMonitor
Parameters:
listener - to add.

fireProgressEvent

protected void fireProgressEvent(java.lang.String status,
                                 int current,
                                 int total)
Notifies listeners that current progress has changed. There is no prescribed frequency with which these events should be fired.

Parameters:
status - Description of current status.
current - progress, should be less than total
total - ammount.

fireTaskComplete

protected void fireTaskComplete()
Notifies listeners that a task has been completed.


fireTaskInterrupted

protected void fireTaskInterrupted(java.lang.String reason)
Notifies listeners that a task has been interrupted during execution.

Parameters:
reason - Description of reason for interruption.

fireTaskStarted

protected void fireTaskStarted()
Notify listeners that task has started execution.


immediateUpdate

protected void immediateUpdate()
Force listeners to update immediately.


removeProgressListener

public void removeProgressListener(ProgressListener listener)
Removes listener.

Specified by:
removeProgressListener in interface ProgressMonitor
Parameters:
listener - to remove.


Copyright © 2010. All Rights Reserved.