Interface Action

All Superinterfaces:
HasShortcutCombination
All Known Subinterfaces:
ExecutableAction, OperationResultAction, SecuredAction, SecurityConstraintAction, TargetAction<C>, ViewOpeningAction
All Known Implementing Classes:
AbstractAction, AbstractGenericFilterSaveAction, AddAction, AssignToUsersAction, BaseAction, BulkEditAction, ChangePasswordAction, CreateAction, CreateNotificationAction, DateIntervalAction, DaysOfWeekEditAction, DetailCloseAction, DetailDiscardAction, DetailEnableEditingAction, DetailSaveAction, DetailSaveCloseAction, DialogAction, EditAction, EntityClearAction, EntityInspectorAddAction, EntityInspectorCreateAction, EntityInspectorEditAction, EntityInspectorListView.ExportAction, EntityInspectorLookupAction, EntityLookupAction, EntityOpenAction, EntityOpenCompositionAction, ExcelExportAction, ExcludeAction, ExportAction, FragmentAction, GenericFilterAction, GenericFilterAddConditionAction, GenericFilterClearValuesAction, GenericFilterCopyAction, GenericFilterEditAction, GenericFilterMakeDefaultAction, GenericFilterRemoveAction, GenericFilterResetAction, GenericFilterSaveAction, GenericFilterSaveAsAction, GenericFilterSaveWithValuesAction, InputDialogAction, ItemTrackingAction, JsonExportAction, ListDataComponentAction, LogicalFilterEditAction, LogoutAction, LookupDiscardAction, LookupSelectAction, MultiValueSelectAction, OperationResultViewAction, PickerAction, PropertyFilter.OperationChangeAction, ReadAction, RefreshAction, RemoveAction, ResetPasswordAction, RunListEntityReportAction, RunReportAction, RunSingleEntityReportAction, SecuredBaseAction, SecuredListDataComponentAction, ShowEntityInfoAction, ShowExecutionReportHistoryAction, ShowPivotTableAction, ShowRoleAssignmentsAction, ShowUserSubstitutionsAction, SubstituteUserAction, ValueClearAction, ViewAction, ViewCloseAction

public interface Action extends HasShortcutCombination
The Action interface abstracts away a function from a visual component.

The action is executed by invoking its actionPerform(Component) method.

The action itself has no visual representations, but visual components may use its properties to initialize their appearance.

  • Field Details

  • Method Details

    • getId

      String getId()
      Returns:
      action's identifier
    • getText

      @Nullable String getText()
      Returns the text property value of an action. May be used by components to initialize their appearance.
      Returns:
      action's text or null if not set
    • setText

      void setText(@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
    • isEnabled

      boolean isEnabled()
      Returns the enabled property value of an action. May be used by components to initialize their appearance.
      Returns:
      whether the action is currently enabled
    • setEnabled

      void setEnabled(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
    • isVisible

      boolean isVisible()
      Returns the visible property value of an action. May be used by components to initialize their appearance.
      Returns:
      whether the action is currently visible
    • setVisible

      void setVisible(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
    • getIcon

      @Nullable com.vaadin.flow.component.icon.Icon getIcon()
      Returns the icon property value of an action. May be used by components to initialize their appearance.
      Returns:
      action's icon or null if not set
    • setIcon

      void setIcon(@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
    • getDescription

      @Nullable String getDescription()
      Returns the description property value of an action. May be used by components to initialize their appearance.
      Returns:
      action's description or null if not set
    • setDescription

      void setDescription(@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
    • getVariant

      ActionVariant getVariant()
      Returns the variant property value of an action. May be used by components to initialize their appearance.
      Returns:
      action's variant
    • setVariant

      void setVariant(ActionVariant variant)
      Sets the variant property value of an action. May be used by components to initialize their appearance.
      Parameters:
      variant - variant to set
    • refreshState

      void refreshState()
      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

      void actionPerform(com.vaadin.flow.component.Component component)
      Executes action logic.
      Parameters:
      component - Component that triggered this action
    • addPropertyChangeListener

      com.vaadin.flow.shared.Registration addPropertyChangeListener(Consumer<PropertyChangeEvent> listener)
      Adds a listener to be notified about changes in the properties of the action.
      Parameters:
      listener - listener to add
      Returns:
      a registration object for removing an event listener