Class UserMenu

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<JmixMenuBar>
io.jmix.flowui.kit.component.usermenu.JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>
io.jmix.flowui.component.usermenu.UserMenu
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>>, com.vaadin.flow.component.FocusNotifier<JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasOverlayClassName, com.vaadin.flow.component.shared.HasThemeVariant<UserMenuVariant>, HasViewMenuItems, HasSubParts, HasTitle, HasActionMenuItems, HasComponentMenuItems, HasMenuItems, HasTextMenuItems, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class UserMenu extends JmixUserMenu<org.springframework.security.core.userdetails.UserDetails> implements HasViewMenuItems, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
A component that displays a user menu as a dropdown.
See Also:
  • Field Details

  • Constructor Details

    • UserMenu

      public UserMenu()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • autowireDependencies

      protected void autowireDependencies()
    • initComponent

      protected void initComponent()
    • defaultButtonRenderer

      @Nullable protected com.vaadin.flow.component.Component defaultButtonRenderer(@Nullable org.springframework.security.core.userdetails.UserDetails userDetails)
    • loadUser

      protected org.springframework.security.core.userdetails.UserDetails loadUser()
    • userChangedInternal

      protected void userChangedInternal()
      Overrides:
      userChangedInternal in class JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>
    • isSubstituted

      protected boolean isSubstituted()
    • updateSubstitutedState

      protected void updateSubstitutedState()
    • generateUserName

      protected String generateUserName(org.springframework.security.core.userdetails.UserDetails user)
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, Class<? extends View<?>> viewClass, String text)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view class and text.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewClass - the class of the view to associate with the menu item
      text - the text to be set for the menu item
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, Class<? extends View<?>> viewClass, String text, int index)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view class and text at a specific position.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewClass - the class of the view to associate with the menu item
      text - the text to be set for the menu item
      index - the position at which the menu item will be added
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, Class<? extends View<?>> viewClass, String text, com.vaadin.flow.component.Component icon)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view class, text and icon.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewClass - the class of the view to associate with the menu item
      text - the text to be set for the menu item
      icon - the icon to be set for the menu item
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, Class<? extends View<?>> viewClass, String text, com.vaadin.flow.component.Component icon, int index)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view class, text and icon at a specific position.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewClass - the class of the view to associate with the menu item
      text - the text to be set for the menu item
      icon - the icon to be set for the menu item
      index - the position at which the menu item will be added
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, String viewId, String text)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view id and text.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewId - the id of the view to associate with the menu item
      text - the text to be set for the menu item
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, String viewId, String text, int index)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view id and text at a specific position.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewId - the id of the view to associate with the menu item
      text - the text to be set for the menu item
      index - the position at which the menu item will be added
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, String viewId, String text, com.vaadin.flow.component.Component icon)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view id, text and icon.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewId - the id of the view to associate with the menu item
      text - the text to be set for the menu item
      icon - the icon to be set for the menu item
      Returns:
      the created ViewUserMenuItem instance
    • addViewItem

      public ViewUserMenuItem addViewItem(String id, String viewId, String text, com.vaadin.flow.component.Component icon, int index)
      Description copied from interface: HasViewMenuItems
      Adds a menu item associated with a specified view id, text and icon at a specific position.
      Specified by:
      addViewItem in interface HasViewMenuItems
      Parameters:
      id - the unique identifier of the menu item
      viewId - the id of the view to associate with the menu item
      text - the text to be set for the menu item
      icon - the icon to be set for the menu item
      index - the position at which the menu item will be added
      Returns:
      the created ViewUserMenuItem instance
    • getItemsDelegate

      protected UserMenuItemsDelegate getItemsDelegate()
      Overrides:
      getItemsDelegate in class JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>
    • createUserMenuItemsDelegate

      protected UserMenuItemsDelegate createUserMenuItemsDelegate(JmixSubMenu subMenu)
      Overrides:
      createUserMenuItemsDelegate in class JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>
    • createSubMenu

      protected UserMenuItem.HasSubMenu.SubMenu createSubMenu(JmixSubMenu subMenu)
      Overrides:
      createSubMenu in class JmixUserMenu<org.springframework.security.core.userdetails.UserDetails>