io.github.kusoroadeolu.clique.components.ProgressBar .
Instances are obtained via builder() or fromPreset(ProgressBarPreset).
The DEFAULT constant is equivalent to ProgressBarPreset#BLOCKS.
The default values are:
40'█''░'":bar :percent% [:elapsed/:remaining]"MarkupParser#DEFAULTEasingConfiguration#DEFAULTThe format string controls how the bar is rendered. The following tokens are supported:
:bar — the filled/unfilled bar segment:progress — current tick, right-aligned to total width:total — the total tick count:percent — completion percentage, right-aligned to 3 characters:elapsed — elapsed time in mm:ss:remaining — estimated remaining time in mm:ss, or --:--Per-range format overrides can be registered via
ProgressBarConfigurationBuilder#styleWhen(Predicate, String) or
ProgressBarConfigurationBuilder#styleRange(int, int, String). When the current
completion percentage matches a registered predicate, its format is used in place of
the default. Predicates are evaluated in registration order; the first match wins.
This class is immutable and thread-safe. ProgressBarConfigurationBuilder is
not thread-safe; external synchronization is required if a builder instance
is shared across threads.
Example:
ProgressBarConfiguration config = ProgressBarConfiguration.builder()
.length(50)
.complete('=')
.incomplete('-')
.styleRange(0, 49, "[red]:bar :percent%[/]")
.styleRange(50, 99, "[yellow]:bar :percent%[/]")
.styleRange(100, 100, "[green]:bar :percent%[/]")
.build();
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private final char | |
| public static final ProgressBarConfiguration | DEFAULT
A default |
| private final EasingConfiguration | |
| private final String | |
| private final char | |
| private final int | |
| private final MarkupParser | |
| private final List | |
| private final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ProgressBarConfiguration. | Returns: a newProgressBarConfigurationBuilderReturns a new builder for constructing a |
| public boolean | equals(Object o)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public static ProgressBarConfiguration | |
| public static ProgressBarConfiguration. | Returns: a newProgressBarConfigurationBuilder seeded from the presetthe preset to derive initial values from; must not be preset)nullReturns a builder pre-populated with the values of the given preset. |
| public char | Returns: the completion characterReturns the character used to represent completed progress in the bar segment. |
| public EasingConfiguration | Returns: the easing configuration; nevernullReturns the easing configuration applied during animated ticks. |
| public String | Returns: the format string; nevernullReturns the default format string used when no style predicate matches. |
| public String | |
| public char | Returns: the incomplete characterReturns the character used to represent remaining progress in the bar segment. |
| public int | Returns: the bar length; always>= 0Returns the total character length of the bar segment rendered for |
| public MarkupParser | Returns: the parser; nevernullReturns the markup parser used to interpret inline style tags in the rendered output. |
| public int | Returns: the ticks-per-unit value; always>= 1Returns the number of ticks that represent one logical unit of progress. |
| public int | |
| public String |
| complete | back to summary |
|---|---|
| private final char complete | |
| DEFAULT | back to summary |
|---|---|
| public static final ProgressBarConfiguration DEFAULT A default | |
| easingConfiguration | back to summary |
|---|---|
| private final EasingConfiguration easingConfiguration | |
| format | back to summary |
|---|---|
| private final String format | |
| incomplete | back to summary |
|---|---|
| private final char incomplete | |
| length | back to summary |
|---|---|
| private final int length | |
| parser | back to summary |
|---|---|
| private final MarkupParser parser | |
| styles | back to summary |
|---|---|
| private final List<ProgressBarPredicate> styles | |
| ticksPerUnit | back to summary |
|---|---|
| private final int ticksPerUnit | |
| ProgressBarConfiguration | back to summary |
|---|---|
| private ProgressBarConfiguration(ProgressBarConfiguration. | |
| builder | back to summary |
|---|---|
| public static ProgressBarConfiguration. Returns a new builder for constructing a | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| fromEasing | back to summary |
|---|---|
public static ProgressBarConfiguration fromEasing(EasingConfiguration easing)
| |
| fromPreset | back to summary |
|---|---|
| public static ProgressBarConfiguration. Returns a builder pre-populated with the values of the given preset. The returned builder can be further customized before calling
| |
| getComplete | back to summary |
|---|---|
| public char getComplete() Returns the character used to represent completed progress in the bar segment.
| |
| getEasing | back to summary |
|---|---|
| public EasingConfiguration getEasing() Returns the easing configuration applied during animated ticks.
| |
| getFormat | back to summary |
|---|---|
| public String getFormat() Returns the default format string used when no style predicate matches. See the class-level documentation for the list of supported tokens.
| |
| getFormatForPercent | back to summary |
|---|---|
public String getFormatForPercent(int percent)
| |
| getIncomplete | back to summary |
|---|---|
| public char getIncomplete() Returns the character used to represent remaining progress in the bar segment.
| |
| getLength | back to summary |
|---|---|
| public int getLength() Returns the total character length of the bar segment rendered for
| |
| getParser | back to summary |
|---|---|
| public MarkupParser getParser() Returns the markup parser used to interpret inline style tags in the rendered output.
| |
| getTicksPerUnit | back to summary |
|---|---|
| public int getTicksPerUnit() Returns the number of ticks that represent one logical unit of progress. Used to compute the
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
ProgressBarConfiguration.
This builder is not thread-safe.
| Modifier and Type | Field and Description |
|---|---|
| private char | |
| private EasingConfiguration | |
| private String | |
| private static final String | |
| private char | |
| private int | |
| private MarkupParser | |
| private final List | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ProgressBarConfiguration | Returns: a newProgressBarConfigurationBuilds and returns a new |
| public ProgressBarConfiguration. | Returns: this builderthe completion character complete)Sets the character used to represent completed progress in the bar segment. |
| public ProgressBarConfiguration. | Returns: this builderthe easing configuration; must not be easing)nullSets the easing configuration applied during animated ticks. |
| public ProgressBarConfiguration. | |
| public ProgressBarConfiguration. | Returns: this builderthe incomplete character incomplete)Sets the character used to represent remaining progress in the bar segment. |
| public ProgressBarConfiguration. | Returns: this builderthe bar length; must be length)>= 0Sets the character length of the bar segment rendered for |
| public ProgressBarConfiguration. | Returns: this builderthe parser to use; must not be parser)nullSets the markup parser used to interpret inline style tags in progress bar |
| public ProgressBarConfiguration. | Returns: this builderthe lower bound of the percentage range; must be min, int >= 0the upper bound of the percentage range max, String the format string to use within this range; must not be format)nullRegisters a conditional format applied when the completion percentage falls within
|
| public ProgressBarConfiguration. | Returns: this builderthe style predicates to add; must not be formats)nullAdds a collection of |
| public ProgressBarConfiguration. | Returns: this buildera predicate over the completion percentage condition, String [0, 100]; must not be nullthe format string to use when the condition matches; must not be format)nullRegisters a conditional format that is applied when |
| public ProgressBarConfiguration. | Returns: this builderthe ticks-per-unit value; must be ticksPerUnit)>= 1Sets the number of ticks that represent one logical unit of progress. |
| complete | back to summary |
|---|---|
| private char complete | |
| easing | back to summary |
|---|---|
| private EasingConfiguration easing | |
| format | back to summary |
|---|---|
| private String format | |
| FORMAT_ERR_MESSAGE | back to summary |
|---|---|
| private static final String FORMAT_ERR_MESSAGE | |
| incomplete | back to summary |
|---|---|
| private char incomplete | |
| length | back to summary |
|---|---|
| private int length | |
| parser | back to summary |
|---|---|
| private MarkupParser parser | |
| styles | back to summary |
|---|---|
| private final List<ProgressBarPredicate> styles | |
| tickPerUnit | back to summary |
|---|---|
| private int tickPerUnit | |
| ProgressBarConfigurationBuilder | back to summary |
|---|---|
| public ProgressBarConfigurationBuilder() | |
| build | back to summary |
|---|---|
| public ProgressBarConfiguration build() Builds and returns a new
| |
| complete | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the character used to represent completed progress in the bar segment.
| |
| easing | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the easing configuration applied during animated ticks.
| |
| format | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the default format string used to render the progress bar. See
| |
| incomplete | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the character used to represent remaining progress in the bar segment.
| |
| length | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the character length of the bar segment rendered for
| |
| parser | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the markup parser used to interpret inline style tags in progress bar
| |
| styleRange | back to summary |
|---|---|
| public ProgressBarConfiguration. Registers a conditional format applied when the completion percentage falls within
Delegates to
| |
| styles | back to summary |
|---|---|
| public ProgressBarConfiguration. Adds a collection of Predicates are appended in iteration order and evaluated after any previously registered styles.
| |
| styleWhen | back to summary |
|---|---|
| public ProgressBarConfiguration. Registers a conditional format that is applied when Predicates are evaluated in registration order; the first match wins.
If no predicate matches, the default format set via
| |
| ticksPerUnit | back to summary |
|---|---|
| public ProgressBarConfiguration. Sets the number of ticks that represent one logical unit of progress. For example, if each tick represents one byte and you want to display
progress in kilobytes, set this to
| |