public abstract class ProgressListener extends java.lang.Object implements Cancelable
Modifier and Type | Class and Description |
---|---|
static class |
ProgressListener.Wrapper
A decorator progress listener which delegates all method calls to an internal progress listener.
|
Modifier and Type | Field and Description |
---|---|
static ProgressListener |
EMPTY
A ProgressListener that ignores all events and always returns false from
isCanceled() . |
Constructor and Description |
---|
ProgressListener() |
Modifier and Type | Method and Description |
---|---|
void |
addFeedbackAction(java.lang.String label,
SimpleListener listener)
Equivalent to
addFeedbackAction(label,"",listener) |
void |
addFeedbackAction(java.lang.String label,
java.lang.String description,
SimpleListener listener)
Adds an action that can choose to provide feedback.
|
abstract boolean |
isCanceled()
This method must be implemented by all subclasses.
|
void |
removeFeedbackAction(java.lang.String label)
Removes a feedback action previously added using
addFeedbackAction(String, jebl.util.SimpleListener) . |
boolean |
setImage(java.awt.Image image)
Set an image associated with the current progress.
|
boolean |
setIndeterminateProgress()
Sets indefinite progress (i.e.
|
boolean |
setMessage(java.lang.String message)
Set visible user message.
|
boolean |
setProgress(double fractionCompleted) |
boolean |
setProgress(int currentStep,
int numberOfSteps)
Same as calling
setProgress(((double)currentStep)/numberOfSteps) |
boolean |
setProgress(long currentStep,
long numberOfSteps)
Same as calling
setProgress(((double)currentStep)/numberOfSteps) |
void |
setTitle(java.lang.String title)
Sets a title associated with whatever is being done.
|
public static final ProgressListener EMPTY
isCanceled()
. Useful when you don't care about the progress
results or canceling the operation.public final boolean setProgress(double fractionCompleted)
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.public final boolean setProgress(int currentStep, int numberOfSteps)
setProgress(((double)currentStep)/numberOfSteps)
currentStep
- between 0 and numberOfSteps inclusivenumberOfSteps
- the total number of steps. Must be greater than 0.public final boolean setProgress(long currentStep, long numberOfSteps)
setProgress(((double)currentStep)/numberOfSteps)
currentStep
- between 0 and numberOfSteps inclusivenumberOfSteps
- the total number of steps. Must be greater than 0.public final boolean setIndeterminateProgress()
public final boolean setMessage(java.lang.String message)
message
- a user visible message. If this is null, it will be automatically replaced with an empty string.public final boolean setImage(java.awt.Image image)
image
- an imagepublic void addFeedbackAction(java.lang.String label, SimpleListener listener)
addFeedbackAction(label,"",listener)
public void addFeedbackAction(java.lang.String label, java.lang.String description, SimpleListener listener)
listener
will
never be fired.label
- a label describing this feedback action. For example, "Skip to next step"listener
- a listener to be notified when the user chooses to invoke
this actionpublic void removeFeedbackAction(java.lang.String label)
addFeedbackAction(String, jebl.util.SimpleListener)
.label
- The label used as a parameter to addFeedbackAction(String, jebl.util.SimpleListener)
public void setTitle(java.lang.String title)
title
- the title of a progress window (if any). Must not be null.public abstract boolean isCanceled()
setProgress(double)
, setIndeterminateProgress()
and setMessage(java.lang.String)
to determine the return value of these methods.isCanceled
in interface Cancelable
http://code.google.com/p/jebl2/