|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.ChainedProgressReporter
public class ChainedProgressReporter
An implementation of the ProgressReporter interface that chains to another progress reporter while recalculating the percentage values. This class is useful when you call several methods in a row that each of them outputs progress messages between 0 and 100 percent. Use this progress reporter to change the scale so that the first method output values between 0 and 20, the next between 20 and 50, and so on.
Field Summary | |
---|---|
private int |
end
|
private ProgressReporter |
master
|
private float |
scale
|
private int |
start
|
Constructor Summary | |
---|---|
ChainedProgressReporter(ProgressReporter master)
Create a new chained progress reporter. |
Method Summary | |
---|---|
void |
append(String message)
Append a message to the previous one. |
void |
display(int percent,
String message)
Display a progress message. |
void |
setRange(int start,
int end)
Set the range to use for the percentage values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final ProgressReporter master
private int start
private int end
private float scale
Constructor Detail |
---|
public ChainedProgressReporter(ProgressReporter master)
master
- The master progress reportersetRange(int, int)
Method Detail |
---|
public void display(int percent, String message)
ProgressReporter
display
in interface ProgressReporter
percent
- How many percent of the task that is completed
or -1 if not knownmessage
- A message, or nullpublic void append(String message)
ProgressReporter
append
in interface ProgressReporter
message
- The messagepublic void setRange(int start, int end)
display(int, String)
method is invoked the percentage
value is recalculated to be within the specified range before the
master progress reporter is invoked.
Ie. 0 --> start
and 100 --> end
.
start
- Start valueend
- End value.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |