Actions

Action is an interface that abstracts an action (in other words, some function) from a visual component. It is particularly useful when the same action can be invoked from different visual components (for example, both from a button and a table context menu). Action also defines some common properties, such as caption, keyboard shortcuts, flags of accessibility and visibility, etc.

Creating Actions

The framework supplies a collection of Standard Actions for views, list components, and picker components. Besides, you can create custom actions using one of the three approaches:

Components that Can Host Actions

The following components can host actions:

  • Single-action components implement the HasAction interface. For example, button. To set an action use HasAction.setAction().

  • Multi-action components implement the HasActions interface. For example: dataGrid, entityComboBox, entityPicker. To set an action use HasActions.addAction().

    The implementation checks for an existing action with the same identifier; if found, it replaces the old action. This allows a standard action declared in a view descriptor to be overridden programmatically in a controller with different properties.
  • Views themselves can contain actions. Define them in the top‑level <actions> XML element or add programmatically using the getViewActions.addAction() method of the view class.