Creating Widgets
Widget Descriptor Structure
The widget descriptor has a structure as outlined below:
<widgetdescriptor id="widget-id">
<config>
<params>
Configuration parameters here
</params>
<oglml>
Optional OGLML markup for configuration editor
</oglml>
</config>
<oglml>
<meta>
<params>
Private parameter declarations
</params>
<api>
Private ogScript functions
</api>
<meta>
<layout-container>
UI elements
</layout-container>
</oglml>
</widgetdescriptor>
OGLML Block
The OGLML section (encapsulated within an <oglml> tag) contains the OGLML document to create the widget. It may contain <meta>, <ogscript>, <api> and layout container tags in the same manner as a standard OGLML document. Note that all declarations within the <oglml> section are private to the widget.
Config Block
The config section (encapsulated within a <config> tag) contains OGLML document that creates a configuration page for the widget. The configuration page is displayed within the Edit Component dialog in PanelBuilder. By default, the default openGear layout will be used to present any parameters declared within a <params> tag in the config block:
<widgetdescriptor id="alarmgrid">
<config>
<params>
<param access="1" name="String 1" oid="str1" type="STRING" value="First"/>
<param access="1" name="String 2" oid="str2" type="STRING" value="Second"/>
<param access="1" name="String 3" oid="str3" type="STRING" value="Third"/>
<param access="1" name="String 4" oid="str4" type="STRING" value="Fourth"/>
<param access="1" name="String 5" oid="str5" type="STRING" value="Fifth"/>
<param access="1" name="String 6" oid="str6" type="STRING" value="Sixth"/>
</params>
</config>
<oglml>
<simplegrid cols="3" rows="2">
<param height="40" oid="str1" widget="12" width="200"/>
<param height="40" oid="str2" widget="12" width="200"/>
<param height="40" oid="str3" widget="12" width="200"/>
<param height="40" oid="str4" widget="12" width="200"/>
<param height="40" oid="str5" widget="12" width="200"/>
<param height="40" oid="str6" widget="12" width="200"/>
</simplegrid>
</oglml>
</widgetdescriptor>
Figure 55 – Widget Configuration (Default Layout)
However, OGLML markup may be added by specifying it within an <oglml> block within the config block.
Note If an <oglml> block is specified within the <config> section, only parameters included in the <oglml> block will be displayed in the PanelBuilder “Edit Component” dialog.
The following is an example of a widget descriptor incorporating an OGLML configuration markup. In the example, a <simplegrid> container is used to arrange configuration parameters into a 3x2 grid.
<widgetdescriptor id="alarmgrid-oglml">
<config>
<params>
<param access="1" name="String 1" oid="str1" type="STRING" value="First"/>
<param access="1" name="String 2" oid="str2" type="STRING" value="Second"/>
<param access="1" name="String 3" oid="str3" type="STRING" value="Third"/>
<param access="1" name="String 4" oid="str4" type="STRING" value="Fourth"/>
<param access="1" name="String 5" oid="str5" type="STRING" value="Fifth"/>
<param access="1" name="String 6" oid="str6" type="STRING" value="Sixth"/>
</params>
<oglml>
<simplegrid cols="3" rows="2">
<param height="40" oid="str1" widget="12" width="200"/>
<param height="40" oid="str2" widget="12" width="200"/>
<param height="40" oid="str3" widget="12" width="200"/>
<param height="40" oid="str4" widget="12" width="200"/>
<param height="40" oid="str5" widget="12" width="200"/>
<param height="40" oid="str6" widget="12" width="200"/>
</simplegrid>
</oglml>
</widgetdescriptor>
Figure 56 – Widget Configuration (OGLML layout)
If the widget descriptor includes a structtype attribute, PanelBuilder will use this as a filter to only offer the widget for insertion if a struct parameter exists with matching structtype attribute.