// create the GRAPH layout action
NodeLinkTreeLayout treeLayout = new NodeLinkTreeLayout( GRAPH, orientation, 40, 0, 8 );
treeLayout.setLayoutAnchor( new Point2D.Double( 25, 300 ) );
m_vis.putAction( LAYOUT_ACTION, treeLayout );
CollapsedSubtreeLayout subLayout = new CollapsedSubtreeLayout( GRAPH, orientation );
m_vis.putAction( SUB_LAYOUT_ACTION, subLayout );
// create the filtering and layout
ActionList filter = new ActionList();
filter.add( new ExtendedFisheyeTreeFilter( GRAPH, 2 ) );
filter.add( new FontAction( GRAPH_NODES, FontLib.getFont( "Tahoma", 14 ) ) );
filter.add( treeLayout );
filter.add( subLayout );
filter.add( textColor );
filter.add( nodeColor );
filter.add( edgeColor );
filter.add( usesColor );
filter.add( usesArrow );
m_vis.putAction( FILTER_ACTION, filter );
// animated transition
AutoPanAction autoPan = new AutoPanAction();
ActionList animate = new ActionList( 750 );
animate.setPacingFunction( new SlowInSlowOutPacer() );
animate.add( autoPan );
animate.add( new QualityControlAnimator() );
animate.add( new VisibilityAnimator( GRAPH ) );
animate.add( new LocationAnimator( GRAPH_NODES ) );
animate.add( new ColorAnimator( GRAPH_NODES ) );
animate.add( new RepaintAction() );
m_vis.putAction( ANIMATE_ACTION, animate );
m_vis.alwaysRunAfter( FILTER_ACTION, ANIMATE_ACTION );
m_vis.putAction( AUTO_ZOOM_ACTION, new AutoZoomAction() );
// initialize the display
setItemSorter( new TreeDepthItemSorter() );
addControlListener( new ZoomToFitControl() );
addControlListener( new ZoomControl() );
addControlListener( new WheelZoomControl() );
addControlListener( new PanControl() );
addControlListener( new FocusControl( 1, FILTER_ACTION ) );
addControlListener( new ItemSelectionControl() );
// set orientation
nodeRenderer.setHorizontalAlignment( Constants.LEFT );
edgeRenderer.setHorizontalAlignment1( Constants.RIGHT );
edgeRenderer.setHorizontalAlignment2( Constants.LEFT );
edgeRenderer.setVerticalAlignment1( Constants.CENTER );
edgeRenderer.setVerticalAlignment2( Constants.CENTER );
usesRenderer.setHorizontalAlignment1( Constants.CENTER );
usesRenderer.setHorizontalAlignment2( Constants.CENTER );
usesRenderer.setVerticalAlignment1( Constants.BOTTOM );
usesRenderer.setVerticalAlignment2( Constants.CENTER );
NodeLinkTreeLayout rtl = (NodeLinkTreeLayout) m_vis.getAction( LAYOUT_ACTION );
CollapsedSubtreeLayout stl = (CollapsedSubtreeLayout) m_vis.getAction( SUB_LAYOUT_ACTION );
rtl.setOrientation( orientation );
stl.setOrientation( orientation );
}