diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index 8bcd1519d..0a4908806 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -485,7 +485,7 @@ public class Cluster implements Moveable { private int togetherCounter = 0; - private void printTogether(Together together, StringBuilder sb, List nodesOrderedWithoutTop, + private void printTogether(Together together, Collection otherTogethers, StringBuilder sb, List nodesOrderedWithoutTop, StringBounder stringBounder, Collection lines, DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) { sb.append("subgraph " + getClusterId() + "t" + togetherCounter + " {\n"); @@ -496,6 +496,10 @@ public class Cluster implements Moveable { for (Cluster child : children) if (child.group.getTogether() == together) child.printInternal(sb, lines, stringBounder, dotMode, graphvizVersion, type); + + for (Together otherTogether : otherTogethers) + if (otherTogether.getParent() == together) + printTogether(otherTogether, otherTogethers, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type); sb.append("}\n"); togetherCounter++; @@ -513,16 +517,17 @@ public class Cluster implements Moveable { if (together == null) node.appendShape(sb, stringBounder); else - togethers.add(together); + addTogetherWithParents(togethers, together); added = node; } for (Cluster child : children) if (child.group.getTogether() != null) - togethers.add(child.group.getTogether()); + addTogetherWithParents(togethers, child.group.getTogether()); for (Together together : togethers) - printTogether(together, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type); + if (together.getParent() == null) + printTogether(together, togethers, sb, nodesOrderedWithoutTop, stringBounder, lines, dotMode, graphvizVersion, type); if (skinParam.useRankSame() && dotMode != DotMode.NO_LEFT_RIGHT_AND_XLABEL && graphvizVersion.ignoreHorizontalLinks() == false) @@ -535,6 +540,14 @@ public class Cluster implements Moveable { return added; } + private static void addTogetherWithParents(Collection collection, Together together) { + Together t = together; + while (t != null) { + collection.add(t); + t = t.getParent(); + } + } + public void printCluster3_forKermor(StringBuilder sb, Collection lines, StringBounder stringBounder, DotMode dotMode, GraphvizVersion graphvizVersion, UmlDiagramType type) { final List tmp = getNodes(EntityPosition.getNormals());