Home
Categories
Dictionary
Download
Project Details
Changes Log
Who We Are
FAQ
License

Editor ScriptHelper



The script always have access to an instance of the EditorScriptHelper class called helper.

User dialogs

The user can use the EditorScriptHelper to ask the user for properties which can be used to configure the computing. For example the following script will ask for a name at the start of the Script:
      String shortName;

      public void start() {
      shortName = helper.askForProperty("Short Name");
      }

Get widget properties values

Several methods allow to get various widget properties values:
  • getPropertyValue(ServerWidget, String): get the value of a widget property by its ARINC ID[1]
    For example getPropertyValue(theLabel, "A661_STRING") will return the String label of a Label widget
  • getPropertyAsName(ServerWidget, String): get the value of a widget property by its name[2]
    For example getPropertyAsName(theLabel, "LabelString") will return the String label of a Label widget
  • getPropertyID(ServerWidget, String): get the ARINC ID of a widget property knowing its name[3]
    For example getPropertyID(theLabel, "LabelString") will return "A661_STRING"
  • hasProperty(ServerWidget, String): return true if the widget has a property with a specified ARINC ID
  • hasPropertyByName(ServerWidget, String): return true if the widget has a property with a specified name
  • getPropertyValueAsxxx(ServerWidget, String): get the property value of a widget property knowing its ARINC ID . This eventually converted in a specific type
  • getAllChildren(ServerWidget): get all the children of a container, including children of children
  • getAllParents(ServerWidget): get all the parents of a widget, going from the direct parent to the root of the hierarchy
  • getPositionInLayer(ServerWidget): get the position of a widget in its Layer in 100th of mm

Get Look and Feel characteristics

  • getFont(char): get the Font of a specified ID
  • getStringBounds(ServerWidget, String): get the width and height in 100th of mm for a widget in the current Look and Feel[4]
    For example, it will take into account the StyleSet of the widget
  • getStringWidth(String, ARINCFont) and getARINCStringWidth(String, ARINCFont): get the width of a String for a Font

Update widgets properties

  • setParameter(ServerWidget, String, Object): set the property of a widget using the property ARINC ID
  • setParameterAsName(ServerWidget, String, Object): set the property of a widget using the property name
  • setWidgetName(ServerWidget, String): change the name of a widget[5]
    Note that names unicity is enforced, if another widget has the same name, an alternate name will be used
  • setWidgetName(ServerWidget, String, boolean, boolean): change the name of a widget[6]
    The first boolean parameter specified if names unicity should be enforced, the second if C-compatible names should be enforced

Change the widget tree

Various methods allow to update the widget tree:
  • replaceBy(ServerWidget, String): replace a widget by another widget of another ARINC ID, keeping the childrne tree if the widget has children[7]
    Note that you should be aware that if you replace a container by another widget which is not a container, the children tree will be removed
  • createLayer(ServerDefinitionFile, String, int): create a new Layer specifying its name and ID
  • createWidgetAfter(ServerWidget, String), createWidgetBefore(ServerWidget, String), createWidgetUnder(ServerWidget, String), and createWidgetUnder(ServerLayer, String): creates a new widget of a specified ARINC ID in the hierarchy

Save Definition Files

  • saveAsXML(ServerDefinitionFile, File): save a Definition File as XML
  • saveAsBinary(ServerDefinitionFile, File): save a Definition File as binary
Note that you can access the Definition File associated with a Layer by theserverlayer.getDefinitionFile() method.

Notes

  1. ^ For example getPropertyValue(theLabel, "A661_STRING") will return the String label of a Label widget
  2. ^ For example getPropertyAsName(theLabel, "LabelString") will return the String label of a Label widget
  3. ^ For example getPropertyID(theLabel, "LabelString") will return "A661_STRING"
  4. ^ For example, it will take into account the StyleSet of the widget
  5. ^ Note that names unicity is enforced, if another widget has the same name, an alternate name will be used
  6. ^ The first boolean parameter specified if names unicity should be enforced, the second if C-compatible names should be enforced
  7. ^ Note that you should be aware that if you replace a container by another widget which is not a container, the children tree will be removed

See also


Categories: editor | plugins | user

Copyright 2016-2017 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v2 licence