|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectProgressPrinter
public class ProgressPrinter
Prints progress report of a lengtly operation to an output stream. Progress are reported as percentage on a single line. This class can also prints warning, which is useful for notifications without stoping the lenghtly task.
Constructor Summary | |
---|---|
ProgressPrinter()
Constructs a new object sending progress reports to the standard output stream. |
|
ProgressPrinter(PrintWriter out)
Constructs a new object sending progress reports to the specified stream. |
|
ProgressPrinter(PrintWriter out,
int maxLength)
Constructs a new object sending progress reports to the specified stream. |
Method Summary | |
---|---|
void |
complete()
Notifies this listener that the operation has finished. |
void |
dispose()
Releases any resource hold by this object. |
void |
exceptionOccurred(Throwable exception)
Prints an exception stack trace in a box. |
String |
getDescription()
|
float |
getProgress()
Returns the current progress as a percent completed. |
InternationalString |
getTask()
|
boolean |
isCanceled()
|
void |
progress(float percent)
|
void |
setCanceled(boolean canceled)
|
void |
setDescription(String description)
|
void |
setTask(InternationalString task)
|
void |
started()
|
void |
warningOccurred(String source,
String margin,
String warning)
Prints a warning. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProgressPrinter()
public ProgressPrinter(PrintWriter out)
public ProgressPrinter(PrintWriter out, int maxLength)
out
- The output stream.maxLength
- The maximal line length. This is used by warningOccurred(java.lang.String, java.lang.String, java.lang.String)
for splitting longer lines into many lines.Method Detail |
---|
public String getDescription()
getDescription
in interface ProgressListener
public void setDescription(String description)
setDescription
in interface ProgressListener
public void started()
started
in interface ProgressListener
public void progress(float percent)
progress
in interface ProgressListener
public float getProgress()
getProgress
in interface ProgressListener
public void complete()
complete
in interface ProgressListener
public void dispose()
dispose
in interface ProgressListener
public boolean isCanceled()
isCanceled
in interface ProgressListener
public void setCanceled(boolean canceled)
setCanceled
in interface ProgressListener
public void warningOccurred(String source, String margin, String warning)
warningOccurred
in interface ProgressListener
source
- The source of the warning, or null
if none. This is typically the
filename in process of being parsed.margin
- Text to write on the left side of the warning message, or null
if none.
This is typically the line number where the error occured in the source
file.warning
- The warning message. If this string is longer than the maximal length
specified at construction time (80 characters by default), then it will be splitted
in as many lines as needed and indented according the marging width.public void exceptionOccurred(Throwable exception)
exceptionOccurred
in interface ProgressListener
public void setTask(InternationalString task)
setTask
in interface ProgressListener
public InternationalString getTask()
getTask
in interface ProgressListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |