Class ListMenu.MenuItem
java.lang.Object
io.jmix.flowui.kit.component.main.ListMenu.MenuItem
- All Implemented Interfaces:
MenuItem
- Direct Known Subclasses:
JmixListMenu.BeanMenuItem,JmixListMenu.ViewMenuItem,ListMenu.MenuBarItem,ListMenu.MenuSeparatorItem
- Enclosing class:
- ListMenu
Describes menu item.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Consumer<ListMenu.MenuItem>protected Stringprotected com.vaadin.flow.component.icon.VaadinIconprotected Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected ListMenuprotected Consumer<ListMenu.ListMenuBarOpenedChangeEvent>protected com.vaadin.flow.component.Componentprotected PropertyChangeSupportprotected KeyCombinationprotected com.vaadin.flow.component.Componentprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassNames(String... classNames) Adds class names that should be added to the menu item.protected voidstatic ListMenu.MenuItemCreates menu item with provided id.static ListMenu.MenuBarItemcreateMenuBar(String id) Creates menu bar that can contains other menu items.booleancom.vaadin.flow.component.icon.VaadinIcongetIcon()Deprecated, for removal: This API element is subject to removal in a future version.getId()com.vaadin.flow.component.Componentcom.vaadin.flow.component.ComponentgetTitle()inthashCode()booleanbooleanisMenu()booleanprotected voidprotected voidsetMenuComponent(ListMenu menu) voidsetPrefixComponent(com.vaadin.flow.component.Component prefixComponent) Sets prefix component of the item.voidsetSuffixComponent(com.vaadin.flow.component.Component suffixComponent) Sets suffix component of the item.toString()withClassNames(List<String> classNames) Sets class names that should be added to the menu item.withClickHandler(Consumer<ListMenu.MenuItem> clickHandler) withDescription(String description) Sets menu item description that should be shown when the user moves cursor on item.withIcon(com.vaadin.flow.component.icon.VaadinIcon icon) Deprecated, for removal: This API element is subject to removal in a future version.withOpenedChangeHandler(Consumer<ListMenu.ListMenuBarOpenedChangeEvent> openedChangeHandler) withPrefixComponent(com.vaadin.flow.component.Component prefixComponent) Sets prefix component of the item.withShortcutCombination(KeyCombination shortcutCombination) withSuffixComponent(com.vaadin.flow.component.Component suffixComponent) Sets suffix component of the item.Sets displayed menu item text.
-
Field Details
-
MENU_ITEM_CLASS_NAME
- See Also:
-
MENU_ITEM_PREFIX_COMPONENT
- See Also:
-
MENU_ITEM_SUFFIX_COMPONENT
- See Also:
-
id
-
title
-
description
-
icon
protected com.vaadin.flow.component.icon.VaadinIcon icon -
classNames
-
clickHandler
-
openedChangeHandler
-
shortcutCombination
-
prefixComponent
protected com.vaadin.flow.component.Component prefixComponent -
suffixComponent
protected com.vaadin.flow.component.Component suffixComponent -
propertyChangeSupport
-
-
Constructor Details
-
MenuItem
-
-
Method Details
-
create
Creates menu item with provided id.- Parameters:
id- menu item id- Returns:
- menu item
-
createMenuBar
Creates menu bar that can contains other menu items.- Parameters:
id- menu item id- Returns:
- menu bar
-
getId
-
getTitle
-
withTitle
Sets displayed menu item text.- Parameters:
title- displayed text- Returns:
- current menu instance
-
getDescription
- Returns:
- menu item description or
nullif not set.
-
withDescription
Sets menu item description that should be shown when the user moves cursor on item.- Parameters:
description- description to set- Returns:
- current menu instance
-
getIcon
@Nullable @Deprecated(since="2.2", forRemoval=true) public com.vaadin.flow.component.icon.VaadinIcon getIcon()Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- icon or
nullif not set
-
withIcon
@Deprecated(since="2.2", forRemoval=true) public ListMenu.MenuItem withIcon(@Nullable com.vaadin.flow.component.icon.VaadinIcon icon) Deprecated, for removal: This API element is subject to removal in a future version.Sets icon that should be displayed to the left of thegetTitle().- Parameters:
icon- icon to set- Returns:
- current menu instance
-
getClassNames
- Returns:
- class names or empty list
-
withClassNames
Sets class names that should be added to the menu item.- Parameters:
classNames- class names to add- Returns:
- current menu instance
-
addClassNames
Adds class names that should be added to the menu item.- Parameters:
classNames- class names to add
-
getClickHandler
-
withClickHandler
-
getOpenedChangeHandler
-
withOpenedChangeHandler
public ListMenu.MenuItem withOpenedChangeHandler(@Nullable Consumer<ListMenu.ListMenuBarOpenedChangeEvent> openedChangeHandler) -
getShortcutCombination
-
withShortcutCombination
-
getSuffixComponent
@Nullable public com.vaadin.flow.component.Component getSuffixComponent()- Returns:
- suffix component of the item
-
withSuffixComponent
public ListMenu.MenuItem withSuffixComponent(@Nullable com.vaadin.flow.component.Component suffixComponent) Sets suffix component of the item.- Parameters:
suffixComponent- component to set- Returns:
- current menu item instance
-
setSuffixComponent
public void setSuffixComponent(@Nullable com.vaadin.flow.component.Component suffixComponent) Sets suffix component of the item.- Parameters:
suffixComponent- component to set
-
getPrefixComponent
public com.vaadin.flow.component.Component getPrefixComponent()- Returns:
- prefix component of the item
-
withPrefixComponent
Sets prefix component of the item.- Parameters:
prefixComponent- component to set- Returns:
- current menu item instance
-
setPrefixComponent
public void setPrefixComponent(com.vaadin.flow.component.Component prefixComponent) Sets prefix component of the item.- Parameters:
prefixComponent- component to set
-
isMenu
public boolean isMenu()- Returns:
trueif menu item isListMenu.MenuBarItemthat contains other items,falseotherwise
-
isSeparator
public boolean isSeparator() -
getMenuComponent
- Returns:
- menu component that contains given menu item
-
setMenuComponent
-
isAttachedToMenu
public boolean isAttachedToMenu()- Returns:
trueif menu item is attached to the menu component,falseotherwise
-
equals
-
addPropertyChangeListener
-
removePropertyChangeListener
-
hashCode
public int hashCode() -
toString
-
getPrefixComponent()