public class WebAppMenu extends WebAbstractComponent<com.haulmont.cuba.web.toolkit.ui.CubaMenuBar> implements AppMenu
AppMenu.MenuItem
Component.ActionOwner, Component.ActionsHolder, Component.Alignment, Component.BelongToFrame, Component.Buffered, Component.ChildEditableController, Component.Collapsable, Component.Container, Component.Disposable, Component.Editable, Component.EditableChangeEvent, Component.EditableChangeListener, Component.EditableChangeNotifier, Component.ExpandedStateChangeEvent, Component.ExpandedStateChangeListener, Component.Focusable, Component.HasBorder, Component.HasButtonsPanel, Component.HasCaption, Component.HasFormatter, Component.HasIcon, Component.HasInputPrompt, Component.HasNamedComponents, Component.HasPresentations, Component.HasRowsCount, Component.HasSettings, Component.HasValue, Component.HasXmlDescriptor, Component.LayoutClickEvent, Component.LayoutClickListener, Component.LayoutClickNotifier, Component.Margin, Component.MouseEventDetails, Component.OrderedContainer, Component.OuterMargin, Component.SecuredActionsHolder, Component.ShortcutAction, Component.ShortcutNotifier, Component.ShortcutTriggeredEvent, Component.Spacing, Component.UiPermissionAware, Component.Validatable, Component.ValueChangeEvent, Component.ValueChangeListener, Component.Wrapper
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MENU_STYLENAME |
ICON_STYLE, UNIT_SYMBOLS
AUTO_SIZE, AUTO_SIZE_PX, UNITS_PERCENTAGE, UNITS_PIXELS
Constructor and Description |
---|
WebAppMenu() |
Modifier and Type | Method and Description |
---|---|
void |
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.
|
AppMenu.MenuItem |
createMenuItem(java.lang.String id)
Create new menu item.
|
AppMenu.MenuItem |
createMenuItem(java.lang.String id,
java.lang.String caption)
Create new menu item.
|
AppMenu.MenuItem |
createMenuItem(java.lang.String id,
java.lang.String caption,
java.lang.String icon,
java.util.function.Consumer<AppMenu.MenuItem> command)
Create new menu item.
|
AppMenu.MenuItem |
createSeparator()
Creates menu separator
|
AppMenu.MenuItem |
getMenuItem(java.lang.String id) |
AppMenu.MenuItem |
getMenuItemNN(java.lang.String id) |
java.util.List<AppMenu.MenuItem> |
getMenuItems() |
java.lang.String |
getStyleName()
Styles implementation is client-type-specific.
|
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
boolean |
hasMenuItems() |
void |
loadMenu()
Load menu structure from
MenuConfig |
void |
removeMenuItem(AppMenu.MenuItem menuItem)
Remove menu item from the root items list.
|
void |
removeMenuItem(int index)
Remove menu item from the root items list by index.
|
void |
setMenuItemShortcutCaption(AppMenu.MenuItem menuItem,
java.lang.String shortcut)
Sets caption to MenuItem with value of shortcut key combination.
|
void |
setStyleName(java.lang.String name)
Sets one or more style names of the component, replacing any
previous styles.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
addStyleName, assignAutoDebugId, getAlignment, getCaption, getComponent, getComponentEnabledFlag, getComponentVisibleFlag, getComposition, getDebugId, getDescription, getFrame, getHeight, getHeightUnits, getIcon, getId, getParent, getWidth, getWidthUnits, getXmlDescriptor, isEnabled, isEnabledItself, isResponsive, isVisible, isVisibleItself, removeStyleName, requestFocus, setAlignment, setCaption, setDebugId, setDescription, setEnabled, setFrame, setHeight, setIcon, setId, setParent, setResponsive, setVisible, setWidth, setXmlDescriptor, unwrap, unwrapComposition
addListener, addListener, fireEvent, hasListeners, removeListener, removeListener
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFrame, setFrame
isFocusable, setFocusable
addStyleName, getAlignment, getDebugId, getHeight, getHeightUnits, getId, getParent, getWidth, getWidthUnits, isEnabled, isEnabledItself, isResponsive, isVisible, isVisibleItself, removeStyleName, requestFocus, setAlignment, setDebugId, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition
public static final java.lang.String MENU_STYLENAME
public void setStyleName(java.lang.String name)
Component
setStyleName
in interface Component
setStyleName
in class WebAbstractComponent<com.haulmont.cuba.web.toolkit.ui.CubaMenuBar>
name
- one or more style names separated by space.public java.lang.String getStyleName()
Component
getStyleName
in interface Component
getStyleName
in class WebAbstractComponent<com.haulmont.cuba.web.toolkit.ui.CubaMenuBar>
public void loadMenu()
AppMenu
MenuConfig
public AppMenu.MenuItem createMenuItem(java.lang.String id)
AppMenu
createMenuItem
in interface AppMenu
id
- item idpublic AppMenu.MenuItem createMenuItem(java.lang.String id, java.lang.String caption)
AppMenu
createMenuItem
in interface AppMenu
id
- item idcaption
- item captionpublic AppMenu.MenuItem createMenuItem(java.lang.String id, java.lang.String caption, @Nullable java.lang.String icon, @Nullable java.util.function.Consumer<AppMenu.MenuItem> command)
AppMenu
createMenuItem
in interface AppMenu
id
- item idcaption
- item captionicon
- iconcommand
- commandpublic void addMenuItem(AppMenu.MenuItem menuItem)
AppMenu
addMenuItem
in interface AppMenu
menuItem
- menu itempublic void addMenuItem(AppMenu.MenuItem menuItem, int index)
AppMenu
addMenuItem
in interface AppMenu
menuItem
- menu itemindex
- target indexpublic void removeMenuItem(AppMenu.MenuItem menuItem)
AppMenu
removeMenuItem
in interface AppMenu
menuItem
- menu itempublic void removeMenuItem(int index)
AppMenu
removeMenuItem
in interface AppMenu
index
- index@Nullable public AppMenu.MenuItem getMenuItem(java.lang.String id)
getMenuItem
in interface AppMenu
id
- item idpublic AppMenu.MenuItem getMenuItemNN(java.lang.String id)
getMenuItemNN
in interface AppMenu
id
- item idpublic java.util.List<AppMenu.MenuItem> getMenuItems()
getMenuItems
in interface AppMenu
public boolean hasMenuItems()
hasMenuItems
in interface AppMenu
public AppMenu.MenuItem createSeparator()
AppMenu
createSeparator
in interface AppMenu
public void setMenuItemShortcutCaption(AppMenu.MenuItem menuItem, java.lang.String shortcut)
AppMenu
setMenuItemShortcutCaption
in interface AppMenu
menuItem
- MenuItem instanceshortcut
- shortcut key combination string representationpublic int getTabIndex()
Component.Focusable
HasTabIndex
component.getTabIndex
in interface Component.Focusable
HasTabIndex
componentpublic void setTabIndex(int tabIndex)
Component.Focusable
Focusable
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.setTabIndex
in interface Component.Focusable
tabIndex
- tab index