5.1. ProcActionsFrame
The ProcActionsFrame is designed to work with process actions. After the frame is initialized, the following components will be automatically displayed:
-
the start process button, in case if the process is not started yet
-
the buttons for task outcomes, in case the process is started and the current user has an active task
-
the cancel process button
-
the task information panel (name and creation date)
A predicate can be assigned to each of the process actions in order to check if the action can be performed (e.g. the predicate commits an editor and if the commit failed, the process action is not performed). The post-action listener can also be defined (e.g. the listener will close the editor and show a notification).
The ProcActionsFrame must be linked with the ProcInstance. The linking is performed during frame initialization.
An example of frame initialization:
procActionsFrame.initializer()
.setBeforeStartProcessPredicate(this::commit)
.setAfterStartProcessListener(showNotification(getMessage("processStarted"), NotificationType.HUMANIZED))
.init(PROCESS_CODE, entity);
-
The
initializer()method returns an object that is used for frame initialization. -
The
setBeforeStartProcessPredicatemethod sets the predicate that will be evaluated before the process start. If the predicate returnsfalsethen the process start will be interrupted. -
The
setAfterStartProcessListenermethod defines a listener that will be invoked after the process start action is performed. -
The
initmethod has two parameters: process code and entity instance. When this method is invoked, a search for theProcInstanceobject that is related with the entity instance and has a reference to theProcDefinitionwith the given code is performed. If theProcInstanceexists then the frame is linked to it, otherwise a newProcInstanceobject is created.
Other methods used for customizing the frame are described in class JavaDocs.