C
- the context menu typeI
- the menu item typeS
- the sub menu type@Tag(value="vaadin-context-menu-item") @NpmPackage(value="@vaadin/polymer-legacy-adapter", version="22.1.0") @JsModule(value="@vaadin/polymer-legacy-adapter/style-modules.js") public abstract class MenuItemBase<C extends ContextMenuBase<C,I,S>,I extends MenuItemBase<C,I,S>,S extends SubMenuBase<C,I,S>> extends Component implements HasText, HasComponents, HasEnabled
ContextMenu
s.MenuItem
,
Serialized FormHasText.WhiteSpace
Constructor and Description |
---|
MenuItemBase(C contextMenu)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addThemeNames(String... themeNames)
Adds one or more theme names to this item.
|
protected abstract S |
createSubMenu() |
protected void |
executeJsWhenAttached(String expression,
Serializable... parameters) |
C |
getContextMenu()
Gets the context menu component that this item belongs to.
|
S |
getSubMenu()
Gets the sub menu API for this menu item.
|
boolean |
hasThemeName(String themeName)
Checks if the item has the given theme name.
|
boolean |
isCheckable()
Gets whether this item toggles a checkmark icon when clicked.
|
boolean |
isChecked()
Gets the checked state of this item.
|
boolean |
isParentItem()
Gets whether this item has a sub menu attached to it or not.
|
void |
removeThemeNames(String... themeNames)
Removes one or more theme names from this item.
|
void |
setCheckable(boolean checkable)
Sets the checkable state of this menu item.
|
void |
setChecked(boolean checked)
Sets the checked state of this item.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getText, getWhiteSpace, setText, setWhiteSpace
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
isEnabled, setEnabled
getElement
addAttachListener
addDetachListener
public MenuItemBase(C contextMenu)
contextMenu
- the context menu to which this item belongs topublic C getContextMenu()
public S getSubMenu()
public boolean isParentItem()
true
if this component has a sub menu with content inside
it, false
otherwisegetSubMenu()
public void setCheckable(boolean checkable)
isChecked()
.
Setting a checked item un-checkable also makes it un-checked.
checkable
- true
to enable toggling the checked-state of this menu
item by clicking, false
to disable it.IllegalStateException
- if setting a parent item checkablepublic boolean isCheckable()
setCheckable(boolean)
public void setChecked(boolean checked)
Note that the item needs to be explicitly set as checkable via
setCheckable(boolean)
in order to check it.
checked
- true
to check this item, false
to un-check itIllegalStateException
- if trying to check the item when it's checkablepublic boolean isChecked()
setChecked(boolean)
or by clicking it when it is
checkable. A checked item displays a checkmark icon inside it.true
if the item is checked, false
otherwisesetCheckable(boolean)
,
setChecked(boolean)
public void addThemeNames(String... themeNames)
themeNames
- the theme name or theme names to be added to the itempublic void removeThemeNames(String... themeNames)
themeNames
- the theme name or theme names to be removed from the itempublic boolean hasThemeName(String themeName)
themeName
- the theme name to check fortrue
if the item has the given theme name,
false
otherwiseprotected abstract S createSubMenu()
protected void executeJsWhenAttached(String expression, Serializable... parameters)
Copyright © 2024. All rights reserved.