Package io.jmix.ui.component.mainwindow
Interface AppMenu
- All Superinterfaces:
Component
,Component.BelongToFrame
,Component.Focusable
- All Known Implementing Classes:
AppMenuImpl
@StudioComponent(caption="Menu",
category="Main window",
xmlElement="menu",
icon="io/jmix/ui/icon/mainwindow/menu.svg",
canvasBehaviour=BOX,
canvasIconSize=LARGE,
canvasTextProperty="id",
canvasText="Main Menu",
unsupportedProperties={"box.expandRatio","css","responsive"})
public interface AppMenu
extends Component.BelongToFrame, Component.Focusable
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
-
Field Summary
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMenuItem
(AppMenu.MenuItem menuItem) Add menu item to the end of root items list.void
addMenuItem
(AppMenu.MenuItem menuItem, int index) Add menu item to specified position in the root items list.createMenuItem
(String id) Create new menu item.createMenuItem
(String id, String caption) Create new menu item.createMenuItem
(String id, String caption, String icon, Consumer<AppMenu.MenuItem> command) Create new menu item.Creates menu separatorgetMenuItem
(String id) getMenuItemNN
(String id) boolean
void
loadMenu()
Load menu structure fromMenuConfig
void
removeMenuItem
(int index) Remove menu item from the root items list by index.void
removeMenuItem
(AppMenu.MenuItem menuItem) Remove menu item from the root items list.void
setMenuItemShortcutCaption
(AppMenu.MenuItem menuItem, String shortcut) Sets caption to MenuItem with value of shortcut key combination.Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
-
Field Details
-
NAME
- See Also:
-
-
Method Details
-
loadMenu
void loadMenu()Load menu structure fromMenuConfig
-
createMenuItem
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Parameters:
id
- item id- Returns:
- menu item instance
-
createMenuItem
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Parameters:
id
- item idcaption
- item caption- Returns:
- menu item instance
-
createMenuItem
AppMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<AppMenu.MenuItem> command) Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Parameters:
id
- item idcaption
- item captionicon
- iconcommand
- command- Returns:
- menu item instance
-
addMenuItem
Add menu item to the end of root items list.- Parameters:
menuItem
- menu item
-
addMenuItem
Add menu item to specified position in the root items list.- Parameters:
menuItem
- menu itemindex
- target index
-
removeMenuItem
Remove menu item from the root items list.- Parameters:
menuItem
- menu item
-
removeMenuItem
void removeMenuItem(int index) Remove menu item from the root items list by index.- Parameters:
index
- index
-
getMenuItem
- Parameters:
id
- item id- Returns:
- item from the menu tree by its id
-
getMenuItemNN
- Parameters:
id
- item id- Returns:
- item from the menu tree by its id
- Throws:
IllegalArgumentException
- if not found
-
getMenuItems
List<AppMenu.MenuItem> getMenuItems()- Returns:
- root menu items
-
hasMenuItems
boolean hasMenuItems()- Returns:
- true if the menu has items
-
createSeparator
AppMenu.MenuItem createSeparator()Creates menu separator -
setMenuItemShortcutCaption
Sets caption to MenuItem with value of shortcut key combination.- Parameters:
menuItem
- MenuItem instanceshortcut
- shortcut key combination string representation
-