Xcos writer: add the ordering attributes on the ports 28/17528/2
Clément DAVID [Wed, 2 Dec 2015 13:06:01 +0000 (14:06 +0100)]
Change-Id: Ic5a77ac502289eeec5dda6e5013d95f20301a3eb

scilab/modules/xcos/src/java/org/scilab/modules/xcos/io/writer/PortWriter.java

index 8c46530..ef52a99 100644 (file)
@@ -21,11 +21,13 @@ import org.scilab.modules.xcos.port.BasicPort;
 public class PortWriter extends ScilabWriter {
 
     private final ObjectProperties portKind;
+    private int ordering;
 
     public PortWriter(XcosWriter writer, ObjectProperties portKind) {
         super(writer);
 
         this.portKind = portKind;
+        this.ordering = 0;
     }
 
     @Override
@@ -75,6 +77,7 @@ public class PortWriter extends ScilabWriter {
         shared.controller.getObjectProperty(uid, kind, ObjectProperties.UID, str);
         shared.stream.writeAttribute("id", str[0]);
         shared.stream.writeAttribute("parent", shared.layers.peek());
+        shared.stream.writeAttribute("ordering", Integer.toString(++ordering));
 
         VectorOfInt datatype = new VectorOfInt();
         shared.controller.getObjectProperty(uid, Kind.PORT, ObjectProperties.DATATYPE, datatype);