Process Actions
When the user interacts with an interface and requests an action (for example, by clicking a button Ok, when finishing editing content), a process action is triggered (process action).
In the context of DOUI interfaces, each process action is executed through one or more objects, called handlers, which will actually process the action requested by the user. Each interface defines its process actions and respective handlers.
A process action is triggered from the control that received the interaction (for example, in the case of the button OK, the lum_button control is used). The interface controls send their values as parameters to the process action, and then, each configured handler is executed in the defined sequence. The controls can trigger the execution of one or more process actions in response to a user action.
Each process action handler consists of a class that implements the Java IProcessActionHandler
interface, normally extending the generic class ProcessActionHandler.
Each handler can generate a response, containing parameters to be used in rendering the interface, called rendering parameters (render parameters). An example of a response would be “doui_closeWindow”, used by interfaces that run in a pop-up window (for example, when adding content). After saving the data, this response contains a rendering parameter that instructs the interface to render only the Javascript code to close the window, instead of the normal HTML of the interface.
The execution of process actions is performed by the ProcessActionContainer which is responsible for instantiating the classes that implement the IProcessActionHandler interface and will have the following life cycle:
- Execution of the init method;
- Execution of the setParameter method passing all defined parameters;
- Execution of the processAction method.
To facilitate the implementation of an IProcessActionHandler
, one can extend the ProcessActionHandler
class and implement only the processAction
method.
ProcessActionHandler
It is a class that implements the IProcessActionHandler interface and executes operations such as: adding, editing, and deleting records. Therefore, there are four types of process action handlers:
- generic: this process action handler simply executes the responses that are in its definition. It is implemented by
GenericProcessActionHandler
. - tableAddData, tableUpdateData, and tableDeleteData: these process actions handlers are used to add, update, and remove data from persistence respectively. Their implementations are appropriate when using TableSource with its standard data mapping form (the source with type=“table”).
The classes that implement each of these process actions handlers are, respectively:
- tableAddMultiRow and tableUpdateMultiRow: these process action handlers are used to add and update. TableSource is also used as the standard data mapping form (the source with type=“table”).
The classes that implement each of these process actions handlers are, respectively: