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, from button and table context menu). Action also defines some common properties, such as caption, keyboard shortcut, flags of accessibility and visibility, etc.
Visual components associated with an action can be of two types:
An action is linked to the component by invoking the
ActionOwner.setAction()method of the component. At this point, the component replaces its properties with corresponding properties of the action (see components overview for details).
Visual components containing several actions implement the
Component.ActionsHolderinterface. These are
Fragment, DataGrid, Table and its inheritors, Tree, PopupButton, PickerField, LookupPickerField.
ActionsHolder.addAction()method is used to add actions to the component. Implementation of this method in the component checks whether it already contains an action with the same identifier. If yes, then the existing action will be replaced with the new one. Therefore, it is possible, for example, to declare a standard action in a screen descriptor and then create a new one in the controller with different properties and add it to the component.