This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 3.4.0! |
ProgressView
ProgressView is a base implementation providing functionality to draw a progress information. ProgressView inherits from BoxView.
ProgressView draws its content using concepts described below:
-
ProgressState contains various info about a runtime state
-
tickStart: Lower bound of tick value
-
tickEnd: Upper bound of tick value
-
tickValue: Current tick value
-
running: Running state, either true or false
-
startTime: Start time in millis when progress was started
-
updateTime: Last known time in millis when progress has updated
-
-
ProgressContext is a context used with ProgressViewItem
-
description: The description given to progress
-
state: The ProgressState
-
view: The owning ProgressView
-
spinner: The Spinner representation used with ProgressView
-
Other methods to help with item drawing
-
-
ProgressViewItem: is a representation of a cell used in ProgressView
There are few build-in items namely text
, spinner
and percent
.
Default ProgressView gives you text
, spinner
and percent
.
ProgressView view = new ProgressView();
view.start();
And looks like:
Customisation
Here are some examples for various customisations:
ProgressView view = new ProgressView(
ProgressViewItem.ofText(10, HorizontalAlign.LEFT),
ProgressViewItem.ofSpinner(3, HorizontalAlign.LEFT),
ProgressViewItem.ofPercent(0, HorizontalAlign.RIGHT));
view.start();
Align text
and spinner
to left and give them less space. Align percent
to right
and give it remaining space.
Events
Events are sent depending on a state of a progress.
Event | Description |
---|---|
ProgressViewStartEvent |
Progress tracking has started |
ProgressViewEndEvent |
Progress tracking has stopped |
ProgressViewStateChangeEvent |
Progress tracking state has changed |