Class MenuView
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.MenuView
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMenuView.Menurepresents an item in aMenuViewbeing a specialisation ofMenuView.MenuItemindicating it having a sub-menu.static classMenuView.MenuItemrepresents an item in aMenuView.static enumSpecifies how aMenuView.MenuItemshows selection state.static final recordstatic final recordViewEventindicating that selected item has been requested to open.static final recordViewEventindicating that selected item has changed. -
Constructor Summary
ConstructorsConstructorDescriptionMenuView()Construct menu view with no initial menu items.MenuView(List<MenuView.MenuItem> items) Construct menu view with menu items.MenuView(MenuView.MenuItem[] items) Construct menu view with menu items. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrawInternal(Screen screen) Possibly draws a box around this view and title in a box top boundary.getItems()Gets a menu items.Gets a preferred dimension menu needs to show it's content.protected voidInternal init method called fromAbstractView.init().voidsetItems(List<MenuView.MenuItem> items) Sets a new menu items.voidtoggle(MenuView.MenuItem item) ToggleMenuView.MenuItemchecked state.Methods inherited from class org.springframework.shell.component.view.control.BoxView
drawBackground, getBackgroundStyle, getInnerRect, isShowBorder, setBackgroundColor, setBorderPadding, setFocusedTitleColor, setFocusedTitleStyle, setRect, setShowBorder, setTitle, setTitleAlign, setTitleColor, setTitleStyleMethods 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, onDestroy, registerHotKeyBinding, registerHotKeyBinding, registerHotKeyBinding, registerKeyBinding, registerKeyBinding, registerKeyBinding, registerMouseBinding, registerMouseBinding, registerMouseBinding, registerViewCommand, runViewCommand, setDrawFunction, setEventLoop, setLayer, setViewService, shortcutMethods inherited from class org.springframework.shell.component.view.control.AbstractControl
getRect, getThemeName, getThemeResolver, resolveThemeBackground, resolveThemeForeground, resolveThemeSpinner, resolveThemeStyle, setThemeName, setThemeResolverMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.shell.component.view.control.Control
getRect, setThemeName, setThemeResolver
-
Constructor Details
-
MenuView
public MenuView()Construct menu view with no initial menu items. -
MenuView
Construct menu view with menu items.- Parameters:
items- the menu items
-
MenuView
Construct menu view with menu items.- Parameters:
items- the menu items
-
-
Method Details
-
setItems
Sets a new menu items. Will always clear existing items and ifnullis passed this effectively keeps items empty.- Parameters:
items- the menu items
-
getItems
Gets a menu items.- Returns:
- the menu items
-
getPreferredDimension
Gets a preferred dimension menu needs to show it's content.- Returns:
- preferred dimension
-
drawInternal
Description copied from class:BoxViewPossibly draws a box around this view and title in a box top boundary. Also calls adraw functionif defined.- Overrides:
drawInternalin classBoxView- Parameters:
screen- the screen
-
initInternal
protected void initInternal()Description copied from class:AbstractViewInternal init method called fromAbstractView.init(). Override to do something usefull. Typically key and mousebindings are registered from this method.- Overrides:
initInternalin classAbstractView
-
toggle
ToggleMenuView.MenuItemchecked state.- Parameters:
item- the menu item to toggle
-