Class PopupButtonImpl

All Implemented Interfaces:
ActionsHolder, AttachNotifier, Component, Component.BelongToFrame, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper, HasContextHelp, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer, HasSubParts, PopupButton, SecuredActionsHolder
Direct Known Subclasses:
RelatedEntitiesImpl

public class PopupButtonImpl extends AbstractComponent<JmixPopupButton> implements PopupButton, SecuredActionsHolder
  • Field Details

    • CONTEXT_MENU_BUTTON_STYLENAME

      protected static final String CONTEXT_MENU_BUTTON_STYLENAME
      See Also:
    • popupComponent

      protected Component popupComponent
    • vPopupComponent

      protected com.vaadin.ui.Component vPopupComponent
    • vActionsContainer

      protected JmixPopupButtonLayout vActionsContainer
    • showActionIcons

      protected boolean showActionIcons
    • actionOrder

      protected List<Action> actionOrder
    • actionButtons

      protected Map<Action,com.vaadin.ui.Button> actionButtons
    • actionsPermissions

      protected ActionsPermissions actionsPermissions
    • popupVisibilityListenerRegistration

      protected com.vaadin.shared.Registration popupVisibilityListenerRegistration
    • actionPropertyChangeListener

      protected Consumer<PropertyChangeEvent> actionPropertyChangeListener
  • Constructor Details

    • PopupButtonImpl

      public PopupButtonImpl()
  • Method Details

    • setThemeConstantsManager

      @Autowired public void setThemeConstantsManager(ThemeConstantsManager themeConstantsManager)
    • createComponent

      protected JmixPopupButton createComponent()
    • createActionsContainer

      protected JmixPopupButtonLayout createActionsContainer()
    • hasVisibleActions

      protected boolean hasVisibleActions()
    • addPopupVisibilityListener

      public Subscription addPopupVisibilityListener(Consumer<PopupButton.PopupVisibilityEvent> listener)
      Specified by:
      addPopupVisibilityListener in interface PopupButton
    • internalRemovePopupVisibilityListener

      protected void internalRemovePopupVisibilityListener(Consumer<PopupButton.PopupVisibilityEvent> listener)
    • focus

      public void focus()
      Description copied from interface: Component.Focusable
      Sets focus to this component
      Specified by:
      focus in interface Component.Focusable
    • getTabIndex

      public int getTabIndex()
      Description copied from interface: Component.Focusable
      Gets the tabulator index of the HasTabIndex component.
      Specified by:
      getTabIndex in interface Component.Focusable
      Returns:
      tab index set for the HasTabIndex component
    • setTabIndex

      public void setTabIndex(int tabIndex)
      Description copied from interface: Component.Focusable
      Sets the tabulator index of the Focusable component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.
      Specified by:
      setTabIndex in interface Component.Focusable
      Parameters:
      tabIndex - tab index
    • isPopupVisible

      public boolean isPopupVisible()
      Specified by:
      isPopupVisible in interface PopupButton
      Returns:
      true if popup is opened
    • setPopupVisible

      public void setPopupVisible(boolean popupVisible)
      Description copied from interface: PopupButton
      Open or close popup panel.
      Specified by:
      setPopupVisible in interface PopupButton
      Parameters:
      popupVisible - whether open or close popup panel.
    • setMenuWidth

      public void setMenuWidth(@Nullable String width)
      Description copied from interface: PopupButton
      Sets menu width.
      Specified by:
      setMenuWidth in interface PopupButton
      Parameters:
      width - new menu width
    • getMenuWidth

      public float getMenuWidth()
      Specified by:
      getMenuWidth in interface PopupButton
      Returns:
      menu width
    • getMenuWidthSizeUnit

      public SizeUnit getMenuWidthSizeUnit()
      Description copied from interface: PopupButton
      Gets the menu width property units.
      Specified by:
      getMenuWidthSizeUnit in interface PopupButton
      Returns:
      units used in the menu width property.
    • isAutoClose

      public boolean isAutoClose()
      Specified by:
      isAutoClose in interface PopupButton
      Returns:
      whether to close menu automatically after action triggering or not
    • setShowActionIcons

      public void setShowActionIcons(boolean showActionIcons)
      Description copied from interface: PopupButton
      Sets show icons for action buttons
      Specified by:
      setShowActionIcons in interface PopupButton
    • isShowActionIcons

      public boolean isShowActionIcons()
      Description copied from interface: PopupButton
      Returns show icons for action buttons
      Specified by:
      isShowActionIcons in interface PopupButton
    • isTogglePopupVisibilityOnClick

      public boolean isTogglePopupVisibilityOnClick()
      Specified by:
      isTogglePopupVisibilityOnClick in interface PopupButton
      Returns:
      if sequential click on popup will toggle popup visibility
    • setTogglePopupVisibilityOnClick

      public void setTogglePopupVisibilityOnClick(boolean togglePopupVisibilityOnClick)
      Description copied from interface: PopupButton
      Sets sequential click on popup will toggle popup visibility.
      Specified by:
      setTogglePopupVisibilityOnClick in interface PopupButton
      Parameters:
      togglePopupVisibilityOnClick - true if sequential click on popup should toggle popup visibility
    • getPopupOpenDirection

      public PopupButton.PopupOpenDirection getPopupOpenDirection()
      Specified by:
      getPopupOpenDirection in interface PopupButton
      Returns:
      opening direction for the popup
    • setPopupOpenDirection

      public void setPopupOpenDirection(PopupButton.PopupOpenDirection direction)
      Description copied from interface: PopupButton
      Sets opening direction for the popup.
      Specified by:
      setPopupOpenDirection in interface PopupButton
      Parameters:
      direction - new direction
    • isClosePopupOnOutsideClick

      public boolean isClosePopupOnOutsideClick()
      Specified by:
      isClosePopupOnOutsideClick in interface PopupButton
      Returns:
      true if a click outside the popup closing the popup, otherwise - false
    • setClosePopupOnOutsideClick

      public void setClosePopupOnOutsideClick(boolean closePopupOnOutsideClick)
      Description copied from interface: PopupButton
      If set to true, clicking on outside the popup closes it. Note that this doesn't affect clicking on the button itself.
      Specified by:
      setClosePopupOnOutsideClick in interface PopupButton
      Parameters:
      closePopupOnOutsideClick - whether to close popup on outside click
    • setPopupContent

      public void setPopupContent(@Nullable Component popupContent)
      Description copied from interface: PopupButton
      Sets custom inner content for the popup. Actions are ignored if a custom popup content is set.
      Specified by:
      setPopupContent in interface PopupButton
      Parameters:
      popupContent - popup component.
    • getPopupContent

      @Nullable public Component getPopupContent()
      Specified by:
      getPopupContent in interface PopupButton
      Returns:
      popup content component
    • setAutoClose

      public void setAutoClose(boolean autoClose)
      Description copied from interface: PopupButton
      Sets menu automatic close after option click.
      Specified by:
      setAutoClose in interface PopupButton
      Parameters:
      autoClose - whether to close menu automatically after action triggering or not
    • addAction

      public void addAction(Action action)
      Description copied from interface: ActionsHolder
      Add an action to the component
      Specified by:
      addAction in interface ActionsHolder
    • addAction

      public void addAction(Action action, int index)
      Description copied from interface: ActionsHolder
      Add an action to the component with index.
      Specified by:
      addAction in interface ActionsHolder
    • updateActionsIcons

      protected void updateActionsIcons()
    • createActionButton

      protected JmixButton createActionButton(Action action)
    • setPopupButtonAction

      protected void setPopupButtonAction(JmixButton button, Action action)
    • setPopupButtonIcon

      protected void setPopupButtonIcon(com.vaadin.ui.Button button, @Nullable String icon)
    • actionPropertyChanged

      protected void actionPropertyChanged(PropertyChangeEvent evt)
    • setDebugId

      public void setDebugId(@Nullable String id)
      Description copied from interface: HasDebugId
      INTERNAL. Managed by debug Id system.
      Specified by:
      setDebugId in interface HasDebugId
      Overrides:
      setDebugId in class AbstractComponent<JmixPopupButton>
    • removeAction

      public void removeAction(Action action)
      Description copied from interface: ActionsHolder
      Remove the action from the component
      Specified by:
      removeAction in interface ActionsHolder
    • removeAction

      public void removeAction(String id)
      Description copied from interface: ActionsHolder
      Remove the action by its ID. If there is no action with that ID, nothing happens.
      Specified by:
      removeAction in interface ActionsHolder
    • removeAllActions

      public void removeAllActions()
      Description copied from interface: ActionsHolder
      Remove all actions from the component
      Specified by:
      removeAllActions in interface ActionsHolder
    • getAction

      @Nullable public Action getAction(String id)
      Specified by:
      getAction in interface ActionsHolder
      Returns:
      an action by its ID, or null if not found
    • getActions

      public Collection<Action> getActions()
      Specified by:
      getActions in interface ActionsHolder
      Returns:
      unmodifiable collection of actions
    • getActionsPermissions

      public ActionsPermissions getActionsPermissions()
      Specified by:
      getActionsPermissions in interface SecuredActionsHolder
      Returns:
      permissions container