Interface UserMenuItem

All Superinterfaces:
com.vaadin.flow.component.HasElement, HasSubParts, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasThemeVariant<UserMenuItemVariant>, Serializable
All Known Subinterfaces:
ActionUserMenuItem, ComponentUserMenuItem, TextUserMenuItem, ViewUserMenuItem
All Known Implementing Classes:
JmixUserMenu.AbstractTextUserMenuItem, JmixUserMenu.AbstractUserMenuItem, JmixUserMenu.ActionUserMenuItemImpl, JmixUserMenu.ComponentUserMenuItemImpl, JmixUserMenu.TextUserMenuItemImpl, JmixUserMenuItemsDelegate.SeparatorUserMenuItem, UserMenu.ViewUserMenuItemImpl

public interface UserMenuItem extends com.vaadin.flow.component.shared.HasThemeVariant<UserMenuItemVariant>, HasSubParts
Represents an item that can be included in a user menu component. Defines the common behavior for items such as visibility, enabling/disabling, and handling click events.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    This interface provides functionality for adding click listeners to user menu items.
    static interface 
    Represents an interface for menu items that can optionally have a submenu.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    Adds a listener to be notified about changes in the properties of the action.
    Returns the unique identifier of the user menu item.
    boolean
    Returns whether this item toggles a checkmark icon when clicked.
    boolean
    Returns the checked state of this item.
    boolean
    Checks whether the user menu item is currently enabled.
    boolean
    Checks whether the user menu item is currently visible.
    void
    setCheckable(boolean checkable)
    Sets the checkable state of this menu item.
    void
    setChecked(boolean checked)
    Sets the checked state of this item.
    void
    setEnabled(boolean enabled)
    Enables or disables the user menu item.
    void
    setVisible(boolean visible)
    Sets the visibility of the user menu item.

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface io.jmix.flowui.kit.component.HasSubParts

    getSubPart

    Methods inherited from interface com.vaadin.flow.component.HasTheme

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, removeThemeVariants
  • Field Details

  • Method Details

    • getId

      String getId()
      Returns the unique identifier of the user menu item.
      Returns:
      the unique identifier of the menu item
    • isVisible

      boolean isVisible()
      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.
      Returns:
      true if the item is visible, false otherwise
    • setVisible

      void setVisible(boolean visible)
      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.
      Parameters:
      visible - if true, the item will be visible; otherwise, it will be hidden
    • isEnabled

      boolean isEnabled()
      Checks whether the user menu item is currently enabled. An enabled item can be interacted with, whereas a disabled item cannot.
      Returns:
      true if the item is enabled, false otherwise
    • setEnabled

      void setEnabled(boolean enabled)
      Enables or disables the user menu item. When the item is disabled, it cannot be interacted with.
      Parameters:
      enabled - if true, the item will be enabled; otherwise, it will be disabled
    • isCheckable

      boolean isCheckable()
      Returns whether this item toggles a checkmark icon when clicked.
      Returns:
      the checkable state of the item
      See Also:
    • setCheckable

      void setCheckable(boolean checkable)
      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 isChecked().

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

      Parameters:
      checkable - true to enable toggling the checked-state of this menu item by clicking, false to disable it.
      Throws:
      IllegalStateException - if setting a parent item checkable
    • isChecked

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

      void setChecked(boolean checked)
      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 setCheckable(boolean) in order to check it.

      Parameters:
      checked - true to check this item, false to un-check it
      Throws:
      IllegalStateException - if trying to check the item when it's checkable
    • addPropertyChangeListener

      com.vaadin.flow.shared.Registration addPropertyChangeListener(Consumer<PropertyChangeEvent> listener)
      Adds a listener to be notified about changes in the properties of the action.
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener