TreeDialog

Hi,

I'm trying to tweak the parmaters for tree auto layout in an application I'm writing as part of our evaluation process.
I see in the examples source code there is no source for the TreeDialog yet there is for the LayerDialog and ForceDialog.
It's difficult to use the compiled version of TreeDialog as I'd have to alter my inheritance hierarchy.
Is is possible to have a copy of the source for TreeDialog? That way I can use it and (importanly) see which methods are called for the different paramters. Having this will allow me to quickly determine that best parmaters for the layout in our application and help in selling JGo to management when it comes to making a purchase.
Many thanks
Mike

Huh! You’re quite right. Thanks for pointing that out. I’ll fix that in our next release.

I've just sent a copy of TreeDialog.java to you via email.

Thanks for that.

What approach should I adopt when using a tree layout with a graph that may be disjoint? (By that I mean that it could have two sets of connected nodes without a connection between the two sets). In effect it has more than one root.
What happens at the moment is that one of the sets of nodes is layed out correctly but the other set is just ignored. I don't know when the graph will have >1 root as we apply dynamic filtering to a data set. Is there some utility function to determine if a graph is 'in two halfs' and then maybe I can use the setRoots in the tree layout? Maybe this isn't the right approach?
Thanks
Mike

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.

Thanks

Mike

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.

Yes, I'm creating new layout each time.
Here is the code snippet
JGoTreeAutoLayout layout = new JGoTreeAutoLayout(doc);
layout.setArrangementOrigin(new Point(100, 100));
layout.setArrangementSpacing(new Dimension(50, 50));
layout.setArrangement(JGoTreeAutoLayout.ArrangementHorizontal);
layout.performLayout();
This is a schematic of the resulting layout.
On the left is what I want. Part of the graph is layed out ok. (the horizontal tree in the top left and bottom right)
The bit that fails is shown at the botton on the left - how I'd like it, and at the top right showing how it actually happens. The four nodes are all at the same point.
Could it be that the subgraph that fails to layout does not have a node that is immediately identifiable as a root?
Thanks, Mike

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.

If you can identify the separate tree in your own code you could force a layout to take place by creating constructing JGoTreeLayout using the default constructor (no argument). Then call JGoTreeLayout.setNetwork passing a JGoTreeNetwork containing the nodes in the 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.