Class ProgressView
java.lang.Object
org.springframework.shell.component.view.control.AbstractControl
org.springframework.shell.component.view.control.AbstractView
org.springframework.shell.component.view.control.BoxView
org.springframework.shell.component.view.control.ProgressView
ProgressView
is used to show a progress indicator.
Defaults to -
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Context forProgressView
cell components.static final record
Encapsulates a current running state of aProgressView
.static final record
ViewEvent
indicating that proggress has been ended.static class
Defines an item within a progress view.static final record
ViewEvent
indicating that proggress has been started.static final record
ViewEvent
indicating that proggress state has been changed.static final record
ViewEventArgs
for events usingProgressView.ProgressState
. -
Constructor Summary
ConstructorDescriptionConstruct view withtickStart 0
andtickEnd 100
.ProgressView
(int tickStart, int tickEnd) Construct view withtickStart 0
andtickEnd 100
.ProgressView
(int tickStart, int tickEnd, ProgressView.ProgressViewItem... items) Construct view with given bounds fortickStart
andtickEnd
.ProgressView
(ProgressView.ProgressViewItem... items) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
drawInternal
(Screen screen) Possibly draws a box around this view and title in a box top boundary.Gets a progress description.getState()
Gets a state of thisProgressView
.void
setDescription
(String description) Sets a progress description.void
setSpinner
(Spinner spinner) Sets an explicit spinner to use.void
setTickValue
(int value) Sets a tick value.void
start()
Starts a runtime logic.void
stop()
Stops a runtime logic.void
tickAdvance
(int count) AdvancetickValue
by a given count.Methods inherited from class org.springframework.shell.component.view.control.BoxView
drawBackground, getBackgroundStyle, getInnerRect, isShowBorder, setBackgroundColor, setBorderPadding, setFocusedTitleColor, setFocusedTitleStyle, setRect, setShowBorder, setTitle, setTitleAlign, setTitleColor, setTitleStyle
Methods inherited from class org.springframework.shell.component.view.control.AbstractView
destroy, dispatch, dispatchKeyRunCommand, dispatchMouseRunCommand, dispatchRunnable, draw, focus, getDrawFunction, getEventLoop, getHotKeyBindings, getHotKeyHandler, getKeyBindings, getKeyHandler, getLayer, getMouseBindings, getMouseHandler, getViewCommands, getViewService, hasFocus, init, initInternal, onDestroy, registerHotKeyBinding, registerHotKeyBinding, registerHotKeyBinding, registerKeyBinding, registerKeyBinding, registerKeyBinding, registerMouseBinding, registerMouseBinding, registerMouseBinding, registerViewCommand, runViewCommand, setDrawFunction, setEventLoop, setLayer, setViewService, shortcut
Methods inherited from class org.springframework.shell.component.view.control.AbstractControl
getRect, getThemeName, getThemeResolver, resolveThemeBackground, resolveThemeForeground, resolveThemeSpinner, resolveThemeStyle, setThemeName, setThemeResolver
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.shell.component.view.control.Control
getRect, setThemeName, setThemeResolver
-
Constructor Details
-
ProgressView
public ProgressView() -
ProgressView
public ProgressView(int tickStart, int tickEnd) - Parameters:
tickStart
- the tick starttickEnd
- the tick end
-
ProgressView
- Parameters:
items
- the progress view items
-
ProgressView
Construct view with given bounds fortickStart
andtickEnd
.tickStart
needs to be equal or more than zero.tickEnd
needs to be higher thantickStart
. Uses defined progress view items.- Parameters:
tickStart
- the tick starttickEnd
- the tick enditems
- the progress view items
-
-
Method Details
-
getDescription
Gets a progress description.- Returns:
- a progress description
-
setDescription
Sets a progress description. Used in items as a text item.- Parameters:
description
- the progress description
-
setSpinner
Sets an explicit spinner to use.- Parameters:
spinner
- the spinner to use
-
start
public void start()Starts a runtime logic. Call to already started progress has no effect. -
stop
public void stop()Stops a runtime logic. -
drawInternal
Description copied from class:BoxView
Possibly draws a box around this view and title in a box top boundary. Also calls adraw function
if defined.- Overrides:
drawInternal
in classBoxView
- Parameters:
screen
- the screen
-
tickAdvance
public void tickAdvance(int count) AdvancetickValue
by a given count. Note that negative count will advance backwards.- Parameters:
count
- the count to advance tick value
-
setTickValue
public void setTickValue(int value) Sets a tick value. If value is lower or higher thantickStart
ortickEnd
respectivelytickValue
will be set to low/high bounds. This meanstickValue
is always kept within range inclusively.- Parameters:
value
- the new tick value to set
-
getState
Gets a state of thisProgressView
.- Returns:
- a view progress state
-