### Eclipse Workspace Patch 1.0 #P org.eclipse.draw2d.examples Index: src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.draw2d.examples/src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java,v retrieving revision 1.7 diff -u -r1.7 CompoundGraphTests.java --- src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java 14 Feb 2006 20:20:25 -0000 1.7 +++ src/org/eclipse/draw2d/examples/graph/CompoundGraphTests.java 19 Jun 2006 15:32:01 -0000 @@ -342,6 +342,40 @@ return graph; } +public static CompoundDirectedGraph ShortestPassCase(){ + NodeList nodes = new NodeList(); + EdgeList edges = new EdgeList(); + + Subgraph p = new Subgraph("parent"); + nodes.add(p); + Node a = new Node("a", p); + nodes.add(a); + Node b = new Node("b", p); + nodes.add(b); + Node c = new Node("c", p); + nodes.add(c); + Node d = new Node("d", p); + nodes.add(d); + Node e = new Node("e", p); + nodes.add(e); + + edges.add(new Edge(a, d)); + edges.add(new Edge(a, c)); + edges.add(new Edge(b, c)); + edges.add(new Edge(b, d)); + edges.add(new Edge(b, e)); + edges.add(new Edge(c, d)); + edges.add(new Edge(c, e)); + + CompoundDirectedGraph graph = new CompoundDirectedGraph(); + graph.nodes = nodes; + graph.edges = edges; + + new CompoundDirectedGraphLayout().visit(graph); + return graph; + +} + public static CompoundDirectedGraph tangledSubgraphs() { Subgraph A, B, C, D; Node a1, a2, b1, b2, c1, c2, d1, d2; #P org.eclipse.draw2d Index: src/org/eclipse/draw2d/graph/CompoundHorizontalPlacement.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/CompoundHorizontalPlacement.java,v retrieving revision 1.1 diff -u -r1.1 CompoundHorizontalPlacement.java --- src/org/eclipse/draw2d/graph/CompoundHorizontalPlacement.java 14 Feb 2006 20:19:44 -0000 1.1 +++ src/org/eclipse/draw2d/graph/CompoundHorizontalPlacement.java 19 Jun 2006 15:32:03 -0000 @@ -88,9 +88,9 @@ if (entries.contains(entry)) return; entries.add(entry); - int separation = left.width + Math.max( - graph.getPadding(left).right, - graph.getPadding(right).left); + int separation = left.width + + graph.getPadding(left).right + + graph.getPadding(right).left; prime.edges.add(new Edge( getPrime(left), getPrime(right), separation, 0 ));