Class BaseAction

java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction
All Implemented Interfaces:
Action, HasShortcutCombination
Direct Known Subclasses:
LogoutAction, PropertyFilter.OperationChangeAction, SecuredBaseAction, SubstituteUserAction

public class BaseAction extends AbstractAction
Base implementation of Action.
  • Field Details

    • enabledExplicitly

      protected boolean enabledExplicitly
    • visibleExplicitly

      protected boolean visibleExplicitly
  • Constructor Details

    • BaseAction

      public BaseAction(String id)
  • Method Details

    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: Action
      Sets the visible property value of an action. May be used by components to initialize their appearance.
      Specified by:
      setVisible in interface Action
      Overrides:
      setVisible in class AbstractAction
      Parameters:
      visible - whether the action is currently visible
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: Action
      Sets the enabled property value of an action. May be used by components to initialize their appearance.
      Specified by:
      setEnabled in interface Action
      Overrides:
      setEnabled in class AbstractAction
      Parameters:
      enabled - whether the action is currently enabled
    • refreshState

      public void refreshState()
      Description copied from interface: Action
      Refreshes internal state of the action to initialize enabled, visible, text, icon, etc. properties depending on programmatically set values and user permissions set at runtime.

      For example, this method is called by visual components holding actions when they are bound to data. At this moment the action can find out what entity it is connected to and change its state according to the user permissions.

    • actionPerform

      public void actionPerform(com.vaadin.flow.component.Component component)
      Description copied from interface: Action
      Executes action logic.
      Parameters:
      component - Component that triggered this action
    • addActionPerformedListener

      public com.vaadin.flow.shared.Registration addActionPerformedListener(Consumer<ActionPerformedEvent> listener)
      Adds a listener to be notified when action is performed.
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener
    • withText

      public BaseAction withText(@Nullable String text)
      Sets the text property value of an action. May be used by components to initialize their appearance.
      Parameters:
      text - text to set or null to remove
      Returns:
      this object
    • withEnabled

      public BaseAction withEnabled(boolean enabled)
      Sets the enabled property value of an action. May be used by components to initialize their appearance.
      Parameters:
      enabled - whether the action is currently enabled
      Returns:
      this object
    • withVisible

      public BaseAction withVisible(boolean visible)
      Sets the visible property value of an action. May be used by components to initialize their appearance.
      Parameters:
      visible - whether the action is currently visible
      Returns:
      this object
    • withIcon

      public BaseAction withIcon(@Nullable com.vaadin.flow.component.icon.Icon icon)
      Sets the icon property value of an action. May be used by components to initialize their appearance.
      Parameters:
      icon - icon to set or null to remove
      Returns:
      this object
    • withIcon

      @Deprecated(since="2.4", forRemoval=true) public BaseAction withIcon(@Nullable com.vaadin.flow.component.icon.VaadinIcon icon)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the icon property value of an action. May be used by components to initialize their appearance.
      Parameters:
      icon - icon to set or null to remove
      Returns:
      this object
    • withDescription

      public BaseAction withDescription(@Nullable String description)
      Sets the description property value of an action. May be used by components to initialize their appearance.
      Parameters:
      description - description to set or null to remove
      Returns:
      this object
    • withTitle

      @Deprecated(since="2.5", forRemoval=true) public BaseAction withTitle(@Nullable String title)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets the description property value of an action. May be used by components to initialize their appearance.
      Parameters:
      title - description to set or null to remove
      Returns:
      this object
    • withVariant

      public BaseAction withVariant(ActionVariant variant)
      Sets the variant property value of an action. May be used by components to initialize their appearance.
      Parameters:
      variant - variant to set
      Returns:
      this object
    • withShortcutCombination

      public BaseAction withShortcutCombination(@Nullable KeyCombination shortcutCombination)
      Sets object that stores information about keys, modifiers and additional settings that describe shortcut combinations.
      Parameters:
      shortcutCombination - key combination to set or null to remove
      Returns:
      this object
    • withHandler

      public BaseAction withHandler(@Nullable Consumer<ActionPerformedEvent> handler)
      Adds a listener to be notified when action is performed.
      Parameters:
      handler - listener to add or null to remove all
      Returns:
      this object
    • setVisibleInternal

      protected void setVisibleInternal(boolean visible)
    • setEnabledInternal

      protected void setEnabledInternal(boolean enabled)
    • isApplicable

      protected boolean isApplicable()