I am using the Prefuse-library to layout nodes in a JavaFX application (no Swing at all), and I'm particularly interested in the RadialTreeLayout.
My problem is, that my nodes are not simply circles, but they have a label too next to them on left or right side (depending on what side of the parent the node is). So the text of nodes sometimes overlaps.
Skimming through the source-code of Prefuse's RadialTreeLayout.java, it seems that the layout might be smart enough to take in account variable-sized nodes. I could be wrong, as I don't understand the algorithm, but the Javadoc says:
"... Node diameters are taken into account to imporve space allocation for variable-sized nodes."
But I guess I don't even need variable-sized nodes, I just need to give them a fixed custom size, at least for a start.
And so follows my actual question: How can I pass the width/height to the layout algorithm as parameters? I'm quite sure it's done via Node.setXXX methods, but I don't know the proper keys/calls/syntax.
I have a Graph-object filled with Nodes:
Table nodeData = new Table();
nodeData.addColumn("data", NodeData.class);
Table edgeData = new Table(0, 1);
edgeData.addColumn(Graph.DEFAULT_SOURCE_KEY, int.class);
edgeData.addColumn(Graph.DEFAULT_TARGET_KEY, int.class);
Graph graph = new Graph(nodeData, edgeData, false);
Node n1 = graph.addNode();
NodeData data = new NodeData(); // My own "data"-class
data.title = "Root Node";
n1.set("data", data);
I also (obviously) have the simple layout-code that starts the RadialTreeLayout, and once finished, I pass the bounds to the JavaFX nodes.