Serwis VariableService pozwala zarządzać nietabelarycznymi zmiennymi formularza. Posiada następujące funkcje:

  • get - pobiera komponent zmiennej formularza.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)


    • Rezultat funkcji:

      TypOpis
      Ext.ComponentKomponent zmiennej procesu lub undefined, jeśli nie znaleziono
  • getName - zwraca nazwę zmiennej formularza z uwzględnieniem tłumaczenia (widoczną w etykiecie).
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)


    • Rezultat funkcji:

      TypOpis
      StringNazwa zmiennej formularza lub null, jeśli nie znaleziono zmiennej formularza
  • getValue - zwraca wartość zmiennej formularza.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      asStringBooleanfalseInformuje, czy wartość ma zostać zwrócona w postaci stringa (ma znaczenie dla dat, liczb oraz pól typu radiobutton i checkbox)


    • Rezultat funkcji:

      TypOpis
      Object/StringWartość zmiennej formularza lub null, jeśli nie znaleziono zmiennej formularza. Typ odpowiedzi zależy od wartości parametru asString



  • setValue - ustawia wartość zmiennej formularza (nie zmienia wartości zmiennych, które są tylko do podglądu).
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      valueObjectnullWartość zmiennej formularza


    • Rezultat funkcji: brak

 

  • setDescription - ustawia opis zmiennej formularza.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      descriptionStringnullOpis zmiennej formularza


    • Rezultat funkcji: brak

 

  • setStyle - ustawia style HTML zmiennej
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      labelStyleObjectnullObiekt zawierający style HTML, które będą zaaplikowane do etykiety zmiennej, np.: { "color": "red", "font-size": "16px" }
      fieldStyleObjectnullObiekt zawierający style HTML, które będą zaaplikowane do pola zmiennej, np.: { "color": "red", "font-size": "16px" }


    • Rezultat funkcji: brak

 

  • hide - ukrywa zmienne formularza (w tym tabele dynamiczne).
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      variablesString/String[]nullIdentyfikator lub tablica identyfikatorów zmiennych formularza (identyfikatory zmiennych procesu)


    • Rezultat funkcji: brak

 

  • show - pokazuje zmienne formularza (w tym tabele dynamiczne).
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      variablesString/String[]nullIdentyfikator lub tablica identyfikatorów zmiennych formularza (identyfikatory zmiennych procesu)


    • Rezultat funkcji: brak

 

  • disable - blokuje możliwość wpisywania wartości do pola.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      silentBooleanfalseInformuje, czy wywoływać zdarzenie dla zablokowania pola
      enableSubmitBooleanfalseInformuje, czy mimo zablokowania zmiennej wysyłać jej wartość do serwera podczas akceptacji/zapisu formularza


    • Rezultat funkcji: brak

 

  • enable - odblokowuje możliwość wpisywania wartości do pola.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      silentBooleanfalseInformuje, czy wywoływać zdarzenie dla odblokowania pola


    • Rezultat funkcji: brak

 

  • showLoadingIndicator - maskuje pole wyświetlając informację, że wykonywane jest na nim zdarzenie, możliwe jest podanie także dodatkowej informacji tekstowej.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      messageString'Loading...'Dodatkowa informacja tekstowa


    • Rezultat funkcji: brak

 

  • hideLoadingIndicator - usuwa maskę z pola informującą o wykonywaniu zdarzenia na tym polu.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)


    • Rezultat funkcji: brak

 

  • markError - dodaje pod polem informacje o błędach.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      errorsString/String[]nullTreść błędu/błędów


    • Rezultat funkcji: brak

 

  • unmarkError - usuwa spod pola informacje o błędach.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)


    • Rezultat funkcji: brak

  • addEvent - dodaje zdarzenie (akcję) do pola na formularzu.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      eventNameStringnullNazwa zdarzenia (patrz dokumentacja Ext JS)
      handlerFunctionnullFunkcja obsługująca zdarzenie
      scopeObjectExt.Component reprezentujący pole na formularzu, dla którego wystąpiło zdarzenieScope w funkcji podanej w parametrze handler


    • Rezultat funkcji: brak

 

  • removeEvent - usuwa zdarzenie (akcję) z pola na formularzu. Należy przekazać do funkcji takie same parametry jak do funkcji addEvent w celu poprawnego usunięcia zdarzenia (akcji) z pola formularza.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      eventNameStringnullNazwa zdarzenia (patrz dokumentacja Ext JS)
      handlerFunctionnullFunkcja obsługująca zdarzenie
      scopeObjectExt.Component reprezentujący pole na formularzu, dla którego wystąpiło zdarzenieScope w funkcji podanej w parametrze handler


    • Rezultat funkcji: brak

  • addAutoUpdate - dodaje definicję akcji AUTO_UPDATE do pola na formularzu. Wymaga przygotowania servletu, który opiera się na takim samym działaniu jak podczas wykonywania akcji AUTO_UPDATE określonej w mapie procesu.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)
      configObject{ }

      Obiekt definicji akcji AUTO_UPDATE. Posiada następujące pola:
      - override (Typ: Boolean) - informuje, czy nadpisać istniejącą definicję akcji AUTO_UPDATE, jeżeli pole już ją posiada, wartość domyślna: false
      destinations (Typ: tablica obiektów) - zmienne wynikowe, których wartość jest ustawiana po wykonaniu akcji serwerowej, obiekty w tablicy posiadają pola: id - identyfikator zmiennej na formularzu, errorMessage - tekst wyświetlany przy zmiennej formularza, gdy nie uda się ustawić jej wartości, wartość domyślna: pusta tablica)
      - errorMessage (Typ: String) - tekst wiadomości o globalnym błędzie podczas wykonywania akcji, wartość domyślna: null
      - eventType (Typ: String) - typ zdarzenia, który spowoduje wywołanie się akcji dla danej zmiennej na formularzu, możliwe jest wykorzystanie trzech typów zdarzeń: blur (wyjście z pola), change (zmiana wartości w polu), select (wybranie wartości z listy rozwijanej), wartość domyślna: 'blur'
      - loadingText (Typ: String) - treść informacji wyświetlana na zmiennej formularza, której dotyczy wywołanie akcji oraz na wszystkich zmiennych określonych w destinations, wartość domyślna: 'Loading...'

      - dataSources (Typ: tablica stringów) - zmienne, których wartości są przekazywane do serwera, wartość domyślna: pusta tablica

      taskName (Typ: String) - nazwa wykonywanego servletu, wartość domyślna: null


    • Rezultat funkcji: brak

ServiceFactory.getVariableService().addAutoUpdate( 'kwota_netto', {
    dataSources: [ 'kwota_netto', 'kwota_vat', '\'ADD\'' ],
    destinations: [ {
        id: 'kwota_brutto',
        errorMessage: 'Błąd ustawiania wartości kwoty brutto.'
    } ],
    taskName: 'com.plusmpm.servlet.extension.CUF.AmountCalculator.customServlet',
    errorMessage: 'Wystąpił błąd.',
    eventType: 'blur',
    loadingText: 'Trwa przeliczanie...'
} );

 

  • removeAutoUpdate - usuwa definicję akcji AUTO_UPDATE z pola na formularzu.
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej formularza (identyfikator zmiennej procesu)


    • Rezultat funkcji: brak

  • suspendAutoMapping - wstrzymuje automatyczne podciąganie auto mappingów dla DC
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idsString/String[]nullIdentyfikator lub tablica identyfikatorów zmiennych dla których ma zostać wstrzymane automatyczne podciąganie mappingów


    • Rezultat funkcji: brak

  • resumeAutoMapping - wznawia automatyczne podciąganie auto mappingów dla DC
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idsString/String[]nullIdentyfikator lub tablica identyfikatorów zmiennych dla których ma zostać wznowione automatyczne podciąganie mappingów


    • Rezultat funkcji: brak

  • isAutoMappingSuspended - sprawdza, czy dla podanej zmiennej wstrzymane jest automatyczne podciąganie mappingów
    • Parametry funkcji

      NazwaTyp

      Wartość domyślna

      Opis
      idStringnullIdentyfikator zmiennej


    • Rezultat funkcji:

      TypOpis
      booleantrue, jeżeli dla podanej zmiennej wstrzymane jest automatyczne podciąganie mappingów. W przeciwnym wypadku false.
  • syncDataChooserMappings (od 3.2.111) - odświeża mappingi datachoosera. W systemie musi być aktywowana opcja automappingów.
    • Parametry funkcji:

      NazwaTyp

      Wartość domyślna

      Opis
      dataChooserIdStringnullIdentyfikator zmiennej (datachoosera)
    • Rezultat funkcji: brak

VariableServiceallows you to manage non-logical variables of the form. It has the following functions:

  • get- gets the form variable component.
  • Function parameters:

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

 

  • Function result:

Type

Description

Ext.Component

Process variable component or undefined if it is not found

  • getName- returns the name of the form variable including translation (shown in the label).
  • Function parameters:

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

 

  • Function results:

Type

Description

String

Name of the form variable or null if the form variable is not found

  • getValue- returns the value of the form variable.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

asString

Boolean

false

Indicates whether the value should be returned in the form of a string (it is important for dates, numbers and radiobutton and checkbox fields)

 

  • Function results:

Type

Description

Object/String

The value of the form variable or null if the form variable is not found. The type of response depends on the value of the asString parameter

 

  • Function parameters:
  • setValue- sets the value of the form variable (does not change the values of variables that are only for preview).

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

value

Object

null

Value of the form variable

  • Function results:null

 

  • setDescription- sets the description of the form variable.

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

description

String

null

Description of the form variable

  • Function results:null

 

  • setStyle - sets the HTML style of the variable
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

labelStyle

Object

null

An object containing HTML styles that will be applied to the variable label, e.g. {color: "red", "font-size": "16px"}

fieldStyle

Object

null

An object containing HTML styles that will be applied to a variable field, e.g. {color: "red", "font-size": "16px"}

  • Function results:null

 

  • hide- hides form variables (including dynamic tables).
  • Function parameters: 

Name

Type

Default value

Description

variables

String/String[]

null

Identifier or array of form variable identifiers (process variable identifiers)

  • Function results:null

 

  • show- shows form variables (including dynamic tables).
  • Function parameters: 

Name

Type

Default value

Description

variables

String/String[]

null

Identifier or array of form variable identifiers (process variable identifiers)

  • Function results:null

 

  • disable- blocks the ability to enter values into the field.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

silent

Boolean

false

Indicates whether to trigger an event to block the field

enableSubmit

Boolean

false

It tells you whether despite variable is blocked to send its value to the server when you accept/save the form

  • Function results:null

 

  • enable- unblocks the ability to enter values into the field.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

silent

Boolean

false

Indicates whether to trigger an event to unblock a field.

  • Function results:null

 

  • showLoadingIndicator - masks the field displaying information that an event is being carried out on it, it is also possible to provide additional text information.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

message

String

'Loading...'

Additional text information

  • Function results:null

 

  • hideLoadingIndicator- removes the mask from the field informing about the event execution on this field.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

  • Function results:null

 

  • markError - adds error information below the field.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

errors

String/String[]

null

The content of the error/errors

  • Function results:null

 

  • unmarkError - removes information about errors from the field.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

 

  • Function parameters:
  • Function results:null
  • addEvent - adds an event (action) to the field on the form.

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

eventName

String

null

Event name (see Ext JS documentation)

handler

Function

null

Function that handles the event

scope

Object

Ext.Component representing the field on the form for which the event occurred

Scope in the function specified in the handler parameter

  • Function results:null

 

  • removeEvent - removes the event (action) from the field on the form. You must pass the same parameters to the function as for the addEvent function in order to correctly delete the event (action) from the form field.
  • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

eventName

String

null

Event name (see Ext JS documentation)

handler

Function

null

Function that handles the event

scope

Object

Ext.Component representing the field on the form for which the event occurred

Scope in the function specified in the handler parameter

 

  • Function parameters:
  • Function results:null
  • addAutoUpdate - adds the AUTO_UPDATEaction definition to the field on the form. It requires preparation of a servlet, which is based on the same action as when performing the AUTO_UPDATE action specified in the process map.

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

config

Object

{ }

AUTO_UPDATEaction definition object. It has the following fields:
override (Type: Boolean) - tells whether to overwrite the existing AUTO_UPDATE action definition if the field already has it, the default value is false
destinations(Type: table of objects) – consecutive variables, which value is set after the server action, objects in the table have fields: id - variable identifier on the form, errorMessage - text displayed at the form variable, when its value can not be set, default value: empty table)
errorMessage(Type: String) - the text of the global error message when executing the action, the default value is: null
eventType(Type: String) - type of event that will trigger an action for a given variable on the form, it is possible to use three types of events: blur (exit from the field), change (change value in the field), select (select a value from the drop-down list), default value: ' blur '
loadingText(Type: String) information content displayed on the variable of the form to which the action is applied and on all variables defined in destinations, default value: 'Loading ...'

dataSources(Type: string array) - variables whose values are passed to the server, default value: empty table

taskName(Type: String) - name of the servlet being executed, default value: null

  • Function results:null

Call function example

ServiceFactory.getVariableService().addAutoUpdate( 'net_value', {
    dataSources: [ 'net_value', 'vat_value', '\'ADD\'' ],
    destinations: [ {
        id: 'gross_value',
        errorMessage: ‘Error setting gross value'
    } ],
    taskName: 'com.plusmpm.servlet.extension.CUF.AmountCalculator.customServlet',
    errorMessage: 'An error occurred.',
    eventType: 'blur',
    loadingText: 'Calculating...'
} );

 

  • removeAutoUpdate - deletes the AUTO_UPDATEaction definition from the field on the form.
    • Function parameters: 

Name

Type

Default value

Description

id

String

null

Form variable identifier (process variable identifier)

 

  • Function parameters:
  • Function results:null
  • suspendAutoMapping -suspends automatic pulling of auto mappings for DC

Name

Type

Default value

Description

ids

String/String[]

null

Identifier or table of variable identifiers for which automatic mapping will be suspended

 

  • Function parameters:
  • Function results:null
  • resumeAutoMapping - resumes automatic pulling of auto mappings for DC

Name

Type

Default value

Description

ids

String/String[]

null

Identifier or table of variable identifiers for which automatic mapping will be resumed

 

  • Function parameters:
  • Function results:null
  • isAutoMappingSuspended - checks whether automatic mapping is suspended for the given variable

Name

Type

Default value

Description

id

String

null

Identifier of the variable

 

  • Function results:

Type

Description

boolean

True, if the automatic mapping is suspended for the given variable. Else false.