Class AppMenuImpl
java.lang.Object
io.jmix.ui.component.impl.AbstractComponent<JmixMenuBar>
io.jmix.ui.component.mainwindow.impl.AppMenuImpl
- All Implemented Interfaces:
AttachNotifier
,Component
,Component.BelongToFrame
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,AppMenu
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.mainwindow.AppMenu
AppMenu.MenuItem
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
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map<String,
AppMenu.MenuItem> protected IconResolver
static final String
protected MenuBuilder
protected Map<com.vaadin.ui.MenuBar.MenuItem,
AppMenu.MenuItem> 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 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.protected void
assignJTestIds
(AppMenu.MenuItem menuItem, String id) 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<AppMenu.MenuItem> command) Create new menu item.Creates menu separatorvoid
focus()
Sets focus to this componentgetMenuItem
(String id) getMenuItemNN
(String id) Styles implementation is client-type-specific.int
Gets the tabulator index of theHasTabIndex
component.protected void
handleAttach
(com.vaadin.server.ClientConnector.AttachEvent event) boolean
void
loadMenu()
Load menu structure fromMenuConfig
protected void
registerMenuItem
(AppMenu.MenuItem menuItem) 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.void
setStyleName
(String name) Sets one or more style names of the component, replacing any previous styles.void
setTabIndex
(int tabIndex) Sets the tabulator index of theFocusable
component.protected void
unregisterItem
(AppMenu.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, 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, 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, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, 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
-
iconResolver
-
allItemsIds
-
viewModelMap
-
MENU_STYLENAME
- See Also:
-
Constructor Details
-
AppMenuImpl
public AppMenuImpl()
-
-
Method Details
-
handleAttach
protected void handleAttach(com.vaadin.server.ClientConnector.AttachEvent event) -
setStyleName
Description copied from interface:Component
Sets one or more style names of the component, replacing any previous styles. Multiple styles can be specified as a space-separated list of style names. Styles implementation is client-type-specific.- Specified by:
setStyleName
in interfaceComponent
- Overrides:
setStyleName
in classAbstractComponent<JmixMenuBar>
- Parameters:
name
- one or more style names separated by space.
-
getStyleName
Description copied from interface:Component
Styles implementation is client-type-specific.- Specified by:
getStyleName
in interfaceComponent
- Overrides:
getStyleName
in classAbstractComponent<JmixMenuBar>
- Returns:
- current style name.
-
loadMenu
public void loadMenu()Description copied from interface:AppMenu
Load menu structure fromMenuConfig
-
createMenuItem
Description copied from interface:AppMenu
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Specified by:
createMenuItem
in interfaceAppMenu
- Parameters:
id
- item id- Returns:
- menu item instance
-
createMenuItem
Description copied from interface:AppMenu
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Specified by:
createMenuItem
in interfaceAppMenu
- Parameters:
id
- item idcaption
- item caption- Returns:
- menu item instance
-
createMenuItem
public AppMenu.MenuItem createMenuItem(String id, String caption, @Nullable String icon, @Nullable Consumer<AppMenu.MenuItem> command) Description copied from interface:AppMenu
Create new menu item. Does not add item to menu. Id must be unique for whole menu.- Specified by:
createMenuItem
in interfaceAppMenu
- Parameters:
id
- item idcaption
- item captionicon
- iconcommand
- command- Returns:
- menu item instance
-
assignJTestIds
-
addMenuItem
Description copied from interface:AppMenu
Add menu item to the end of root items list.- Specified by:
addMenuItem
in interfaceAppMenu
- Parameters:
menuItem
- menu item
-
addMenuItem
Description copied from interface:AppMenu
Add menu item to specified position in the root items list.- Specified by:
addMenuItem
in interfaceAppMenu
- Parameters:
menuItem
- menu itemindex
- target index
-
registerMenuItem
-
removeMenuItem
Description copied from interface:AppMenu
Remove menu item from the root items list.- Specified by:
removeMenuItem
in interfaceAppMenu
- Parameters:
menuItem
- menu item
-
removeMenuItem
public void removeMenuItem(int index) Description copied from interface:AppMenu
Remove menu item from the root items list by index.- Specified by:
removeMenuItem
in interfaceAppMenu
- Parameters:
index
- index
-
unregisterItem
-
getMenuItem
- Specified by:
getMenuItem
in interfaceAppMenu
- Parameters:
id
- item id- Returns:
- item from the menu tree by its id
-
getMenuItemNN
- Specified by:
getMenuItemNN
in interfaceAppMenu
- Parameters:
id
- item id- Returns:
- item from the menu tree by its id
-
getMenuItems
- Specified by:
getMenuItems
in interfaceAppMenu
- Returns:
- root menu items
-
hasMenuItems
public boolean hasMenuItems()- Specified by:
hasMenuItems
in interfaceAppMenu
- Returns:
- true if the menu has items
-
checkItemIdDuplicate
-
checkItemOwner
-
createSeparator
Description copied from interface:AppMenu
Creates menu separator- Specified by:
createSeparator
in interfaceAppMenu
-
setMenuItemShortcutCaption
Description copied from interface:AppMenu
Sets caption to MenuItem with value of shortcut key combination.- Specified by:
setMenuItemShortcutCaption
in interfaceAppMenu
- Parameters:
menuItem
- MenuItem instanceshortcut
- shortcut key combination string representation
-
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
-