* Bug #10435 fixed - Undo in superdiagram did not update superblock ports 23/10623/2
Alexandre HERISSE [Wed, 27 Feb 2013 13:57:54 +0000 (14:57 +0100)]
and links.

Change-Id: Ie3893b1f01de67960bb3b77795e3f94c083c294c

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

index 185feb0..b2eabb9 100644 (file)
@@ -119,6 +119,9 @@ Xcos
 
 * Bug #10434 fixed - loadXcosLibs changed the predef value.
 
+* Bug #10435 fixed - Undo in superdiagram did not update superblock ports
+                     and links.
+
 * Bug #10660 fixed - model2blk and callblk crashed Scilab on 64-bit platforms.
 
 * Bug #11193 fixed - Lincos did not honor context values.
index b176058..0b13142 100644 (file)
@@ -462,7 +462,21 @@ public class XcosDiagram extends ScilabGraph {
 
             BlockPositioning.updateBlockView(updatedBlock);
 
+            // force super block to refresh
             diagram.getView().clear(updatedBlock, true, true);
+
+            // force links connected to super block to refresh
+            final int childCount = diagram.getModel().getChildCount(updatedBlock);
+            for (int i = 0; i < childCount; i++) {
+                final Object port = diagram.getModel().getChildAt(updatedBlock, i);
+
+                final int edgeCount = diagram.getModel().getEdgeCount(port);
+                for (int j = 0; j < edgeCount; j++) {
+                    final Object edge = diagram.getModel().getEdgeAt(port, j);
+                    diagram.getView().clear(edge,  true,  true);
+                }
+            }
+
             diagram.getView().validate();
             diagram.repaint();
         }
@@ -520,6 +534,13 @@ public class XcosDiagram extends ScilabGraph {
                             current.updateFieldsFromStyle();
                         }
 
+                        // update the superblock container ports if the block is inside a superblock diagram
+                        if (current.getParentDiagram() instanceof SuperBlockDiagram) {
+                            SuperBlockDiagram superdiagram = (SuperBlockDiagram) current.getParentDiagram();
+                            SuperBlock superblock = superdiagram.getContainer();
+                            superblock.updateExportedPort();
+                        }
+
                         // Update the block position
                         BlockPositioning.updateBlockView(current);
                     }