Package io.jmix.ui.component.mainwindow
Interface SideMenu
- All Superinterfaces:
Component
,Component.BelongToFrame
,Component.Focusable
- All Known Implementing Classes:
SideMenuImpl
@StudioComponent(caption="SideMenu",
category="Main window",
xmlElement="sideMenu",
icon="io/jmix/ui/icon/mainwindow/sideMenu.svg",
canvasBehaviour=BOX,
canvasIconSize=LARGE,
canvasTextProperty="id",
canvasText="Side Menu",
unsupportedProperties={"box.expandRatio","css","responsive"})
public interface SideMenu
extends Component.BelongToFrame, Component.Focusable
Side menu component that shows items as collapsible multi level list.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Event that is fired when menu item is selected (screen will be opened).static interface
Menu itemNested 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 TypeMethodDescriptionAdds a listener that will be fired when leaf (non-expandable) menu item is clicked.void
addMenuItem
(SideMenu.MenuItem menuItem) Add menu item to the end of root items list.void
addMenuItem
(SideMenu.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<SideMenu.MenuItem> command) Create new menu item.getMenuItem
(String id) getMenuItemNN
(String id) boolean
boolean
boolean
void
Load menu structure fromMenuConfig
void
Remove all the root menu items.void
removeMenuItem
(int index) Remove menu item from the root items list by index.void
removeMenuItem
(SideMenu.MenuItem menuItem) Remove menu item from the root items list.void
setSelectedItem
(SideMenu.MenuItem selectedItem) Set selected item.void
setSelectOnClick
(boolean selectOnClick) Enable or disable automatic selected styling by click.void
setShowSingleExpandedMenu
(boolean singleExpandedMenu) Set true for collapsing a submenu when another parent menu item is clickedvoid
setSidePanel
(Component sidePanel) Bind side panel for show/hide action.void
setSidePanelToggleButton
(Button button) Bind show/hide side panel action to button.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
-
loadMenuConfig
Load menu structure fromMenuConfig
-
setSidePanelToggleButton
@StudioProperty(type=COMPONENT_REF, options="io.jmix.ui.component.Button") void setSidePanelToggleButton(@Nullable Button button) Bind show/hide side panel action to button.- Parameters:
button
- button that should trigger show/hide of side panel
-
getSidePanelToggleButton
- Returns:
- side panel toggle button
-
setSidePanel
Bind side panel for show/hide action.- Parameters:
sidePanel
- side panel
-
getSidePanel
- Returns:
- side panel
-
isSelectOnClick
boolean isSelectOnClick()- Returns:
- true if an item becomes selected by click
-
setSelectOnClick
Enable or disable automatic selected styling by click.- Parameters:
selectOnClick
- enable/disable option
-
getSelectedItem
- Returns:
- currently selected item
-
setSelectedItem
Set selected item.- Parameters:
selectedItem
- new selected item
-
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
SideMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<SideMenu.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
-
removeAllMenuItems
void removeAllMenuItems()Remove all the root menu items. -
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<SideMenu.MenuItem> getMenuItems()- Returns:
- root menu items
-
hasMenuItems
boolean hasMenuItems()- Returns:
- true if the menu has items
-
setShowSingleExpandedMenu
@StudioProperty(name="showSingleExpandedMenu", defaultValue="false") void setShowSingleExpandedMenu(boolean singleExpandedMenu) Set true for collapsing a submenu when another parent menu item is clicked- Parameters:
singleExpandedMenu
-
-
isShowSingleExpandedMenu
boolean isShowSingleExpandedMenu()- Returns:
- true if a submenu is collapsing when another parent menu item is clicked
-
addItemSelectListener
Adds a listener that will be fired when leaf (non-expandable) menu item is clicked.- Parameters:
listener
- a listener to add- Returns:
- a
Subscription
object
-