Class SideMenuImpl
java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<JmixSideMenu>
io.jmix.ui.component.mainwindow.impl.SideMenuImpl
- All Implemented Interfaces:
AttachNotifier
,Component
,Component.BelongToFrame
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,SideMenu
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
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
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.mainwindow.SideMenu
SideMenu.ItemSelectEvent, SideMenu.MenuItem
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
SideMenu.MenuItem> protected Component
protected Button
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
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.protected void
assignJTestId
(SideMenu.MenuItem menuItem) protected void
assignJTestIdInternal
(SideMenu.MenuItem menuItem) protected void
protected void
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.void
focus()
Sets focus to this componentgetMenuItem
(String id) getMenuItemNN
(String id) int
Gets the tabulator index of theHasTabIndex
component.protected void
handleAttach
(com.vaadin.server.ClientConnector.AttachEvent attachEvent) boolean
boolean
boolean
void
Load menu structure fromMenuConfig
protected void
registerMenuItem
(SideMenu.MenuItem menuItem) 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 toggleButton) Bind show/hide side panel action to button.void
setTabIndex
(int tabIndex) Sets the tabulator index of theFocusable
component.protected void
protected void
unregisterItem
(SideMenu.MenuItem menuItem) Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, addStyleName, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isCaptionAsHtml, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, removeStyleName, sanitize, setAlignment, setApplicationContext, setCaption, setCaptionAsHtml, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setIcon, setIconFromSet, setId, setParent, setResponsive, setStyleName, setValidationError, setVisible, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
isFocusable, setFocusable
-
Field Details
-
allItemsIds
-
toggleButton
-
sidePanel
-
-
Constructor Details
-
SideMenuImpl
public SideMenuImpl()
-
-
Method Details
-
handleAttach
protected void handleAttach(com.vaadin.server.ClientConnector.AttachEvent attachEvent) -
loadMenuConfig
public void loadMenuConfig()Description copied from interface:SideMenu
Load menu structure fromMenuConfig
- Specified by:
loadMenuConfig
in interfaceSideMenu
-
setSidePanelToggleButton
Description copied from interface:SideMenu
Bind show/hide side panel action to button.- Specified by:
setSidePanelToggleButton
in interfaceSideMenu
- Parameters:
toggleButton
- button that should trigger show/hide of side panel
-
toggleSidePanel
protected void toggleSidePanel() -
getSidePanelToggleButton
- Specified by:
getSidePanelToggleButton
in interfaceSideMenu
- Returns:
- side panel toggle button
-
setSidePanel
Description copied from interface:SideMenu
Bind side panel for show/hide action.- Specified by:
setSidePanel
in interfaceSideMenu
- Parameters:
sidePanel
- side panel
-
getSidePanel
- Specified by:
getSidePanel
in interfaceSideMenu
- Returns:
- side panel
-
isSelectOnClick
public boolean isSelectOnClick()- Specified by:
isSelectOnClick
in interfaceSideMenu
- Returns:
- true if an item becomes selected by click
-
setSelectOnClick
public void setSelectOnClick(boolean selectOnClick) Description copied from interface:SideMenu
Enable or disable automatic selected styling by click.- Specified by:
setSelectOnClick
in interfaceSideMenu
- Parameters:
selectOnClick
- enable/disable option
-
getSelectedItem
- Specified by:
getSelectedItem
in interfaceSideMenu
- Returns:
- currently selected item
-
setSelectedItem
Description copied from interface:SideMenu
Set selected item.- Specified by:
setSelectedItem
in interfaceSideMenu
- Parameters:
selectedItem
- new selected item
-
checkItemIdDuplicate
-
checkItemOwner
-
createMenuItem
Description copied from interface:SideMenu
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Specified by:
createMenuItem
in interfaceSideMenu
- Parameters:
id
- item id- Returns:
- menu item instance
-
createMenuItem
Description copied from interface:SideMenu
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Specified by:
createMenuItem
in interfaceSideMenu
- Parameters:
id
- item idcaption
- item caption- Returns:
- menu item instance
-
createMenuItem
public SideMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<SideMenu.MenuItem> command) Description copied from interface:SideMenu
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Specified by:
createMenuItem
in interfaceSideMenu
- Parameters:
id
- item idcaption
- item captionicon
- iconcommand
- command- Returns:
- menu item instance
-
assignJTestId
-
assignJTestIdInternal
-
addMenuItem
Description copied from interface:SideMenu
Add menu item to the end of root items list.- Specified by:
addMenuItem
in interfaceSideMenu
- Parameters:
menuItem
- menu item
-
registerMenuItem
-
unregisterItem
-
addMenuItem
Description copied from interface:SideMenu
Add menu item to specified position in the root items list.- Specified by:
addMenuItem
in interfaceSideMenu
- Parameters:
menuItem
- menu itemindex
- target index
-
removeMenuItem
Description copied from interface:SideMenu
Remove menu item from the root items list.- Specified by:
removeMenuItem
in interfaceSideMenu
- Parameters:
menuItem
- menu item
-
removeAllMenuItems
public void removeAllMenuItems()Description copied from interface:SideMenu
Remove all the root menu items.- Specified by:
removeAllMenuItems
in interfaceSideMenu
-
removeMenuItem
public void removeMenuItem(int index) Description copied from interface:SideMenu
Remove menu item from the root items list by index.- Specified by:
removeMenuItem
in interfaceSideMenu
- Parameters:
index
- index
-
getMenuItem
- Specified by:
getMenuItem
in interfaceSideMenu
- Parameters:
id
- item id- Returns:
- item from the menu tree by its id
-
getMenuItemNN
- Specified by:
getMenuItemNN
in interfaceSideMenu
- Parameters:
id
- item id- Returns:
- item from the menu tree by its id
-
getMenuItems
- Specified by:
getMenuItems
in interfaceSideMenu
- Returns:
- root menu items
-
hasMenuItems
public boolean hasMenuItems()- Specified by:
hasMenuItems
in interfaceSideMenu
- Returns:
- true if the menu has items
-
focus
public void focus()Description copied from interface:Component.Focusable
Sets focus to this component- Specified by:
focus
in interfaceComponent.Focusable
-
getTabIndex
public int getTabIndex()Description copied from interface:Component.Focusable
Gets the tabulator index of theHasTabIndex
component.- Specified by:
getTabIndex
in interfaceComponent.Focusable
- Returns:
- tab index set for the
HasTabIndex
component
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:Component.Focusable
Sets the tabulator index of theFocusable
component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.- Specified by:
setTabIndex
in interfaceComponent.Focusable
- Parameters:
tabIndex
- tab index
-
setShowSingleExpandedMenu
public void setShowSingleExpandedMenu(boolean singleExpandedMenu) Description copied from interface:SideMenu
Set true for collapsing a submenu when another parent menu item is clicked- Specified by:
setShowSingleExpandedMenu
in interfaceSideMenu
-
isShowSingleExpandedMenu
public boolean isShowSingleExpandedMenu()- Specified by:
isShowSingleExpandedMenu
in interfaceSideMenu
- Returns:
- true if a submenu is collapsing when another parent menu item is clicked
-
addItemSelectListener
Description copied from interface:SideMenu
Adds a listener that will be fired when leaf (non-expandable) menu item is clicked.- Specified by:
addItemSelectListener
in interfaceSideMenu
- Parameters:
listener
- a listener to add- Returns:
- a
Subscription
object
-