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
ConstructorsModifierConstructorDescriptionConstruct menu item with a title.protectedMenuItem(String title, List<MenuView.MenuItem> items) protectedMenuItem(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.booleanGets initial check state.static MenuView.MenuItemReturn aMenuView.MenuItemwith a giventitle.static MenuView.MenuItemof(String title, MenuView.MenuItemCheckStyle checkStyle) static MenuView.MenuItemof(String title, MenuView.MenuItemCheckStyle checkStyle, Runnable action) static MenuView.MenuItemof(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.MenuItemwith 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 benullif constructed viaMenuView.Menuas style doesn't apply items being a sub-menu.- Returns:
- a check style
-
getItems
Gets sub menu items. This will benullif not constructed viaMenuView.Menuas plainMenuView.MenuItemcan't have other items.- Returns:
- a menu items
-