Huh! You’re quite right. Thanks for pointing that out. I’ll fix that in our next release.
Thanks for that.
The TreeLayout should hanlde disjoint graphs. You may want to modify the Forest Arrangement options to control where the disjoint trees are placed (horizontally, verically). You can verify this with the LayoutDemo.
Yes, that’s what I thought. What happens is that one of the trees is layed out correctly and the other is dumped in the top left of the view and all its nodes in the same place.
I’ll look again when I’m back at work on monday.
Are you laying out entire diagram with a single performLayout method call or are you doing it with multiple calls? If you’re trying to reuse a single LayoutTree instance multiple times, that may be your problem. The LayoutTree class doesn’t reinitailze easily. If doing multiple layouts, the easiest thing to do is create a new LayoutTree instance each time.
layout.setArrangementOrigin(new Point(100, 100));
layout.setArrangementSpacing(new Dimension(50, 50));
Yes, I think that’s the problem. A tree root is defined as a node that isn’t linked to by any other node, so in this multiply connected diagram, it doesn’t see anything that it considers a separate tree.
Another approach would be for you to temporarily remove the incoming links to one of the nodes in the separate subtree (thereby making it an eligible tree root), then do the layout, then add the extra links back in.