Xcos save/load: manage dep_ut values 98/17898/1
Clément DAVID [Thu, 10 Mar 2016 14:40:56 +0000 (15:40 +0100)]
Change-Id: I8145493271e86d9f483d3a824a47065c02452508

scilab/modules/xcos/src/java/org/scilab/modules/xcos/io/sax/BlockHandler.java
scilab/modules/xcos/src/java/org/scilab/modules/xcos/io/writer/BlockWriter.java

index 01f8672..e7c29bc 100644 (file)
@@ -19,6 +19,7 @@ import java.util.Arrays;
 
 import org.scilab.modules.xcos.Kind;
 import org.scilab.modules.xcos.ObjectProperties;
+import org.scilab.modules.xcos.VectorOfInt;
 import org.scilab.modules.xcos.block.AfficheBlock;
 import org.scilab.modules.xcos.block.BasicBlock;
 import org.scilab.modules.xcos.block.BasicBlock.SimulationFunctionType;
@@ -171,6 +172,16 @@ class BlockHandler implements ScilabHandler {
         if (v != null) {
             saxHandler.controller.setObjectProperty(uid, kind, ObjectProperties.SIM_BLOCKTYPE, v);
         }
+        VectorOfInt vecOfInt = new VectorOfInt(2);
+        v = atts.getValue("dependsOnU");
+        if ("1".equals(v)) {
+            vecOfInt.set(0, 1);
+        }
+        v = atts.getValue("dependsOnT");
+        if ("1".equals(v)) {
+            vecOfInt.set(1, 1);
+        }
+        saxHandler.controller.setObjectProperty(uid, kind, ObjectProperties.SIM_DEP_UT, vecOfInt);
         v = atts.getValue("simulationFunctionType");
         if (v != null) {
             SimulationFunctionType type = SimulationFunctionType.valueOf(v);
index c6ee031..f02fa57 100644 (file)
@@ -21,6 +21,7 @@ import javax.xml.stream.XMLStreamException;
 
 import org.scilab.modules.xcos.Kind;
 import org.scilab.modules.xcos.ObjectProperties;
+import org.scilab.modules.xcos.VectorOfInt;
 import org.scilab.modules.xcos.VectorOfScicosID;
 import org.scilab.modules.xcos.block.BasicBlock;
 import org.scilab.modules.xcos.block.BasicBlock.SimulationFunctionType;
@@ -65,6 +66,11 @@ public class BlockWriter extends ScilabWriter {
             shared.controller.getObjectProperty(uid, kind, ObjectProperties.SIM_BLOCKTYPE, v);
             shared.stream.writeAttribute("blockType", v[0]);
 
+            VectorOfInt vecOfInt = new VectorOfInt(2);
+            shared.controller.getObjectProperty(uid, kind, ObjectProperties.SIM_DEP_UT, vecOfInt);
+            shared.stream.writeAttribute("dependsOnU", Integer.toString(vecOfInt.get(0)));
+            shared.stream.writeAttribute("dependsOnT", Integer.toString(vecOfInt.get(1)));
+
             shared.controller.getObjectProperty(uid, kind, ObjectProperties.SIM_FUNCTION_NAME, v);
             shared.stream.writeAttribute("simulationFunctionName", v[0]);