FontAction fonts = new FontAction(treeNodes,
FontLib.getFont("Tahoma", 10));
fonts.add("ingroup('_focus_')", FontLib.getFont("Tahoma", 11));
// recolor
ActionList recolor = new ActionList();
recolor.add(nodeColor);
recolor.add(textColor);
recolor.add(borderColor);
recolor.add(borderHighlightColor);
m_vis.putAction("recolor", recolor);
// repaint
ActionList repaint = new ActionList();
repaint.add(recolor);
repaint.add(new RepaintAction());
m_vis.putAction("repaint", repaint);
// animate paint change
ActionList animatePaint = new ActionList(400);
animatePaint.add(new ColorAnimator(treeNodes));
animatePaint.add(new RepaintAction());
m_vis.putAction("animatePaint", animatePaint);
// create the tree layout action
RadialTreeLayout treeLayout = new RadialTreeLayout(tree);
m_vis.putAction("treeLayout", treeLayout);
CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout(tree);
m_vis.putAction("subLayout", subLayout);
// create the filtering and layout
ActionList filter = new ActionList();
filter.add(new ForceDirectedLayout(tree, true));
filter.add(new TreeRootAction(tree));
filter.add(fonts);
filter.add(treeLayout);
filter.add(subLayout);
filter.add(textColor);
filter.add(nodeColor);
filter.add(borderColor);
filter.add(borderHighlightColor);
filter.add(edgeColorAction);
filter.add(edgeArrowAction);
m_vis.putAction("filter", filter);
// animated transition
ActionList animate = new ActionList(1250);
animate.setPacingFunction(new SlowInSlowOutPacer());
animate.add(new QualityControlAnimator());
animate.add(new VisibilityAnimator(tree));
animate.add(new PolarLocationAnimator(treeNodes, linear));
animate.add(new ColorAnimator(treeNodes));
animate.add(new RepaintAction());
m_vis.putAction("animate", animate);
m_vis.alwaysRunAfter("filter", "animate");
// visibility determiner
ActionList visibility = new ActionList();
visibility.add(new VisibilityFilter(new VisiblePredicate()));
m_vis.putAction("visibility", visibility);
visibility.alwaysRunAfter(animate);
/*// add force repulsion
ForceSimulator fsim = new ForceSimulator();
fsim.addForce(new NBodyForce(-1f, .1f, 5f));
fsim.addForce(new DragForce());
*/
ActionList forces = new ActionList(m_vis, 1000);
//forces.add(new ForceDirectedLayout(tree, fsim, false));
forces.add(new RepaintAction());
m_vis.putAction("forces", forces);
forces.alwaysRunAfter(animate);
//======================================================================
// -- initialize the display --
//======================================================================
setSize(900,650);