Package io.jmix.flowui.menu
Class MenuItem
java.lang.Object
io.jmix.flowui.menu.MenuItem
Main menu item descriptor.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a parameter associated with a menu item, consisting of a name and a value.static classRepresents a property of aMenuItemwithin a menu configuration. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected Stringprotected org.dom4j.Elementprotected com.vaadin.flow.component.Componentprotected Stringprotected Stringprotected booleanprotected booleanprotected MenuItemprotected List<MenuItem.MenuItemProperty>protected List<MenuItem.MenuItemParameter>protected booleanprotected KeyCombinationprotected Stringprotected List<MenuItem.MenuItemParameter>protected Stringprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBean()Returns the bean name associated with this menu item.Returns the bean method name associated with this menu item.Children itemsReturns the CSS class names associated with this menu item.org.dom4j.ElementReturns the descriptor of this menu item.getIcon()Deprecated, for removal: This API element is subject to removal in a future version.com.vaadin.flow.component.ComponentgetId()Menu item ID as defined inmenu-config.xmlParent item.Returns the list of properties associated with this menu item.Returns the list of route parameters associated with this menu item.Returns the keyboard shortcut combination associated with this menu item.getTitle()Returns the list of URL query parameters associated with this menu item.getView()Returns the view id associated with this menu item.booleanisMenu()Returns whether the menu item represents a menu that contains other menu items.booleanisOpened()Returns whether this menu item is currently in an expanded (opened) state.booleanReturns whether the menu item is a separator.booleanReturns whether this menu item is visible.voidSets the bean name associated with this menu item.voidsetBeanMethod(String beanMethod) Sets the bean method name associated with this menu item.voidsetClassNames(String classNames) Sets the CSS class names associated with this menu item.voidsetDescription(String description) Sets the givendescriptionto menu item.voidsetDescriptor(org.dom4j.Element descriptor) Sets the descriptor of this menu item.voidDeprecated, for removal: This API element is subject to removal in a future version.usesetIconComponent(Component)insteadvoidsetIconComponent(com.vaadin.flow.component.Component icon) voidsetMenu(boolean isMenu) Sets whether this menu item represents a menu that contains other menu items.voidsetOpened(boolean expanded) Sets whether this menu item is currently in an expanded (opened) state.voidsetProperties(List<MenuItem.MenuItemProperty> properties) Sets the list of properties associated with this menu item.voidsetRouteParameters(List<MenuItem.MenuItemParameter> routeParameters) Sets the list of route parameters associated with this menu item.voidsetSeparator(boolean separator) Sets whether this menu item is a separator.voidsetShortcutCombination(KeyCombination shortcutCombination) Sets the keyboard shortcut combination associated with this menu item.voidSets the givencaptionto menu item.voidsetUrlQueryParameters(List<MenuItem.MenuItemParameter> urlQueryParameters) Sets the list of URL query parameters associated with this menu item.voidSets the view ID associated with this menu item.voidsetVisible(boolean visible) Sets whether this menu item is visible.
-
Field Details
-
parent
-
children
-
id
-
view
-
bean
-
beanMethod
-
classNames
-
icon
protected com.vaadin.flow.component.Component icon -
iconName
-
title
-
description
-
descriptor
protected org.dom4j.Element descriptor -
separator
protected boolean separator -
opened
protected boolean opened -
visible
protected boolean visible -
shortcutCombination
-
isMenu
protected boolean isMenu -
properties
-
urlQueryParameters
-
routeParameters
-
-
Constructor Details
-
MenuItem
-
Method Details
-
isMenu
public boolean isMenu()Returns whether the menu item represents a menu that contains other menu items.- Returns:
trueif the menu item is a menu;falseotherwise.
-
setMenu
public void setMenu(boolean isMenu) Sets whether this menu item represents a menu that contains other menu items.- Parameters:
isMenu-trueif the menu item is a menu;falseotherwise
-
getParent
Parent item. Null if this is root item. -
getChildren
Children items -
getId
Menu item ID as defined inmenu-config.xml -
getDescriptor
public org.dom4j.Element getDescriptor()Returns the descriptor of this menu item.- Returns:
- the
Elementrepresenting the descriptor
-
setDescriptor
public void setDescriptor(org.dom4j.Element descriptor) Sets the descriptor of this menu item.- Parameters:
descriptor- theElementrepresenting the descriptor
-
getTitle
- Returns:
- a raw string from menu XML config, can be a reference to localization message, e.g.
mainMsg://menuitem.title - See Also:
-
setTitle
Sets the givencaptionto menu item.- Parameters:
caption- menu item caption- See Also:
-
getDescription
- Returns:
- a raw string from menu XML config, can be a reference to localization message, e.g.
mainMsg://menuitem.description
-
setDescription
Sets the givendescriptionto menu item.- Parameters:
description- menu item description
-
getClassNames
Returns the CSS class names associated with this menu item.- Returns:
- a string containing the CSS class names
-
setClassNames
Sets the CSS class names associated with this menu item.- Parameters:
classNames- a string containing the CSS class names to be set for this menu item
-
getShortcutCombination
Returns the keyboard shortcut combination associated with this menu item.- Returns:
- the
KeyCombinationrepresenting the shortcut combination, ornullif no shortcut is defined
-
setShortcutCombination
Sets the keyboard shortcut combination associated with this menu item.- Parameters:
shortcutCombination- theKeyCombinationrepresenting the shortcut combination, ornullif no shortcut is to be defined
-
isSeparator
public boolean isSeparator()Returns whether the menu item is a separator.- Returns:
trueif the menu item is a separator;falseotherwise.
-
setSeparator
public void setSeparator(boolean separator) Sets whether this menu item is a separator.- Parameters:
separator-trueif the menu item is a separator;falseotherwise
-
getIcon
Deprecated, for removal: This API element is subject to removal in a future version.usegetIconComponent()insteadReturns the icon associated with this menu item.- Returns:
- the icon as a string, or
nullif no icon is associated
-
setIcon
Deprecated, for removal: This API element is subject to removal in a future version.usesetIconComponent(Component)insteadSets the icon associated with this menu item.- Parameters:
iconName- the icon to associate with the menu item, ornullif no icon is to be set
-
getIconComponent
@Nullable public com.vaadin.flow.component.Component getIconComponent() -
setIconComponent
public void setIconComponent(@Nullable com.vaadin.flow.component.Component icon) -
isOpened
public boolean isOpened()Returns whether this menu item is currently in an expanded (opened) state.- Returns:
trueif the menu item is opened;falseotherwise.
-
setOpened
public void setOpened(boolean expanded) Sets whether this menu item is currently in an expanded (opened) state.- Parameters:
expanded-trueif the menu item is to be opened;falseotherwise
-
isVisible
public boolean isVisible()Returns whether this menu item is visible.- Returns:
trueif the menu item is visible;falseotherwise
-
setVisible
public void setVisible(boolean visible) Sets whether this menu item is visible.- Parameters:
visible-trueif the menu item is to be visible;falseotherwise
-
getView
Returns the view id associated with this menu item.- Returns:
- the view id, or
nullif no view is associated
-
setView
Sets the view ID associated with this menu item.- Parameters:
view- the view ID to associate with this menu item, ornullif no view is to be associated
-
getBean
Returns the bean name associated with this menu item.- Returns:
- the bean name, or
nullif no bean is associated
-
setBean
Sets the bean name associated with this menu item.- Parameters:
bean- the bean name to associate with this menu item, ornullif no bean is to be associated
-
getBeanMethod
Returns the bean method name associated with this menu item.- Returns:
- the bean method name, or
nullif no bean method is associated
-
setBeanMethod
Sets the bean method name associated with this menu item.- Parameters:
beanMethod- the bean method name to associate with this menu item, ornullif no bean method is to be associated
-
getProperties
Returns the list of properties associated with this menu item.- Returns:
- the list of
MenuItem.MenuItemPropertyobjects
-
setProperties
Sets the list of properties associated with this menu item.- Parameters:
properties- the list ofMenuItem.MenuItemPropertyobjects to associate with this menu item, ornullif no properties are to be set
-
getUrlQueryParameters
Returns the list of URL query parameters associated with this menu item. If no parameters are associated, an empty list is returned.- Returns:
- a list of
MenuItem.MenuItemParameterobjects representing the URL query parameters
-
setUrlQueryParameters
Sets the list of URL query parameters associated with this menu item.- Parameters:
urlQueryParameters- a list ofMenuItem.MenuItemParameterobjects representing the URL query parameters to associate with this menu item
-
getRouteParameters
Returns the list of route parameters associated with this menu item. If no parameters are associated, an empty list is returned.- Returns:
- a list of
MenuItem.MenuItemParameterobjects representing the route parameters
-
setRouteParameters
Sets the list of route parameters associated with this menu item.- Parameters:
routeParameters- a list ofMenuItem.MenuItemParameterobjects representing the route parameters to associate with this menu item
-
getIconComponent()instead