Xcos writers: add the "defaultParent" to the XML 68/17468/2
Clément DAVID [Wed, 18 Nov 2015 09:19:49 +0000 (10:19 +0100)]
Change-Id: Ib0ba685e20918ffd3215fff097845f5ab9e01672

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

index 11d55ee..0168859 100644 (file)
@@ -114,9 +114,9 @@ public class CustomWriter extends ScilabWriter {
          * Add the legacy version comment
          */
         final Package p = Package.getPackage("org.scilab.modules.xcos");
-        StringBuilder comment = new StringBuilder().append(Xcos.TRADENAME).append(SEP).append(Xcos.VERSION).append(SEP)
-        .append(p.getSpecificationVersion()).append(SEP).append(p.getImplementationVersion());
-        shared.stream.writeComment(comment.toString());
+        String comment = new StringBuilder().append(Xcos.TRADENAME).append(SEP).append(Xcos.VERSION).append(SEP)
+        .append(p.getSpecificationVersion()).append(SEP).append(p.getImplementationVersion()).toString();
+        shared.stream.writeComment(comment);
 
         /*
          * encode some content then the children
@@ -151,5 +151,9 @@ public class CustomWriter extends ScilabWriter {
         shared.layers.pop();
         shared.stream.writeEndElement(); // root
         shared.stream.writeEndElement(); // mxGraphModel
+        shared.stream.writeEmptyElement("mxCell");
+        shared.stream.writeAttribute("as", "defaultParent");
+        shared.stream.writeAttribute("id", layer.toString());
+        shared.stream.writeAttribute("parent", root.toString());
     }
 }