Loading a group defined in XML

All you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as shown below.

 

dataSource = new IltDefaultDataSource();

dataSource.parse("GroupXMLFile.xml");

For detailed information about data sources, see Data sources.

How to define a group in XML

The following is an example of a group defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .

Depending on the group class, the shape of a group is defined either by IlpPolygon, IlpRect, or IlpPolyline. See Group shapes for details.

 

<cplData>

<addObject id="RectGroup">

  <class>ilog.tgo.model.IltRectGroup</class>

  <attribute name="name">RectGroup</attribute>

  <attribute name="position" javaClass="ilog.cpl.graphic.IlpRect">

     <x>100</x> <y>200</y> <width>100</width> <height>50</height>

  </attribute>

  <attribute name="objectState" javaClass="ilog.tgo.model.IltOSIObjectState">

    <state>

      <administrative>Locked</administrative>

      <operational>Enabled</operational>

      <usage>Idle</usage>

    </state>

    <availability>PowerOff</availability>

    <control>ReservedForTest</control>

    <alarms>

      <new severity="Critical">5</new>

      <ack severity="Warning">12</ack>

    </alarms>

  </attribute>

</addObject>

<addObject id="PolyGroup">

  <class>ilog.tgo.model.IltPolyGroup</class>

  <attribute name="name">PolyGroup</attribute>

  <attribute name="position" javaClass="ilog.cpl.graphic.views.IlpPolygon">

    <point> <x>50.0</x> <y>20.0</y> </point>

    <point> <x>140.0</x> <y>20.0</y> </point>

    <point> <x>140.0</x> <y>100.0</y> </point>

    <point> <x>90.0</x> <y>100.0</y> </point>

    <point> <x>90.0</x> <y>140.0</y> </point>

    <point> <x>20.0</x> <y>140.0</y> </point>

    <point> <x>20.0</x> <y>90.0</y> </point>

  </attribute>

  <attribute name="objectState"

           javaClass="ilog.tgo.model.IltBellcoreObjectState">

    <state>EnabledActive</state>

    <secState>TestFailure</secState>

    <procedural>Initializing</procedural>

    <misc>HighTemperatureWarning</misc>

    <performance state="Input">50</performance>

    <alarms>

      <new severity="Minor">3</new>

      <ack severity="Warning">4</ack>

    </alarms>

  </attribute>

</addObject>

<addObject id="LinearGroup">

  <class>ilog.tgo.model.IltLinearGroup</class>

  <attribute name="name">LinearGroup</attribute>

  <attribute name="position" javaClass="ilog.cpl.graphic.views.IlpPolyline">

    <point> <x>350.0</x> <y>100.0</y> </point>

    <point> <x>400.0</x> <y>100.0</y> </point>

    <point> <x>420.0</x> <y>50.0</y> </point>

    <point> <x>450.0</x> <y>50.0</y> </point>

   </attribute>

  <attribute name="objectState"

          javaClass="ilog.tgo.model.IltBellcoreObjectState">

    <state>EnabledIdle</state>

    <secState>Busy</secState>

    <procedural>Initializing</procedural>

    <misc>DoorAjar</misc>

    <alarms>

      <ack severity="Warning">2</ack>

    </alarms>

  </attribute>

</addObject>

</cplData>