Class MenuBarView
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.MenuBarView
MenuBarView
shows items
horizontally and is
typically used in layouts which builds complete terminal UI's.
Internally MenuView
is used to show the menus.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
MenuBarView.MenuBarItem
represents an item in aMenuBarView
. -
Constructor Summary
ConstructorDescriptionMenuBarView
(MenuBarView.MenuBarItem[] items) Construct menubar view with menubar items. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
drawInternal
(Screen screen) Possibly draws a box around this view and title in a box top boundary.protected String
getItems()
Gets a menubar items.Handles keys by dispatching registered command runnable into an event loop.Handles mouse events by dispatching registered consumers into an event loop.protected void
Internal init method called fromAbstractView.init()
.static MenuBarView
of
(MenuBarView.MenuBarItem... items) Construct menubar view with menubar items.void
setItems
(List<MenuBarView.MenuBarItem> items) Sets items.void
setSelected
(int index) Sets a selected index.void
setThemeName
(String themeName) Sets a theme name to use.void
setThemeResolver
(ThemeResolver themeResolver) Sets aThemeResolver
.Methods inherited from class org.springframework.shell.component.view.control.BoxView
drawBackground, 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, getLayer, getMouseBindings, getViewCommands, getViewService, hasFocus, init, 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, resolveThemeStyle
-
Constructor Details
-
MenuBarView
Construct menubar view with menubar items.- Parameters:
items
- the menubar items
-
-
Method Details
-
of
Construct menubar view with menubar items.- Parameters:
items
- the menubar items
-
getBackgroundStyle
- Overrides:
getBackgroundStyle
in classBoxView
-
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
-
initInternal
protected void initInternal()Description copied from class:AbstractView
Internal init method called fromAbstractView.init()
. Override to do something usefull. Typically key and mousebindings are registered from this method.- Overrides:
initInternal
in classAbstractView
-
getKeyHandler
Description copied from class:AbstractView
Handles keys by dispatching registered command runnable into an event loop. Override to change default behaviour.- Specified by:
getKeyHandler
in interfaceView
- Overrides:
getKeyHandler
in classAbstractView
- Returns:
- a view key handler
- See Also:
-
getMouseHandler
Description copied from class:AbstractView
Handles mouse events by dispatching registered consumers into an event loop. Override to change default behaviour.- Specified by:
getMouseHandler
in interfaceView
- Overrides:
getMouseHandler
in classAbstractView
- Returns:
- a view mouse handler
- See Also:
-
getItems
Gets a menubar items.- Returns:
- menubar items
-
setSelected
public void setSelected(int index) Sets a selected index. If given index is not within bounds of size of items, selection is set to-1
effectively un-selecting active item.- Parameters:
index
- the new index
-
setThemeName
Description copied from class:AbstractControl
Sets a theme name to use.- Specified by:
setThemeName
in interfaceControl
- Overrides:
setThemeName
in classAbstractControl
- Parameters:
themeName
- the theme name
-
setThemeResolver
Description copied from class:AbstractControl
Sets aThemeResolver
.- Specified by:
setThemeResolver
in interfaceControl
- Overrides:
setThemeResolver
in classAbstractControl
- Parameters:
themeResolver
- the theme resolver
-
setItems
Sets items.- Parameters:
items
- status items
-