...
Teraz wykorzystując obiekt
Javadoc |
---|
property | javadoc.plusworkflow |
---|
className | com.suncode.pwfl.workflow.form.action.ActionDefinitionBuilder |
---|
|
definiujemy akcję:
- unikalny identyfikator akcji
- nazwa: wyświetlana nazwa akcji (bądź klucz tłumaczenia)
- opis: wyświetlany opis akcji (bądź klucz tłumaczenia)
- kategoria: kategorie akcji
- element docelowy: elementy docelowe akcji
- ikona: ikona wyświetlana w edytorze procesów (Ikony)
- parametry: lista prametrów akcji
Code Block |
---|
language | java |
---|
linenumbers | true |
---|
|
@Define
public void logger( ActionDefinitionBuilder action )
{
action
.id( "logger" )
.name( "actions.logger.name" )
.description( "actions.logger.desc" )
.category( Categories.DEBUG )
.destination( ActionDestination.form() )
.icon( SilkIconPack.APPLICATION_OSX_TERMINAL )
.parameter()
.id( "msg" )
.name( "actions.logger.param.msg.name" )
.description( "actions.logger.param.msg.desc" )
.type( Types.STRING )
.create()
.parameter()
.id( "error" )
.name( "actions.logger.param.level.name" )
.description( "actions.logger.param.level.name" )
.type( Types.BOOLEAN )
.create();
} |
...
Element docelowy | Przypisana wartość |
---|
Zmienna | Zmienna |
Tabelka dynamiczna | Identyfikator tabelki dynamicznej |
Przycisk | Identyfikator przycisku (nazwa akcji) |
Implementacja akcji
Zdefiniowana na serwerze akcja formularza musi zostać zarejestrowana i zaimplementowana po stronie przeglądarki. Rejestrację umożliwia klasa
Jsdoc |
---|
property | jsdoc.plusworkflow |
---|
className | PW.form.action.Actions |
---|
|
za pomocą metody
Jsdoc |
---|
displayValue | create |
---|
property | jsdoc.plusworkflow |
---|
className | PW.form.action.Actions.html#method_create |
---|
|
. Pierwszym parametrem metody jest
id akcji (id musi odpowiadać tej akcji, która została zdefiniowana na serwerze), drugim parametrem jest
obiekt konfiguracyjny implementacji akcji.:
Code Block |
---|
language | js |
---|
linenumbers | true |
---|
|
var variableService = ServiceFactory.getVariableService(),
messageService = ServiceFactory.getMessageService(),
Action = {
t: PW.I18N.createT('com.suncode-actions-plugin')
};
PW.FormActions.create('hiding-variables-action', {
init: function(){
var me = this,
variables = me.get("variables");
me.variables = [];
jQuery.each(variables, function(index, variable){
me.variables.push(variable.getId());
});
},
enable: function(){
this.hideVariables();
this.showMessage();
},
disable: function(){
this.showVariables();
},
hideVariables: function() {
this.setVariablesVisibility(false);
},
showMessage: function() {
var message = Action.t('action.hiding.variables.success', this.variables);
messageService.showSuccess(message);
},
showVariables: function() {
this.setVariablesVisibility(true);
},
setVariablesVisibility: function(visible) {
if(visible) {
variableService.show(this.variables);
}
else {
variableService.hide(this.variables);
}
}
}); |
...