Class JmixUserMenu.AbstractUserMenuItem
java.lang.Object
io.jmix.flowui.kit.component.usermenu.JmixUserMenu.AbstractUserMenuItem
- All Implemented Interfaces:
com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasThemeVariant<UserMenuItemVariant>,HasSubParts,JmixUserMenu.HasMenuItem,UserMenuItem,Serializable
- Direct Known Subclasses:
JmixUserMenu.AbstractTextUserMenuItem,JmixUserMenu.ActionUserMenuItemImpl,JmixUserMenu.ComponentUserMenuItemImpl
- Enclosing class:
- JmixUserMenu<USER>
protected abstract static class JmixUserMenu.AbstractUserMenuItem
extends Object
implements UserMenuItem, JmixUserMenu.HasMenuItem
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.flowui.kit.component.usermenu.UserMenuItem
UserMenuItem.HasClickListener<ITEM extends UserMenuItem>, UserMenuItem.HasSubMenu -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final JmixMenuItemprotected com.vaadin.flow.shared.Registrationprotected UserMenuItem.HasSubMenu.SubMenuprotected final JmixUserMenu<?>Fields inherited from interface io.jmix.flowui.kit.component.usermenu.UserMenuItem
PROP_CHECKABLE, PROP_CHECKED, PROP_ENABLED, PROP_VISIBLE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractUserMenuItem(String id, JmixUserMenu<?> userMenu, JmixMenuItem item) -
Method Summary
Modifier and TypeMethodDescriptionprotected <ITEM extends UserMenuItem>
com.vaadin.flow.shared.RegistrationaddClickListenerInternal(Consumer<UserMenuItem.HasClickListener.ClickEvent<ITEM>> listener) com.vaadin.flow.shared.RegistrationaddPropertyChangeListener(Consumer<PropertyChangeEvent> listener) Adds a listener to be notified about changes in the properties of the action.protected UserMenuItem.HasSubMenu.SubMenuprotected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue) com.vaadin.flow.dom.Elementprotected EventBusgetId()Returns the unique identifier of the user menu item.com.vaadin.flow.component.contextmenu.MenuItemgetItem()Returns the associatedMenuItem.protected UserMenuItem.HasSubMenu.SubMenugetSubPart(String name) Returns a sub part object by its name.protected booleanhasListener(Class<? extends EventObject> eventType) protected <ITEM extends UserMenuItem>
voidinternalRemoveClickListener(Consumer<UserMenuItem.HasClickListener.ClickEvent<ITEM>> listener) booleanReturns whether this item toggles a checkmark icon when clicked.booleanReturns the checked state of this item.booleanChecks whether the user menu item is currently enabled.booleanChecks whether the user menu item is currently visible.voidsetCheckable(boolean checkable) Sets the checkable state of this menu item.voidsetChecked(boolean checked) Sets the checked state of this item.voidsetEnabled(boolean enabled) Enables or disables the user menu item.voidsetVisible(boolean visible) Sets the visibility of the user menu item.toString()protected voidupdateContent(String text, com.vaadin.flow.component.Component icon) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariants
-
Field Details
-
id
-
userMenu
-
item
-
subMenu
-
-
Constructor Details
-
Method Details
-
getId
Description copied from interface:UserMenuItemReturns the unique identifier of the user menu item.- Specified by:
getIdin interfaceUserMenuItem- Returns:
- the unique identifier of the menu item
-
getItem
public com.vaadin.flow.component.contextmenu.MenuItem getItem()Description copied from interface:JmixUserMenu.HasMenuItemReturns the associatedMenuItem.- Specified by:
getItemin interfaceJmixUserMenu.HasMenuItem- Returns:
- the
MenuIteminstance linked to this user menu item
-
getElement
public com.vaadin.flow.dom.Element getElement()- Specified by:
getElementin interfacecom.vaadin.flow.component.HasElement
-
isVisible
public boolean isVisible()Description copied from interface:UserMenuItemChecks whether the user menu item is currently visible. A visible item is displayed in the dropdown and can interact with users, whereas an invisible item is hidden and cannot be interacted with.- Specified by:
isVisiblein interfaceUserMenuItem- Returns:
- true if the item is visible, false otherwise
-
setVisible
public void setVisible(boolean visible) Description copied from interface:UserMenuItemSets the visibility of the user menu item. A visible item is rendered and can interact with users, while an invisible item is not displayed and cannot be interacted with.- Specified by:
setVisiblein interfaceUserMenuItem- Parameters:
visible- if true, the item will be visible; otherwise, it will be hidden
-
isEnabled
public boolean isEnabled()Description copied from interface:UserMenuItemChecks whether the user menu item is currently enabled. An enabled item can be interacted with, whereas a disabled item cannot.- Specified by:
isEnabledin interfaceUserMenuItem- Returns:
trueif the item is enabled,falseotherwise
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:UserMenuItemEnables or disables the user menu item. When the item is disabled, it cannot be interacted with.- Specified by:
setEnabledin interfaceUserMenuItem- Parameters:
enabled- iftrue, the item will be enabled; otherwise, it will be disabled
-
isCheckable
public boolean isCheckable()Description copied from interface:UserMenuItemReturns whether this item toggles a checkmark icon when clicked.- Specified by:
isCheckablein interfaceUserMenuItem- Returns:
- the checkable state of the item
- See Also:
-
setCheckable
public void setCheckable(boolean checkable) Description copied from interface:UserMenuItemSets the checkable state of this menu item. A checkable item toggles a checkmark icon when clicked. Changes in the checked state can be handled in the item's click handler withUserMenuItem.isChecked().Setting a checked item un-checkable also makes it un-checked.
- Specified by:
setCheckablein interfaceUserMenuItem- Parameters:
checkable-trueto enable toggling the checked-state of this menu item by clicking,falseto disable it.
-
isChecked
public boolean isChecked()Description copied from interface:UserMenuItemReturns the checked state of this item. The item can be checked and un-checked withUserMenuItem.setChecked(boolean)or by clicking it when it is checkable. A checked item displays a checkmark icon inside it.- Specified by:
isCheckedin interfaceUserMenuItem- Returns:
trueif the item is checked,falseotherwise- See Also:
-
setChecked
public void setChecked(boolean checked) Description copied from interface:UserMenuItemSets the checked state of this item. A checked item displays a checkmark icon next to it. The checked state is also toggled by clicking the item.Note that the item needs to be explicitly set as checkable via
UserMenuItem.setCheckable(boolean)in order to check it.- Specified by:
setCheckedin interfaceUserMenuItem- Parameters:
checked-trueto check this item,falseto un-check it
-
addPropertyChangeListener
public com.vaadin.flow.shared.Registration addPropertyChangeListener(Consumer<PropertyChangeEvent> listener) Description copied from interface:UserMenuItemAdds a listener to be notified about changes in the properties of the action.- Specified by:
addPropertyChangeListenerin interfaceUserMenuItem- Parameters:
listener- listener to add- Returns:
- a registration object for removing an event listener
-
getSubMenu
-
getSubPart
Description copied from interface:HasSubPartsReturns a sub part object by its name.- Specified by:
getSubPartin interfaceHasSubParts- Parameters:
name- sub part name, e.g. component id- Returns:
- a sub part object by its name, or
nullif not found
-
createSubMenu
-
addClickListenerInternal
protected <ITEM extends UserMenuItem> com.vaadin.flow.shared.Registration addClickListenerInternal(Consumer<UserMenuItem.HasClickListener.ClickEvent<ITEM>> listener) -
internalRemoveClickListener
protected <ITEM extends UserMenuItem> void internalRemoveClickListener(Consumer<UserMenuItem.HasClickListener.ClickEvent<ITEM>> listener) -
updateContent
protected void updateContent(@Nullable String text, @Nullable com.vaadin.flow.component.Component icon) -
getEventBus
-
hasListener
-
firePropertyChange
-
toString
-