Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Teraz wykorzystując obiekt 

Javadoc
propertyjavadoc.plusworkflow
classNamecom.suncode.pwfl.workflow.form.action.ActionDefinitionBuilder
 definiujemy akcję:

  • identyfikator:  

 

  • 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
languagejava
linenumberstrue
@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 docelowyPrzypisana 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
propertyjsdoc.plusworkflow
classNamePW.form.action.Actions
 za pomocą metody 
Jsdoc
displayValuecreate
propertyjsdoc.plusworkflow
classNamePW.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
languagejs
linenumberstrue
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);
		}
    }
    
});

...