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:
  • Field Details

  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Description copied from interface: UserMenuItem
      Returns the unique identifier of the user menu item.
      Specified by:
      getId in interface UserMenuItem
      Returns:
      the unique identifier of the menu item
    • getItem

      public com.vaadin.flow.component.contextmenu.MenuItem getItem()
      Description copied from interface: JmixUserMenu.HasMenuItem
      Returns the associated MenuItem.
      Specified by:
      getItem in interface JmixUserMenu.HasMenuItem
      Returns:
      the MenuItem instance linked to this user menu item
    • getElement

      public com.vaadin.flow.dom.Element getElement()
      Specified by:
      getElement in interface com.vaadin.flow.component.HasElement
    • isVisible

      public boolean isVisible()
      Description copied from interface: UserMenuItem
      Checks 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:
      isVisible in interface UserMenuItem
      Returns:
      true if the item is visible, false otherwise
    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: UserMenuItem
      Sets 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:
      setVisible in interface UserMenuItem
      Parameters:
      visible - if true, the item will be visible; otherwise, it will be hidden
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: UserMenuItem
      Checks whether the user menu item is currently enabled. An enabled item can be interacted with, whereas a disabled item cannot.
      Specified by:
      isEnabled in interface UserMenuItem
      Returns:
      true if the item is enabled, false otherwise
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: UserMenuItem
      Enables or disables the user menu item. When the item is disabled, it cannot be interacted with.
      Specified by:
      setEnabled in interface UserMenuItem
      Parameters:
      enabled - if true, the item will be enabled; otherwise, it will be disabled
    • isCheckable

      public boolean isCheckable()
      Description copied from interface: UserMenuItem
      Returns whether this item toggles a checkmark icon when clicked.
      Specified by:
      isCheckable in interface UserMenuItem
      Returns:
      the checkable state of the item
      See Also:
    • setCheckable

      public void setCheckable(boolean checkable)
      Description copied from interface: UserMenuItem
      Sets 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 with UserMenuItem.isChecked().

      Setting a checked item un-checkable also makes it un-checked.

      Specified by:
      setCheckable in interface UserMenuItem
      Parameters:
      checkable - true to enable toggling the checked-state of this menu item by clicking, false to disable it.
    • isChecked

      public boolean isChecked()
      Description copied from interface: UserMenuItem
      Returns the checked state of this item. The item can be checked and un-checked with UserMenuItem.setChecked(boolean) or by clicking it when it is checkable. A checked item displays a checkmark icon inside it.
      Specified by:
      isChecked in interface UserMenuItem
      Returns:
      true if the item is checked, false otherwise
      See Also:
    • setChecked

      public void setChecked(boolean checked)
      Description copied from interface: UserMenuItem
      Sets 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:
      setChecked in interface UserMenuItem
      Parameters:
      checked - true to check this item, false to un-check it
    • addPropertyChangeListener

      public com.vaadin.flow.shared.Registration addPropertyChangeListener(Consumer<PropertyChangeEvent> listener)
      Description copied from interface: UserMenuItem
      Adds a listener to be notified about changes in the properties of the action.
      Specified by:
      addPropertyChangeListener in interface UserMenuItem
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • getSubMenu

      protected UserMenuItem.HasSubMenu.SubMenu getSubMenu()
    • getSubPart

      @Nullable public UserMenuItem getSubPart(String name)
      Description copied from interface: HasSubParts
      Returns a sub part object by its name.
      Specified by:
      getSubPart in interface HasSubParts
      Parameters:
      name - sub part name, e.g. component id
      Returns:
      a sub part object by its name, or null if not found
    • createSubMenu

      protected UserMenuItem.HasSubMenu.SubMenu 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

      protected EventBus getEventBus()
    • hasListener

      protected boolean hasListener(Class<? extends EventObject> eventType)
    • firePropertyChange

      protected void firePropertyChange(String propertyName, @Nullable Object oldValue, @Nullable Object newValue)
    • toString

      public String toString()
      Overrides:
      toString in class Object