* Bug #11871 fixed - Connectors were misaligned after Undo command. 41/10141/7
Alexandre HERISSE [Wed, 27 Feb 2013 15:37:41 +0000 (16:37 +0100)]
Change-Id: I1b055b7b2b8c6109c5eb389a2d1d20552273338b

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

index b2eabb9..94cf05f 100644 (file)
@@ -130,6 +130,8 @@ Xcos
 
 * Bug #11821 fixed - Running XcosPalAdd example from help led to deadlock
 
+* Bug #11871 fixed - Connectors were misaligned after Undo command.
+
 * Bug #11913 fixed - Unconnected CLSS block with empty matrix parameters made
                      Scilab crash.
 
index 0b13142..c27c308 100644 (file)
@@ -543,6 +543,23 @@ public class XcosDiagram extends ScilabGraph {
 
                         // Update the block position
                         BlockPositioning.updateBlockView(current);
+
+                        // force a refresh of the block ports and links connected to these ports
+                        final int childCount = current.getParentDiagram().getModel().getChildCount(current);
+                        for (int i = 0; i < childCount; i++) {
+                            final Object port = current.getParentDiagram().getModel().getChildAt(current, i);
+                            current.getParentDiagram().getView().clear(port,  true,  true);
+                            final int edgeCount = current.getParentDiagram().getModel().getEdgeCount(port);
+                            for (int j = 0; j < edgeCount; j++) {
+                                final Object edge = current.getParentDiagram().getModel().getEdgeAt(port, j);
+                                current.getParentDiagram().getView().clear(edge,  true,  true);
+                            }
+                        }
+                        // force a refresh of the block
+                        current.getParentDiagram().getView().clear(current, true, true);
+
+                        current.getParentDiagram().getView().validate();
+                        current.getParentDiagram().repaint();
                     }
                 }
             } finally {