jebl.util
Class ProgressListener

java.lang.Object
  extended by jebl.util.ProgressListener
Direct Known Subclasses:
CompositeProgressListener

public abstract class ProgressListener
extends Object

Author:
Matt Kearse

Field Summary
static ProgressListener EMPTY
          A ProgressListener that ignores all events and always returns false from isCanceled().
 
Constructor Summary
ProgressListener()
           
 
Method Summary
protected abstract  void _setIndeterminateProgress()
          This method is a hook called from setIndeterminateProgress() to allow subclasses a custom reaction to setIndeterminateProgress events.
protected abstract  void _setMessage(String message)
          This method is a hook called from setMessage(java.lang.String) to allow subclasses a custom reaction to setMessage events.
protected abstract  void _setProgress(double fractionCompleted)
          This method is a hook called from setProgress(double) to allow subclasses a custom reaction to setProgress events.
abstract  boolean isCanceled()
          This method must be implemented by all subclasses.
 boolean setIndeterminateProgress()
          Sets indefinite progress (i.e.
 boolean setMessage(String message)
          Set visible user message.
 boolean setProgress(double fractionCompleted)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final ProgressListener EMPTY
A ProgressListener that ignores all events and always returns false from isCanceled(). Useful when you don't care about the progress results or canceling the operation.

Constructor Detail

ProgressListener

public ProgressListener()
Method Detail

setProgress

public final boolean setProgress(double fractionCompleted)
Parameters:
fractionCompleted - a number between 0 and 1 inclusive representing the fraction of the operation completed. If you are unsure of the fraction completed, call setIndeterminateProgress() instead.
Returns:
true if the user has requested that this operation be canceled.

_setProgress

protected abstract void _setProgress(double fractionCompleted)
This method is a hook called from setProgress(double) to allow subclasses a custom reaction to setProgress events. Currently, subclasses are required to implement this method, but in the future it may get an empty default implementation to make it optional for subclasses to subscribe to setProgress events.


setIndeterminateProgress

public final boolean setIndeterminateProgress()
Sets indefinite progress (i.e. "some progress has happened, but I don't know how close we are to finishing").

Returns:
true if the user has requested that this operation be canceled.

_setIndeterminateProgress

protected abstract void _setIndeterminateProgress()
This method is a hook called from setIndeterminateProgress() to allow subclasses a custom reaction to setIndeterminateProgress events. Currently, subclasses are required to implement this method, but in the future it may get an empty default implementation to make it optional for subclasses to subscribe to setIndeterminateProgress events.


setMessage

public final boolean setMessage(String message)
Set visible user message.

Parameters:
message -
Returns:
true if the user has requested that this operation be canceled.

_setMessage

protected abstract void _setMessage(String message)
This method is a hook called from setMessage(java.lang.String) to allow subclasses a custom reaction to setMessage events. Currently, subclasses are required to implement this method, but in the future it may get an empty default implementation to make it optional for subclasses to subscribe to setMessage events.


isCanceled

public abstract boolean isCanceled()
This method must be implemented by all subclasses. It is called from setProgress(double), setIndeterminateProgress() and setMessage(java.lang.String) to determine the return value of these methods.

Returns:
true if the user has requested that this operation be canceled.