* Bug #12167 fixed - Text of ports in superblocks were not updated. 10/10210/7
Alexandre HERISSE [Mon, 14 Jan 2013 13:24:08 +0000 (14:24 +0100)]
Change-Id: I55461ae62484466a72b01a345cc9e7c34c0cdd59

scilab/CHANGES_5.4.X
scilab/modules/xcos/src/java/org/scilab/modules/xcos/graph/SuperBlockDiagram.java

index dd7cf33..d7c3f2a 100644 (file)
@@ -129,6 +129,8 @@ Xcos
 
 * Bug #12162 fixed - tbx_build_blocks did not report errors.
 
+* Bug #12167 fixed - Text of ports in superblocks were not updated.
+
 
 Documentation
 ==============
index 7f49fd7..4ffb471 100644 (file)
@@ -37,9 +37,11 @@ import org.scilab.modules.xcos.block.io.ImplicitOutBlock;
 import org.scilab.modules.xcos.utils.XcosEvent;
 import org.scilab.modules.xcos.utils.XcosMessages;
 
+import com.mxgraph.model.mxCell;
 import com.mxgraph.model.mxICell;
 import com.mxgraph.util.mxEvent;
 import com.mxgraph.util.mxEventObject;
+import com.mxgraph.util.mxUtils;
 
 public final class SuperBlockDiagram extends XcosDiagram implements Serializable, Cloneable {
 
@@ -199,6 +201,19 @@ public final class SuperBlockDiagram extends XcosDiagram implements Serializable
             err = str.toString();
         }
 
+        // Update the port labels on the superblock
+        if (err == null) {
+            mxCell identifier = this.getOrCreateCellIdentifier(block);
+            final Object current = this.getModel().getValue(identifier);
+            String text = "";
+            if (current == null) {
+                text = "";
+            } else {
+                text = mxUtils.getBodyMarkup(current.toString(), false);
+            }
+            this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED, "cell", identifier, "value", text, "parent", block));
+        }
+
         return err;
     }