AkcjaAkcje formularza to komponenty użytkownika, umożliwiające wykonywanie dowolnych akcji na formularzu zadania w reakcji na działania użytkownika, zmiany danych czy też inne zdarzenia formularza. Przykładowe akcje mogą np.
Stworzone akcje dostępne są w edytorze procesów i mogą być łatwo wykorzystane w procesie biznesowym umożliwiając tym samym realizacje logiki biznesowej. Ich zachowanie może być dodatkowo konfigurowane za pomocą parametrów.
Definiowanie akcjiAkcje tworzone są w oparciu o ich definicję stworzoną przez użytkownika. Definicja taka musi zawierać następujące elementy:
Akcja może również dostarczać skrypt, który buduje wygląd parametrów podczas jej definiowania w PWE. W tym celu należy dodać kolejną adnotację dla klasy Przykładowa definicja przedstawiona jest poniżej:
Przykładowa definicja dla akcji umieszczonej zarówno na formularzu, jak i w historii:
Elementy docelowe (destination)Elementy docelowe wskazywane są na etapie tworzenia definicji akcji w metodzie
Inicjalizacja akcji
Twórca procesu w akcji określić może jej typ inicjalizacji. Dostępne typy:
Wybrany parametr jest możliwy do odczytu w akcji w funkcji getInitializationType. Ustawienie tego parametru NIE WPŁYWA na działanie akcji, jeżeli nie zaimplementował tego twórca akcji. Przypisanie elementu docelowego do parametru (bindTo)Wybrany element docelowy akcji może zostać przekazany do parametru akcji poprzez podanie w parametrze
Z tak skonfigurowaną akcją, jeżeli dodamy ją do dowolnej zmiennej, zmienna to zostanie automatycznie ustawiona jako wartość parametru. W zależności od elementu docelowego w parametr wpisane zostaną:
Implementacja akcjiZdefiniowana na serwerze akcja formularza musi zostać zarejestrowana i zaimplementowana po stronie przeglądarki. Rejestrację umożliwia klasa
Akcje domyślneW celu ułatwienia tworzenia akcji które reagują na domyślne zdarzenia elementów docelowych możliwe jest zdefiniowanie tzw. akcji domyślnych. Twórca akcji może zadeklarować funkcje, które wykonają się automatycznie, jeżeli wystąpi zdarzenie skojarzone z elementem docelowym akcji np. jeżeli akcja dodana jest do przycisku, to klikniecie w ten przycisk spowoduje wywołanie zdefiniowanej akcji domyślnej.
Zdarzenia domyślne w zależności od elementu docelowego akcji:
Poniżej przykładowa implementacja akcji pokazującej skonfigurowaną wiadomość. W zależności od elementu docelowego wiadomość pokaże się przy naciśnięciu przycisku, zmianie wartości zmiennej lub zmianie danych w tabelce.
Wiele źródeł (targetów) akcji
Możliwe jest określenie więcej niż jednego źródła (targetu) dla akcji np. w celu wywołania dokładnie tej samej akcji, jeżeli została zmieniona wartość jednej z wielu określonych zmiennych. Aby dodać wsparcie do wielu targetów dla akcji, w builderze należy wywołać multitarget():
Jeżeli akcja została dodana (przeciągnięta) do:
możliwe jest dodanie kolejnych obiektów tego samego typu jako źródeł wywoływania akcji. Jeżeli źródłem jest tabela, kolejno dodawane obiekty muszą być zmiennymi tabelarycznymi. Akcja pozostaje jednym i tym samym obiektem JavaScriptowym, lecz więcej niż jeden obiekt może wywołać zdarzenia defaultActions:
Również inicjalizacja akcji dla określonych zmiennych zmienia nieznacznie swoje zachowanie:
Symbol błyskawicy zostaje wyświetlony przy każdym z dodanych targetów, lecz edycja takiej akcji jest globalna. Rejestracja akcji we wtyczceJeżeli akcja jest definiowana we wtyczce to należy dodatkowo zaznaczyć, że wtyczka ta udostępnia akcje. W tym celu należy w pliku suncode-plugin.xml dodać wpis:
|
ActionForm actions are user components that allow you to perform any action on the task form in response to user actions, data changes or other form events. Examples of actions can, for example.
The created actions are available in the process editor and can be easily used in the business process enabling the execution of business logic. Their behavior can be further configured using parameters.
Defining actionsActions are created based on their definition created by the user. Such a definition must contain the following elements:
An action can also provide a script that builds the appearance of parameters when it is defined in the PWE. To do this, add another annotation for the class An example definition is shown below:
Sample definition for an action placed both on the form and in the history:
Destination elements (destination)
Destination elements are indicated at the action definition stage in the
Action initialization
The creator of the process in action can specify its initialization type. Available types:
The selected parameter is readable by the action in the getInitializationType function. Setting this parameter DOES NOT affect the operation of the action unless the action creator has implemented it. Assigning a target element to a parameter (bindTo)The selected target element of the action can be transferred to the action parameter by specifying the target parameter ID in the
With the action configured in this way, if we add it to any variable, the variable will automatically be set as the value of the parameter. Depending on the target element in the parameter will be entered:
Implementation of actionsThe form action defined on the server must be registered and implemented on the browser side. Registration is enabled by the class
Default actionsIn order to simplify the creation of actions that react to default events of target elements, it is possible to define so-called default actions. The creator of the action can declare functions that will execute automatically if an event associated with the target element of the action occurs, e.g. if the action is added to a button, clicking on this button will trigger the defined default action.
Default events depending on the action target element:
Below is an example implementation of an action showing a configured message. Depending on the target element, the message will show when you press a button, change the value of a variable or change the data in a table.
Multiple sources (targets) of action
It is possible to specify more than one source (target) for an action, for example, to call exactly the same action if the value of one of the many specified variables has been changed. To add support for multiple targets for an action, call multitarget() in the builder:
If the action has been added (dragged) to:
it is possible to add more objects of the same type as sources for calling the action. If the source is a table, the successively added objects must be table variables. The action remains one and the same JavaScript object, but more than one object can trigger defaultActions events:
Also, initialization of actions for specified variables changes its behavior slightly:
The lightning symbol is displayed with each added target, but editing such an action is global. Registration of actions in the pluginIf the action is defined in the plugin then you should additionally indicate that the plugin provides the action. To do this, add an entry in the suncode-plugin.xml file:
|