Class SecuredBaseAction

All Implemented Interfaces:
SecuredAction, Action, HasShortcutCombination
Direct Known Subclasses:
DialogAction, FragmentAction, GenericFilterAction, ListDataComponentAction, PickerAction, ViewAction

public class SecuredBaseAction extends BaseAction implements SecuredAction
  • Field Details

    • enabledByUiPermissions

      protected boolean enabledByUiPermissions
    • visibleByUiPermissions

      protected boolean visibleByUiPermissions
    • enabledRules

      protected List<SecuredBaseAction.EnabledRule> enabledRules
  • Constructor Details

    • SecuredBaseAction

      public SecuredBaseAction(String id)
  • Method Details

    • 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.

      Specified by:
      refreshState in interface Action
      Overrides:
      refreshState in class BaseAction
    • isEnabledByUiPermissions

      public boolean isEnabledByUiPermissions()
      Specified by:
      isEnabledByUiPermissions in interface SecuredAction
    • setEnabledByUiPermissions

      public void setEnabledByUiPermissions(boolean enabledByUiPermissions)
      Specified by:
      setEnabledByUiPermissions in interface SecuredAction
    • isVisibleByUiPermissions

      public boolean isVisibleByUiPermissions()
      Specified by:
      isVisibleByUiPermissions in interface SecuredAction
    • setVisibleByUiPermissions

      public void setVisibleByUiPermissions(boolean visibleByUiPermissions)
      Specified by:
      setVisibleByUiPermissions in interface SecuredAction
    • isPermitted

      protected boolean isPermitted()
    • isEnabledByRule

      protected boolean isEnabledByRule()
    • addEnabledRule

      public void addEnabledRule(SecuredBaseAction.EnabledRule enabledRule)
      Add new enabled rule for the action.
      Parameters:
      enabledRule - boolean rule for the action enabled state
    • removeEnabledRule

      public void removeEnabledRule(SecuredBaseAction.EnabledRule enabledRule)
      Remove enabled rule.
      Parameters:
      enabledRule - boolean rule for the action enabled state
    • withText

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

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

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

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

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

      public SecuredBaseAction withTitle(@Nullable String title)
      Description copied from class: BaseAction
      Sets the description property value of an action. May be used by components to initialize their appearance.
      Overrides:
      withTitle in class BaseAction
      Parameters:
      title - description to set or null to remove
      Returns:
      this object
    • withVariant

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

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

      public SecuredBaseAction withHandler(@Nullable Consumer<ActionPerformedEvent> handler)
      Description copied from class: BaseAction
      Adds a listener to be notified when action is performed.
      Overrides:
      withHandler in class BaseAction
      Parameters:
      handler - listener to add or null to remove all
      Returns:
      this object
    • withEnabledByUiPermissions

      public SecuredBaseAction withEnabledByUiPermissions(boolean enabledByUiPermissions)
    • withVisibleByUiPermissions

      public SecuredBaseAction withVisibleByUiPermissions(boolean visibleByUiPermissions)