5.2. Visual Interface

All URIs are relative based on the current resource.

In order to have a view available in the running client it needs to be registered using the Eclipse extension framework.

In the bundle were the .vi file resides add a new entry in the plugin.xml.

...
 <extension
    point="org.eclipse.scada.vi.ui.user.view">
    <viewInstance
      defaultInstance="true"
      name="Logon"
      zooming="false"
      mainView="false"
      resource="resources/views/placeholder.vi"
      factoryClass="org.eclipse.scada.vi.ui.user.VisualInterfaceFactory"
      id="org.eclipse.scada.samples.demo1.client.placeholder">
      <visibility>
        <reference
          definitionId="org.eclipse.scada.samples.demo1.client.nosession">
        </reference>
        </visibility>
    </viewInstance>
 </extension>
...

The attribute resource points to the file that defines the view. The attribute factoryClass defines the class that will implement the view. If this is a default .vi file, the value must be org.eclipse.scada.vi.ui.user.VisualInterfaceFactory.

The attribute id must be unique in the while application.

Inside the Eclipse IDE create a new file FileNew Other….

Choose VisualInterface Model from the list.

Register the file as described in Section 5.2.1, “Registering a new view instance”

In VI are represented as RGB colors in the hex notation. As known from HTML. But other than HTML, VI requires the color information to be always 6 characters long. The case is not significant.

Valid examplesInvalid examples

#FF0000

#00ff00

#0000fF

red (names are not allowed)

#f00 (short form is not allowed, must have 6 character plus #)

FF0000 (missing #)

Several visual elements may specify a border. The border definition has a special syntax.

The line border type is a simple line. The type id is LINE:

The following properties are supported:

Name Simple value Description
lineWidth X The line size in pixels (might get scaled)
color Line color in hex notation. See also Section 5.2.3.2, “Colors”.

A draw2d group border. The type id is GROUP:

The following properties are supported:

Name Simple value Description
text X The text of the group border
textColor The color of the text. See also Section 5.2.3.2, “Colors”.

A draw2d title border. The type id is TITLE:

The following properties are supported:

Name Simple value Description
text (simple value) X The text of the group border
textColor The color of the text. See also Section 5.2.3.2, “Colors”.
backgroundColor The color of the background. See also Section 5.2.3.2, “Colors”.
Border Description
1 This will generate a 1 pixel, black, solid line border
LINE:1 This will also generate a 1 pixel, black, solid line border
LINE:[lineWidth=1,color=#FF0000] This will create a 1 pixel, red, solid line border
GROUP:Name Creates a group style border with a label of Name
COMPOUND:[inner=GROUP:Name,outer=LINE:[lineWidth=2,color=#00FF00]] This will create a group border with the label Name and outside it has a solid line border, 2 pixel, green.

The visual interface can be made dynamic using JavaScript fragments. Several elements allow triggering events or call methods which me be implemented using JavaScript code fragments.

Internally the JavaScript engine of the Java Virtual Machine will be used. Depending in the version of the Java virtual machine this can be Rhino (e.g. with Java 7) or Nashorn (e.g. with Java 8). Both variants are JavaScript, but for example the importPackage method will only be available in Rhino.

[Note]Note

Which JavaScript engine is actually used depends on which Java virtual machine runs the final application.

See also:

The model describing the symbols and views is an Ecore model, which is documented in Section 5.2.6, “Model definition – http://eclipse.org/SCADA/VisualInterface”. Eclipse SCADA Provides a set of tools (Wizards, Editors) in order to ease the development symbols. However it still is possible to edit the symbols with a plain text or XML editor.

This section describes the model http://eclipse.org/SCADA/VisualInterface.

This sections describes the classes of the model.