Class MenuView.MenuItem
java.lang.Object
org.springframework.shell.component.view.control.MenuView.MenuItem
- Direct Known Subclasses:
MenuView.Menu
- Enclosing class:
- MenuView
MenuView.MenuItem
represents an item in a MenuView
.- See Also:
-
Constructor Summary
ModifierConstructorDescriptionConstruct menu item with a title.protected
MenuItem
(String title, List<MenuView.MenuItem> items) protected
MenuItem
(String title, MenuView.MenuItem[] items) MenuItem
(String title, MenuView.MenuItemCheckStyle checkStyle) Construct menu item with a title and a check style.MenuItem
(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action) Construct menu item with a title, a check style and a runnable.MenuItem
(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action, boolean initialCheckState) Construct menu item with a title, a check style, a runnable and initial checked state. -
Method Summary
Modifier and TypeMethodDescriptionGets a check style.getItems()
Gets sub menu items.getTitle()
Get atitle
.boolean
Gets initial check state.static MenuView.MenuItem
Return aMenuView.MenuItem
with a giventitle
.static MenuView.MenuItem
of
(String title, MenuView.MenuItemCheckStyle checkStyle) static MenuView.MenuItem
of
(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action) static MenuView.MenuItem
of
(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action, boolean initialCheckState) void
-
Constructor Details
-
MenuItem
Construct menu item with a title.- Parameters:
title
- the title
-
MenuItem
Construct menu item with a title and a check style.- Parameters:
title
- the titlecheckStyle
- the check style
-
MenuItem
Construct menu item with a title, a check style and a runnable.- Parameters:
title
- the titlecheckStyle
- the check styleaction
- the action to run when item is chosen
-
MenuItem
public MenuItem(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action, boolean initialCheckState) Construct menu item with a title, a check style, a runnable and initial checked state.- Parameters:
title
- the titlecheckStyle
- the check styleaction
- the action to run when item is choseninitialCheckState
- initial checked state
-
MenuItem
-
MenuItem
-
-
Method Details
-
of
Return aMenuView.MenuItem
with a giventitle
.- Parameters:
title
- the title- Returns:
- a menu item
-
of
- Parameters:
title
- the titlecheckStyle
- the check style- Returns:
- a menu item
-
of
public static MenuView.MenuItem of(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action) -
of
public static MenuView.MenuItem of(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action, boolean initialCheckState) -
getAction
-
setAction
-
isInitialCheckState
public boolean isInitialCheckState()Gets initial check state.- Returns:
- initial check state
-
getTitle
Get atitle
. Never null, empty or just having white spaces.- Returns:
- a title
-
getCheckStyle
Gets a check style. This will benull
if constructed viaMenuView.Menu
as style doesn't apply items being a sub-menu.- Returns:
- a check style
-
getItems
Gets sub menu items. This will benull
if not constructed viaMenuView.Menu
as plainMenuView.MenuItem
can't have other items.- Returns:
- a menu items
-