public final class ConsoleProgressBar extends Object implements ProgressBar
A progress bar typically communicates the progress of some work by displaying its percentage of completion and possibly a textual display of this percentage.
A progression bar has 2 modes of execution. Depending on the a priori knowledge of the total steps, we have a Determinate mode or an Indeterminate mode.
The terminal progression bar is constituted of 2 parts:
LM PB
< -- >< -------- >
0 [===== ]
1 [ ===== ]
2 [ ===== ]
3 [ ===== ]
4 [ ===== ]
5 [ =====]
6 [ ===== ]
7 [ ===== ]
...
LM PB < -- >< -------- > 0/10 [ ] 1/10 [= ] 2/10 [== ] 3/10 [=== ] 4/10 [==== ] 5/10 [===== ] 6/10 [====== ] 7/10 [======= ] 8/10 [======== ] 9/10 [========= ] 10/10 [==========]
| Modifier and Type | Class and Description |
|---|---|
static class |
ConsoleProgressBar.View |
| Constructor and Description |
|---|
ConsoleProgressBar(ConsoleProgressBar.View view) |
| Modifier and Type | Method and Description |
|---|---|
int |
getValue() |
void |
incrementValue() |
static ConsoleProgressBar |
indeterminate() |
static ConsoleProgressBar |
indeterminate(ConsoleProgressBar.View view) |
boolean |
isIndeterminate()
Return true if indeterminate
|
static ConsoleProgressBar |
newInstance(int maximum) |
static ConsoleProgressBar |
newInstance(int maximum,
ConsoleProgressBar.View view) |
static ConsoleProgressBar |
newInstance(int minimum,
int maximum) |
static ConsoleProgressBar |
newInstance(int minimum,
int maximum,
ConsoleProgressBar.View view) |
void |
setBarLength(int length)
Set the progress bar length.
|
void |
setDoneMessage(String message) |
void |
setIncompleteMessage(String message) |
void |
setIndeterminate(boolean bool)
Sets the indeterminate property of the progress bar which determines
whether the progress bar is in determinate or indeterminate mode.
|
void |
setLeftMarginLength(int length) |
void |
setMaximum(int maximum)
Sets the progress bar's minimum value to n
|
void |
setMaximumDoNoResetLeftMargin(int maximum) |
void |
setMinimum(int minimum)
Sets the progress bar's maximum value to n
|
void |
setPrintStream(PrintStream ps) |
void |
setRefreshBarPeriod(int period)
Set the period of bar animation refresh while the bar is in indeterminate
mode.
|
void |
setSegmentLength(int length)
Set the length of segment constantly animated in indeterminate mode.
|
void |
setTaskName(String name)
Set the task name (displayed in left margin)
|
void |
setValue(int completed)
Sets the progress bar's current value to n
|
void |
setView(ConsoleProgressBar.View view) |
void |
start()
Initialize progress bar (mandatory to restart bar in Indeterminate mode)
|
void |
stop()
Interrupt the task (mandatory to complete Inderminate mode)
|
public ConsoleProgressBar(ConsoleProgressBar.View view)
public static ConsoleProgressBar newInstance(int maximum)
public static ConsoleProgressBar newInstance(int maximum, ConsoleProgressBar.View view)
public static ConsoleProgressBar newInstance(int minimum, int maximum)
public static ConsoleProgressBar newInstance(int minimum, int maximum, ConsoleProgressBar.View view)
public static ConsoleProgressBar indeterminate()
public static ConsoleProgressBar indeterminate(ConsoleProgressBar.View view)
public void setView(ConsoleProgressBar.View view)
public void setTaskName(String name)
ProgressBarsetTaskName in interface ProgressBarpublic final void setMinimum(int minimum)
ProgressBarsetMinimum in interface ProgressBarpublic final void setMaximum(int maximum)
ProgressBarsetMaximum in interface ProgressBarpublic final void setMaximumDoNoResetLeftMargin(int maximum)
public void setLeftMarginLength(int length)
public void setBarLength(int length)
length - the given length.public void setRefreshBarPeriod(int period)
period - the period of refresh for cursor animation.public void setSegmentLength(int length)
length - the given length (> 0 and < bar len).public void setDoneMessage(String message)
public void setIncompleteMessage(String message)
public void setIndeterminate(boolean bool)
ProgressBarsetIndeterminate in interface ProgressBarpublic void start()
public void stop()
public void setValue(int completed)
ProgressBarsetValue in interface ProgressBarpublic void incrementValue()
public int getValue()
public final boolean isIndeterminate()
ProgressBarisIndeterminate in interface ProgressBarpublic void setPrintStream(PrintStream ps)
Copyright © 2016. All Rights Reserved.