Package com.tonic.vellum.widget
Class ProgressBar
- java.lang.Object
-
- com.tonic.vellum.Section
-
- com.tonic.vellum.widget.SingleRowSection
-
- com.tonic.vellum.widget.ProgressBar
-
public final class ProgressBar extends SingleRowSection
A horizontal progress bar over the range 0 to 1, drawn with block glyphs and an optional centered percentage.
-
-
Constructor Summary
Constructors Constructor Description ProgressBar()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProgressBaremptyStyle(Style style)Sets the style of the empty portion.ProgressBarfilledStyle(Style style)Sets the style of the filled portion.ProgressBarprogress(int current, int max)Sets progress as a ratio of current to max; a non-positive max yields zero progress.ProgressBarshowPercent(boolean show)Sets whether the centered percentage is shown.doublevalue()ProgressBarvalue(double value)Sets progress as a fraction, clamped to the range [0, 1].
-
-
-
Method Detail
-
value
public ProgressBar value(double value)
Sets progress as a fraction, clamped to the range [0, 1].- Parameters:
value- the progress fraction- Returns:
- this ProgressBar for chaining
-
progress
public ProgressBar progress(int current, int max)
Sets progress as a ratio of current to max; a non-positive max yields zero progress.- Parameters:
current- the current amountmax- the maximum amount- Returns:
- this ProgressBar for chaining
-
showPercent
public ProgressBar showPercent(boolean show)
Sets whether the centered percentage is shown.- Parameters:
show-trueto overlay the percentage- Returns:
- this ProgressBar for chaining
-
filledStyle
public ProgressBar filledStyle(Style style)
Sets the style of the filled portion.- Parameters:
style- the filled style- Returns:
- this ProgressBar for chaining
-
emptyStyle
public ProgressBar emptyStyle(Style style)
Sets the style of the empty portion.- Parameters:
style- the empty style- Returns:
- this ProgressBar for chaining
-
value
public double value()
- Returns:
- the progress fraction in the range [0, 1]
-
-