Class BaseAction<A extends BaseAction<A>>

java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction<A>
All Implemented Interfaces:
Action, HasShortcutCombination
Direct Known Subclasses:
ObservableBaseAction

public class BaseAction<A extends BaseAction<A>> 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 A 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 A 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 A 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 A withIcon(@Nullable com.vaadin.flow.component.Component 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
    • withDescription

      public A 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
    • withVariant

      public A 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 A 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 A 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
    • self

      protected A self()
    • setVisibleInternal

      protected void setVisibleInternal(boolean visible)
    • setEnabledInternal

      protected void setEnabledInternal(boolean enabled)
    • isApplicable

      protected boolean isApplicable()