IGWiki Main Page

Ricerca pagine
Guida ricerche




IGSuiteJSup JavaCode functions (Bozza)
  Modifica PaginaWiki ViewStorico paginaProprietàGet PdfCalcTranslatorVisualizza il documento in formato stampabile.PreferitesPosso Aiutarti

A JavaCode function is a Java static function written in JavaCode (so it can directly refer to tags, security group, alarm groups, windows) that can be called from other JavaCode script and even from Math code.

It can reduce code duplication when some piece of code is needed from many script.

A JavaCode function can be defined in the following three scope:

  • Shared domain: from JSup Application properties dialog / Shared code or with Alt+Shift+S shortcut. A shared domain JavaCode function can be included (duplicated, using the Include in user domain also flag) in User domain also (keep in mind that is duplicated, so static definitions will be different objects/classes); otherwise a shared domain JavaCode function can be accessed from Shared domain code only.
  • User domain: from JSup Application properties dialog / User code or with Alt+Shift+U shortcut. A user domain JavaCode function can be accessed from User domain scripts / code, that includes window code.
  • Window: from the Window property dialog in the JavaCode funct. tab. A window JavaCode function can be accessed from the window itself.


Here is an example of a JavaCode function definition dialog:

/img/JSup/JavaCodeFunction-example1.png

  • Function name: the name of the JavaCode function. If you enclose a name in curly brackets than the name will be only a reference in the JavaCode function list and the entered code will not be enclosed in a Java static function, but directly inserted in the class that will include all the scope Java code translated from JavaCode. It's usefull to define class(es) instead of function, such class will be accessible from the JavaCode scope.
  • Return type: the type of value that the function will return, use void if no return value will be provied, or enter a Java native time or a class name. For curly brackets JavaCode function leave this field blank.
  • Parameters: the type and name of the parameters that the JavaCode function will accept. Enter the part withing round brackets of a Java function/method definition. For curly brackets JavaCode function leave this field blank.
  • Throws: if the JavaCode function can throw exceptions of some type, enter their type here (separated by commas). The most common type of exception a JavaCode function could throw is JException that is thrown by many internal JavaCode methods when it access tag or other JSup objects. For curly brackets JavaCode function leave this field blank.
  • Comments: an optional descriptive field that can be used to annotate the functionalities of the JavaCode function.
  • Function code: the body of the JavaCode function definition.


Here is an example of a curly brackets JavaCode function that defines a class and methods, like a library:

/img/JSup/JavaCodeFunction-example2.png


Nome: JavaCode functions - Revisione: 0 - Autore: Alessandro Forlani (26.07.2022) - Modificata da: Alessandro Forlani (26.07.2022) - Categoria: JSup - Scadenza: 26.07.2023 - Permessi di visualizzazione: Tutti indistintamente - Permessi di modifica: Solo al proprietario - Copyright © Administrator All right reserved

Need account? Non hai un account?
Login
Password
Secure connection


Ultimi documenti modificati
   
getrss

Documenti recenti
   
    Nessuna corrispondenza trovata