|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjebl.util.ProgressListener
jebl.util.CompositeProgressListener
public final class CompositeProgressListener
A ProgressListener
that is suitable for a task that consists of several subtasks.
You specify the relative duration of each subtask, and then the subtasks' setProgress()
calls with values between 0 and 1 are translated to reflect the overall progress on the whole
(combined) task. In other words, each subtask reports progress as if it were the whole task,
and the CompositeProgressListener translates this into overall progress. This also implies
that calling setComplete()
or setProgress(1.0)
marks the current subtask rather than the entire task completed.
beginNextSubtask()
. Thus when the constructor is passed an array of N doubles as its second
argument, beginNextSubtask()
should be called precisely N-1 times.
Alternatively, instead of calling beginNextSubtask()
after each subtask (except the last),
you can instead call beginSubtask()
before each subtask (including the first).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class jebl.util.ProgressListener |
---|
ProgressListener.Wrapper |
Field Summary |
---|
Fields inherited from class jebl.util.ProgressListener |
---|
EMPTY |
Constructor Summary | |
---|---|
CompositeProgressListener(ProgressListener listener,
double... operationDuration)
construct a new composite ProgressListener. |
|
CompositeProgressListener(ProgressListener listener,
int numberOfEvenlyWeightedSubTasks)
Construct a CompositeProgressListener with a number of evenly weighted subtasks. |
Method Summary | |
---|---|
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. |
boolean |
addProgress(double fractionCompletedDiff)
Increments the progress of the current sub task by this much. |
void |
beginNextSubtask()
begins the next subtask. |
void |
beginNextSubtask(java.lang.String message)
Convenience method to start the next operation AND set a new message. |
void |
beginSubtask()
Used as an alternative to beginNextSubtask() . |
void |
beginSubtask(java.lang.String message)
Used as an alternative to beginNextSubtask() . |
void |
clearAllProgress()
Clear all progress, including that of previous subtasks. |
static CompositeProgressListener |
forFiles(ProgressListener listener,
java.util.List<java.io.File> files)
|
ProgressListener |
getRootProgressListener()
|
boolean |
hasNextSubtask()
|
boolean |
isCanceled()
This method must be implemented by all subclasses. |
void |
removeFeedbackAction(java.lang.String label)
Removes a feedback action previously added using ProgressListener.addFeedbackAction(String, jebl.util.SimpleListener) . |
boolean |
setComplete()
|
void |
setTitle(java.lang.String title)
Sets a title associated with whatever is being done. |
Methods inherited from class jebl.util.ProgressListener |
---|
setImage, setIndeterminateProgress, setMessage, setProgress, setProgress, setProgress |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompositeProgressListener(ProgressListener listener, double... operationDuration)
listener
- the ProgressListener that all progress reports are forwarded to after adjusting them for the currently active sub-taskoperationDuration
- a list of relative weightings to give each sub task.public CompositeProgressListener(ProgressListener listener, int numberOfEvenlyWeightedSubTasks)
listener
- the ProgressListener that all progress reports are forwarded to after adjusting them for the currently active sub-tasknumberOfEvenlyWeightedSubTasks
- the number of evenly weighted sub-tasks.Method Detail |
---|
public static CompositeProgressListener forFiles(ProgressListener listener, java.util.List<java.io.File> files)
public void beginSubtask()
beginNextSubtask()
.
Instead of calling beginNextSubtask()
once after each subtask
(except the last), you can instead call beginSubTask at the beginning
of every subtask including the first.
public void beginSubtask(java.lang.String message)
beginNextSubtask()
.
Instead of calling beginNextSubtask()
once after each subtask
(except the last), you can instead call beginSubTask at the beginning
of every subtask including the first.
message
- a message to be displayed to the user as a prefix in the progress messagepublic boolean isCanceled()
ProgressListener
ProgressListener.setProgress(double)
, ProgressListener.setIndeterminateProgress()
and ProgressListener.setMessage(java.lang.String)
to determine the return value of these methods.
isCanceled
in interface Cancelable
isCanceled
in class ProgressListener
public boolean addProgress(double fractionCompletedDiff)
ProgressListener.setProgress(double)
instead.
fractionCompletedDiff
- the amount ot increase the current progress by between 0 and 1.
public boolean hasNextSubtask()
public void clearAllProgress()
public void beginNextSubtask(java.lang.String message)
message
- message to set (will be passed to setMessage()public void beginNextSubtask()
beginSubtask()
instead.
public final boolean setComplete()
public ProgressListener getRootProgressListener()
ProgressListener
that this forwards adjusted progress reports to.public void addFeedbackAction(java.lang.String label, SimpleListener listener)
ProgressListener
addFeedbackAction(label,"",listener)
addFeedbackAction
in class ProgressListener
public void addFeedbackAction(java.lang.String label, java.lang.String description, SimpleListener listener)
ProgressListener
listener
will
never be fired.
addFeedbackAction
in class ProgressListener
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)
ProgressListener
ProgressListener.addFeedbackAction(String, jebl.util.SimpleListener)
.
removeFeedbackAction
in class ProgressListener
label
- The label used as a parameter to ProgressListener.addFeedbackAction(String, jebl.util.SimpleListener)
public void setTitle(java.lang.String title)
ProgressListener
setTitle
in class ProgressListener
title
- the title of a progress window (if any). Must not be null.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |