Package io.jmix.ui.component.mainwindow
Interface SideMenu.MenuItem
- All Known Implementing Classes:
SideMenuImpl.MenuItemImpl
- Enclosing interface:
- SideMenu
public static interface SideMenu.MenuItem
Menu item
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddChildItem(SideMenu.MenuItem menuItem) Add menu item to the end of children list.voidaddChildItem(SideMenu.MenuItem menuItem, int index) Add menu item to specified position in the children list.voidaddStyleName(String styleName) Adds one or more style names to this component.getIcon()getId()getMenu()booleanbooleanbooleanbooleanvoidRemove all child items from the children list.voidremoveChildItem(int index) Remove menu item from the children list by index.voidremoveChildItem(SideMenu.MenuItem menuItem) Remove menu item from the children list.voidremoveStyleName(String styleName) Removes one or more style names from component.voidsetBadgeText(String badgeText) Set badge text for item.voidsetCaption(String caption) Set item caption.voidsetCaptionAsHtml(boolean captionAsHtml) Enable or disable HTML mode for caption.voidsetCommand(Consumer<SideMenu.MenuItem> command) Set item commandvoidsetDescription(String description) Set description.voidsetExpanded(boolean expanded) Expand or collapse sub menu with children by default.voidSet icon.voidsetStyleName(String styleName) Sets one or more user-defined style names of the component, replacing any previous user-defined styles.voidsetVisible(boolean visible) Show or hide item.
-
Method Details
-
getId
String getId()- Returns:
- id
-
getMenu
SideMenu getMenu()- Returns:
- owner
-
getCaption
- Returns:
- caption
-
setCaption
Set item caption.- Parameters:
caption- caption
-
getDescription
- Returns:
- description
-
setDescription
Set description.- Parameters:
description- description
-
getIcon
- Returns:
- icon name
-
setIcon
Set icon.- Parameters:
icon- icon name
-
isCaptionAsHtml
boolean isCaptionAsHtml()- Returns:
- true if caption is inserted to DOM as HTML
-
setCaptionAsHtml
void setCaptionAsHtml(boolean captionAsHtml) Enable or disable HTML mode for caption.- Parameters:
captionAsHtml- pass true to enable HTML mode for caption.
-
isVisible
boolean isVisible()- Returns:
- true if item will be sent to the client side
-
setVisible
void setVisible(boolean visible) Show or hide item.- Parameters:
visible- pass false to hide menu item
-
isExpanded
boolean isExpanded()- Returns:
- true if sub menu with children will be initially expanded
-
setExpanded
void setExpanded(boolean expanded) Expand or collapse sub menu with children by default.- Parameters:
expanded- pass true to set sub menu expanded by default.
-
getStyleName
String getStyleName()- Returns:
- all user-defined CSS style names of a component. If the item has multiple style names defined, the return string is a space-separated list of style names.
-
setStyleName
Sets one or more user-defined style names of the component, replacing any previous user-defined styles. Multiple styles can be specified as a space-separated list of style names. The style names must be valid CSS class names.- Parameters:
styleName- style name string
-
addStyleName
Adds one or more style names to this component. Multiple styles can be specified as a space-separated list of style names. The style name will be rendered as a HTML class name, which can be used in a CSS definition.- Parameters:
styleName- style name string
-
removeStyleName
Removes one or more style names from component. Multiple styles can be specified as a space-separated list of style names.- Parameters:
styleName- style name string
-
getBadgeText
- Returns:
- badge text
-
setBadgeText
Set badge text for item. Badges are shown as small widget on the right side of menu items.- Parameters:
badgeText- badge text
-
getCommand
- Returns:
- item command
-
setCommand
Set item command- Parameters:
command- item command
-
addChildItem
Add menu item to the end of children list.- Parameters:
menuItem- menu item
-
addChildItem
Add menu item to specified position in the children list.- Parameters:
menuItem- menu itemindex- target index
-
removeChildItem
Remove menu item from the children list.- Parameters:
menuItem- menu item
-
removeChildItem
void removeChildItem(int index) Remove menu item from the children list by index.- Parameters:
index- index
-
removeAllChildItems
void removeAllChildItems()Remove all child items from the children list. -
getChildren
List<SideMenu.MenuItem> getChildren()- Returns:
- child items
-
hasChildren
boolean hasChildren()- Returns:
- true if the menu item has child items
-
getParent
- Returns:
- parent menu item if it's nested item, null otherwise
-
getParentNN
SideMenu.MenuItem getParentNN()- Returns:
- parent menu item if it's nested item, null otherwise
- Throws:
IllegalArgumentException- if not found
-