maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r355901 - in /maven/sandbox/pomo/src/main/java/org/apache/maven/pomo: Pomo.java SimpleGraphDraw.java SubLayoutDemo.java TreeLayoutDemo.java
Date Sun, 11 Dec 2005 04:35:15 GMT
Author: jvanzyl
Date: Sat Dec 10 20:35:13 2005
New Revision: 355901

URL: http://svn.apache.org/viewcvs?rev=355901&view=rev
Log:
o adding a couple more bits to try

Added:
    maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java   (with props)
    maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java   (with props)
    maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java   (with props)
Modified:
    maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/Pomo.java

Modified: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/Pomo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/Pomo.java?rev=355901&r1=355900&r2=355901&view=diff
==============================================================================
--- maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/Pomo.java (original)
+++ maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/Pomo.java Sat Dec 10 20:35:13 2005
@@ -75,6 +75,8 @@
 import edu.uci.ics.jung.utils.PredicateUtils;
 import edu.uci.ics.jung.utils.TestGraphs;
 import edu.uci.ics.jung.visualization.FRLayout;
+import edu.uci.ics.jung.visualization.contrib.*;
+import edu.uci.ics.jung.visualization.SpringLayout;
 import edu.uci.ics.jung.visualization.GraphZoomScrollPane;
 import edu.uci.ics.jung.visualization.HasGraphLayout;
 import edu.uci.ics.jung.visualization.Layout;
@@ -97,18 +99,18 @@
  * This code provides examples of different ways to provide and
  * change the various functions that provide property information
  * to the renderer.
- * 
+ * <p/>
  * <p>This demo creates a random mixed-mode graph with random edge
  * weights using <code>TestGraph.generateMixedRandomGraph</code>.
  * It then runs <code>VoltageRanker</code> on this graph, using half
- * of the "seed" vertices from the random graph generation as 
+ * of the "seed" vertices from the random graph generation as
  * voltage sources, and half of them as voltage sinks.</p>
- * 
+ * <p/>
  * <p>What the controls do:
  * <ul>
  * <li/>Mouse controls:
  * <ul>
- * <li/>If your mouse has a scroll wheel, scrolling forward zooms out and 
+ * <li/>If your mouse has a scroll wheel, scrolling forward zooms out and
  * scrolling backward zooms in.
  * <li/>Left-clicking on a vertex or edge selects it, and unselects all others.
  * <li/>Middle-clicking on a vertex or edge toggles its selection state.
@@ -116,12 +118,12 @@
  * increase or decrease that vertex's transparency.
  * <li/>Left-clicking on the background allows you to drag the image around.
  * <li/>Hovering over a vertex tells you what its voltage is; hovering over an
- * edge shows its identity; hovering over the background shows an informational 
+ * edge shows its identity; hovering over the background shows an informational
  * message.
-</ul>
+ * </ul>
  * <li/>Vertex stuff:
  * <ul>
- * <li/>"vertex seed coloring": if checked, the seed vertices are colored blue, 
+ * <li/>"vertex seed coloring": if checked, the seed vertices are colored blue,
  * and all other vertices are colored red.  Otherwise, all vertices are colored
  * a slightly transparent red (except the currently "picked" vertex, which is
  * colored transparent purple).
@@ -133,20 +135,20 @@
  * <li/>"vertex degree shapes": if checked, vertices are drawn with a polygon with
  * number of sides proportional to its degree.  Otherwise, vertices are drawn
  * as ellipses.
- * <li/>"vertex voltage size": if checked, vertices are drawn with a size 
- * proportional to their voltage ranking.  Otherwise, all vertices are drawn 
+ * <li/>"vertex voltage size": if checked, vertices are drawn with a size
+ * proportional to their voltage ranking.  Otherwise, all vertices are drawn
  * at the same size.
  * <li/>"vertex degree ratio stretch": if checked, vertices are drawn with an
  * aspect ratio (height/width ratio) proportional to the ratio of their indegree to
  * their outdegree.  Otherwise, vertices are drawn with an aspect ratio of 1.
  * <li/>"filter vertices of degree &lt; 4": if checked, does not display any vertices
- * (or their incident edges) whose degree in the original graph is less than 4; 
+ * (or their incident edges) whose degree in the original graph is less than 4;
  * otherwise, all vertices are drawn.
  * </ul>
  * <li/>Edge stuff:
  * <ul>
  * <li/>"edge shape": selects between lines, wedges, quadratic curves, and cubic curves
- * for drawing edges.  
+ * for drawing edges.
  * <li/>"fill edge shapes": if checked, fills the edge shapes.  This will have no effect
  * if "line" is selected.
  * <li/>"edge paint": selects between solid colored edges, and gradient-painted edges.
@@ -166,20 +168,20 @@
  * <li/>"bold text": if checked, all vertex and edge labels are drawn using a
  * boldface font.  Otherwise, a normal-weight font is used.  (Has no effect if
  * no labels are currently visible.)
- * <li/>zoom controls: 
+ * <li/>zoom controls:
  * <ul>
  * <li/>"+" zooms in, "-" zooms out
- * <li/>"zoom at mouse (wheel only)": if checked, zooming (using the mouse 
+ * <li/>"zoom at mouse (wheel only)": if checked, zooming (using the mouse
  * scroll wheel) is centered on the location of the mouse pointer; otherwise,
  * it is centered on the center of the visualization pane.
  * </ul>
  * </ul>
  * </p>
- * 
+ *
  * @author Danyel Fisher, Joshua O'Madadhain
- *  modified by Tom Nelson for zoom/pan with the mouse wheel and mouse
+ *         modified by Tom Nelson for zoom/pan with the mouse wheel and mouse
  */
-public class Pomo extends JApplet implements ActionListener 
+public class Pomo extends JApplet implements ActionListener
 {
     protected JCheckBox v_color;
     protected JCheckBox e_color;
@@ -202,15 +204,15 @@
     protected JCheckBox v_small;
     protected JCheckBox zoom_at_mouse;
     protected JCheckBox fill_edges;
-    
-	protected JRadioButton no_gradient;
+
+    protected JRadioButton no_gradient;
 //	protected JRadioButton gradient_absolute;
-	protected JRadioButton gradient_relative;
+    protected JRadioButton gradient_relative;
 
-	protected static final int GRADIENT_NONE = 0;
-	protected static final int GRADIENT_RELATIVE = 1;
+    protected static final int GRADIENT_NONE = 0;
+    protected static final int GRADIENT_RELATIVE = 1;
 //	protected static final int GRADIENT_ABSOLUTE = 2;
-	protected static int gradient_level = GRADIENT_NONE;
+    protected static int gradient_level = GRADIENT_NONE;
 
     protected PluggableRenderer pr;
     protected SeedColor vcf;
@@ -228,391 +230,398 @@
     protected GradientPickedEdgePaintFunction edgePaint;
     protected final static Object VOLTAGE_KEY = "voltages";
     protected final static Object TRANSPARENCY = "transparency";
-    
-    protected NumberEdgeValue edge_weight = new UserDatumNumberEdgeValue("edge_weight");
-    protected NumberVertexValue voltages = new UserDatumNumberVertexValue(VOLTAGE_KEY);
-    protected NumberVertexValue transparency = new UserDatumNumberVertexValue(TRANSPARENCY);
-    
+
+    protected NumberEdgeValue edge_weight = new UserDatumNumberEdgeValue( "edge_weight" );
+    protected NumberVertexValue voltages = new UserDatumNumberVertexValue( VOLTAGE_KEY );
+    protected NumberVertexValue transparency = new UserDatumNumberVertexValue( TRANSPARENCY );
+
     protected VisualizationViewer vv;
     protected DefaultModalGraphMouse gm;
     protected Transformer affineTransformer;
-    
+
     public void start()
     {
         getContentPane().add( startFunction() );
     }
-    
-    public static void main(String[] s ) 
+
+    public static void main( String[] s )
     {
         JFrame jf = new JFrame();
-        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        jf.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
         JPanel jp = new Pomo().startFunction();
-        jf.getContentPane().add(jp);
+        jf.getContentPane().add( jp );
         jf.pack();
         jf.show();
     }
-    
-    
+
+
     public Pomo()
     {
     }
-    
-    public JPanel startFunction() {
+
+    public JPanel startFunction()
+    {
         Graph g = getGraph();
-        
+
         pr = new PluggableRenderer();
-        Layout layout = new FRLayout(g);
-        vv = new VisualizationViewer(layout, pr);
+        Layout layout = new SpringLayout( g );
+        Layout layout = new TreeLayout( g );
+        vv = new VisualizationViewer( layout, pr );
         // add Shape based pick support
-        vv.setPickSupport(new ShapePickSupport());
+        vv.setPickSupport( new ShapePickSupport() );
         PickedState picked_state = vv.getPickedState();
-        
+
         affineTransformer = vv.getLayoutTransformer();
-        
+
         // create decorators
-        vcf = new SeedColor(picked_state);
-        ewcs = 
-            new EdgeWeightStrokeFunction(edge_weight);
-        vsh = new VertexStrokeHighlight(picked_state);
+        vcf = new SeedColor( picked_state );
+        ewcs =
+            new EdgeWeightStrokeFunction( edge_weight );
+        vsh = new VertexStrokeHighlight( picked_state );
         ff = new FontHandler();
-        vs_none = new ConstantVertexStringer(null);
-        es_none = new ConstantEdgeStringer(null);
-        vssa = new VertexShapeSizeAspect(voltages);
-        show_edge = new DirectionDisplayPredicate(true, true);
-        show_arrow = new DirectionDisplayPredicate(true, false);
-        show_vertex = new VertexDisplayPredicate(false);
+        vs_none = new ConstantVertexStringer( null );
+        es_none = new ConstantEdgeStringer( null );
+        vssa = new VertexShapeSizeAspect( voltages );
+        show_edge = new DirectionDisplayPredicate( true, true );
+        show_arrow = new DirectionDisplayPredicate( true, false );
+        show_vertex = new VertexDisplayPredicate( false );
 
         // uses a gradient edge if unpicked, otherwise uses picked selection
-        edgePaint = new GradientPickedEdgePaintFunction( new PickableEdgePaintFunction(picked_state,Color.black,Color.cyan), 
-                vv, vv, picked_state);
-        
-        pr.setVertexPaintFunction(vcf);
-        pr.setVertexStrokeFunction(vsh);
-        pr.setVertexStringer(vs_none);
-        pr.setVertexFontFunction(ff);
-        pr.setVertexShapeFunction(vssa);
-        pr.setVertexIncludePredicate(show_vertex);
-        
+        edgePaint = new GradientPickedEdgePaintFunction( new PickableEdgePaintFunction( picked_state, Color.black, Color.cyan ),
+                                                         vv, vv, picked_state );
+
+        pr.setVertexPaintFunction( vcf );
+        pr.setVertexStrokeFunction( vsh );
+        pr.setVertexStringer( vs_none );
+        pr.setVertexFontFunction( ff );
+        pr.setVertexShapeFunction( vssa );
+        pr.setVertexIncludePredicate( show_vertex );
+
         pr.setEdgePaintFunction( edgePaint );
-        pr.setEdgeStringer(es_none);
-        pr.setEdgeFontFunction(ff);
-        pr.setEdgeStrokeFunction(ewcs);
-        pr.setEdgeIncludePredicate(show_edge);
-        pr.setEdgeShapeFunction(new EdgeShape.Line());
-        pr.setEdgeArrowPredicate(show_arrow);
+        pr.setEdgeStringer( es_none );
+        pr.setEdgeFontFunction( ff );
+        pr.setEdgeStrokeFunction( ewcs );
+        pr.setEdgeIncludePredicate( show_edge );
+        pr.setEdgeShapeFunction( new EdgeShape.Line() );
+        pr.setEdgeArrowPredicate( show_arrow );
         JPanel jp = new JPanel();
-        jp.setLayout(new BorderLayout());
-        
-        vv.setBackground(Color.white);
-        GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv);
-        jp.add(scrollPane);
+        jp.setLayout( new BorderLayout() );
+
+        vv.setBackground( Color.white );
+        GraphZoomScrollPane scrollPane = new GraphZoomScrollPane( vv );
+        jp.add( scrollPane );
         gm = new DefaultModalGraphMouse();
-        vv.setGraphMouse(gm);
-        gm.add(new PopupGraphMousePlugin());
+        vv.setGraphMouse( gm );
+        gm.add( new PopupGraphMousePlugin() );
 
         addBottomControls( jp );
-        vssa.setScaling(true);
+        vssa.setScaling( true );
+
+        vv.setToolTipFunction( new VoltageTips() );
+        vv.setToolTipText( "<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>" );
 
-        vv.setToolTipFunction(new VoltageTips());
-        vv.setToolTipText("<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>");
-        
 
-        
         return jp;
     }
-    
+
     /**
      * Generates a mixed-mode random graph, runs VoltageRanker on it, and
      * returns the resultant graph.
      */
     public Graph getGraph()
     {
-        Graph g = TestGraphs.generateMixedRandomGraph(edge_weight, 20);
-        vs = new NumberVertexValueStringer(voltages);
-        es = new NumberEdgeValueStringer(edge_weight);
-        
+        Graph g = TestGraphs.generateMixedRandomGraph( edge_weight, 20 );
+        vs = new NumberVertexValueStringer( voltages );
+        es = new NumberEdgeValueStringer( edge_weight );
+
         // collect the seeds used to define the random graph
-        Collection seeds = PredicateUtils.getVertices(g, 
-                new ContainsUserDataKeyVertexPredicate(BarabasiAlbertGenerator.SEED));
-        if (seeds.size() < 2)
-            System.out.println("need at least 2 seeds (one source, one sink)");
-        
+        Collection seeds = PredicateUtils.getVertices( g,
+                                                       new ContainsUserDataKeyVertexPredicate( BarabasiAlbertGenerator.SEED ) );
+        if ( seeds.size() < 2 )
+            System.out.println( "need at least 2 seeds (one source, one sink)" );
+
         // use these seeds as source and sink vertices, run VoltageRanker
         boolean source = true;
         Set sources = new HashSet();
         Set sinks = new HashSet();
-        for (Iterator iter = seeds.iterator(); iter.hasNext(); )
+        for ( Iterator iter = seeds.iterator(); iter.hasNext(); )
         {
-            if (source)
-                sources.add(iter.next());
+            if ( source )
+                sources.add( iter.next() );
             else
-                sinks.add(iter.next());
+                sinks.add( iter.next() );
             source = !source;
         }
-        VoltageRanker vr = new VoltageRanker(edge_weight, voltages, 100, 0.01);
-        vr.calculateVoltages(g, sources, sinks);
+        VoltageRanker vr = new VoltageRanker( edge_weight, voltages, 100, 0.01 );
+        vr.calculateVoltages( g, sources, sinks );
 
         Set verts = g.getVertices();
-        
+
         // assign a transparency value of 0.9 to all vertices
-        for (Iterator iter = verts.iterator(); iter.hasNext(); )
+        for ( Iterator iter = verts.iterator(); iter.hasNext(); )
         {
-            Vertex v = (Vertex)iter.next();
-            transparency.setNumber(v, new MutableDouble(0.9));
+            Vertex v = (Vertex) iter.next();
+            transparency.setNumber( v, new MutableDouble( 0.9 ) );
         }
 
         // add a couple of self-loops (sanity check on rendering)
-        Vertex v = (Vertex)verts.iterator().next(); 
-        Edge e = new DirectedSparseEdge(v,v);
-        edge_weight.setNumber(e, new Double(Math.random()));
-        g.addEdge(e);
-        e = new UndirectedSparseEdge(v,v);
-        edge_weight.setNumber(e, new Double(Math.random()));
-        g.addEdge(e);
-        return g;  
+        Vertex v = (Vertex) verts.iterator().next();
+        Edge e = new DirectedSparseEdge( v, v );
+        edge_weight.setNumber( e, new Double( Math.random() ) );
+        g.addEdge( e );
+        e = new UndirectedSparseEdge( v, v );
+        edge_weight.setNumber( e, new Double( Math.random() ) );
+        g.addEdge( e );
+        return g;
     }
-    
+
     /**
-     * @param jp    panel to which controls will be added
+     * @param jp panel to which controls will be added
      */
-    protected void addBottomControls(final JPanel jp) 
+    protected void addBottomControls( final JPanel jp )
     {
         final JPanel control_panel = new JPanel();
-        jp.add(control_panel, BorderLayout.SOUTH);
-        control_panel.setLayout(new BorderLayout());
+        jp.add( control_panel, BorderLayout.SOUTH );
+        control_panel.setLayout( new BorderLayout() );
         final Box vertex_panel = Box.createVerticalBox();
-        vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices"));
+        vertex_panel.setBorder( BorderFactory.createTitledBorder( "Vertices" ) );
         final Box edge_panel = Box.createVerticalBox();
-        edge_panel.setBorder(BorderFactory.createTitledBorder("Edges"));
+        edge_panel.setBorder( BorderFactory.createTitledBorder( "Edges" ) );
         final Box both_panel = Box.createVerticalBox();
 
-        control_panel.add(vertex_panel, BorderLayout.WEST);
-        control_panel.add(edge_panel, BorderLayout.EAST);
-        control_panel.add(both_panel, BorderLayout.CENTER);
-        
+        control_panel.add( vertex_panel, BorderLayout.WEST );
+        control_panel.add( edge_panel, BorderLayout.EAST );
+        control_panel.add( both_panel, BorderLayout.CENTER );
+
         // set up vertex controls
-        v_color = new JCheckBox("vertex seed coloring");
-        v_color.addActionListener(this);
-        v_stroke = new JCheckBox("<html>vertex selection<p>stroke highlighting</html>");
-        v_stroke.addActionListener(this);
-        v_labels = new JCheckBox("show vertex ranks (voltages)");
-        v_labels.addActionListener(this);
-        v_shape = new JCheckBox("vertex degree shapes");
-        v_shape.addActionListener(this);
-        v_size = new JCheckBox("vertex voltage size");
-        v_size.addActionListener(this);
-        v_size.setSelected(true);
-        v_aspect = new JCheckBox("vertex degree ratio stretch");
-        v_aspect.addActionListener(this);
-        v_small = new JCheckBox("filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE);
-        v_small.addActionListener(this);
-
-        vertex_panel.add(v_color);
-        vertex_panel.add(v_stroke);
-        vertex_panel.add(v_labels);
-        vertex_panel.add(v_shape);
-        vertex_panel.add(v_size);
-        vertex_panel.add(v_aspect);
-        vertex_panel.add(v_small);
-        
+        v_color = new JCheckBox( "vertex seed coloring" );
+        v_color.addActionListener( this );
+        v_stroke = new JCheckBox( "<html>vertex selection<p>stroke highlighting</html>" );
+        v_stroke.addActionListener( this );
+        v_labels = new JCheckBox( "show vertex ranks (voltages)" );
+        v_labels.addActionListener( this );
+        v_shape = new JCheckBox( "vertex degree shapes" );
+        v_shape.addActionListener( this );
+        v_size = new JCheckBox( "vertex voltage size" );
+        v_size.addActionListener( this );
+        v_size.setSelected( true );
+        v_aspect = new JCheckBox( "vertex degree ratio stretch" );
+        v_aspect.addActionListener( this );
+        v_small = new JCheckBox( "filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE );
+        v_small.addActionListener( this );
+
+        vertex_panel.add( v_color );
+        vertex_panel.add( v_stroke );
+        vertex_panel.add( v_labels );
+        vertex_panel.add( v_shape );
+        vertex_panel.add( v_size );
+        vertex_panel.add( v_aspect );
+        vertex_panel.add( v_small );
+
         // set up edge controls
-		JPanel gradient_panel = new JPanel(new GridLayout(1, 0));
-        gradient_panel.setBorder(BorderFactory.createTitledBorder("Edge paint"));
-		no_gradient = new JRadioButton("Solid color");
-		no_gradient.addActionListener(this);
-		no_gradient.setSelected(true);
+        JPanel gradient_panel = new JPanel( new GridLayout( 1, 0 ) );
+        gradient_panel.setBorder( BorderFactory.createTitledBorder( "Edge paint" ) );
+        no_gradient = new JRadioButton( "Solid color" );
+        no_gradient.addActionListener( this );
+        no_gradient.setSelected( true );
 //		gradient_absolute = new JRadioButton("Absolute gradient");
 //		gradient_absolute.addActionListener(this);
-		gradient_relative = new JRadioButton("Gradient");
-		gradient_relative.addActionListener(this);
-		ButtonGroup bg_grad = new ButtonGroup();
-		bg_grad.add(no_gradient);
-		bg_grad.add(gradient_relative);
-		//bg_grad.add(gradient_absolute);
-		gradient_panel.add(no_gradient);
-		//gradientGrid.add(gradient_absolute);
-		gradient_panel.add(gradient_relative);
-        
-        JPanel shape_panel = new JPanel(new GridLayout(3,2));
-        shape_panel.setBorder(BorderFactory.createTitledBorder("Edge shape"));
-        e_line = new JRadioButton("line");
-        e_line.addActionListener(this);
-        e_line.setSelected(true);
+        gradient_relative = new JRadioButton( "Gradient" );
+        gradient_relative.addActionListener( this );
+        ButtonGroup bg_grad = new ButtonGroup();
+        bg_grad.add( no_gradient );
+        bg_grad.add( gradient_relative );
+        //bg_grad.add(gradient_absolute);
+        gradient_panel.add( no_gradient );
+        //gradientGrid.add(gradient_absolute);
+        gradient_panel.add( gradient_relative );
+
+        JPanel shape_panel = new JPanel( new GridLayout( 3, 2 ) );
+        shape_panel.setBorder( BorderFactory.createTitledBorder( "Edge shape" ) );
+        e_line = new JRadioButton( "line" );
+        e_line.addActionListener( this );
+        e_line.setSelected( true );
 //        e_bent = new JRadioButton("bent line");
 //        e_bent.addActionListener(this);
-        e_wedge = new JRadioButton("wedge");
-        e_wedge.addActionListener(this);
-        e_quad = new JRadioButton("quad curve");
-        e_quad.addActionListener(this);
-        e_cubic = new JRadioButton("cubic curve");
-        e_cubic.addActionListener(this);
+        e_wedge = new JRadioButton( "wedge" );
+        e_wedge.addActionListener( this );
+        e_quad = new JRadioButton( "quad curve" );
+        e_quad.addActionListener( this );
+        e_cubic = new JRadioButton( "cubic curve" );
+        e_cubic.addActionListener( this );
         ButtonGroup bg_shape = new ButtonGroup();
-        bg_shape.add(e_line);
+        bg_shape.add( e_line );
 //        bg.add(e_bent);
-        bg_shape.add(e_wedge);
-        bg_shape.add(e_quad);
-        bg_shape.add(e_cubic);
-        shape_panel.add(e_line);
+        bg_shape.add( e_wedge );
+        bg_shape.add( e_quad );
+        bg_shape.add( e_cubic );
+        shape_panel.add( e_line );
 //        shape_panel.add(e_bent);
-        shape_panel.add(e_wedge);
-        shape_panel.add(e_quad);
-        shape_panel.add(e_cubic);
-        fill_edges = new JCheckBox("fill edge shapes");
-        fill_edges.setSelected(false);
-        fill_edges.addActionListener(this);
-        shape_panel.add(fill_edges);
-        shape_panel.setOpaque(true);
-        e_color = new JCheckBox("edge weight highlighting");
-        e_color.addActionListener(this);
-        e_labels = new JCheckBox("show edge weights");
-        e_labels.addActionListener(this);
-        e_uarrow_pred = new JCheckBox("undirected");
-        e_uarrow_pred.addActionListener(this);
-        e_darrow_pred = new JCheckBox("directed");
-        e_darrow_pred.addActionListener(this);
-        e_darrow_pred.setSelected(true);
-        JPanel arrow_panel = new JPanel(new GridLayout(1,0));
-        arrow_panel.setBorder(BorderFactory.createTitledBorder("Show arrows"));
-        arrow_panel.add(e_uarrow_pred);
-        arrow_panel.add(e_darrow_pred);
-        
-        e_show_d = new JCheckBox("directed");
-        e_show_d.addActionListener(this);
-        e_show_d.setSelected(true);
-        e_show_u = new JCheckBox("undirected");
-        e_show_u.addActionListener(this);
-        e_show_u.setSelected(true);
-        JPanel show_edge_panel = new JPanel(new GridLayout(1,0));
-        show_edge_panel.setBorder(BorderFactory.createTitledBorder("Show edges"));
-        show_edge_panel.add(e_show_u);
-        show_edge_panel.add(e_show_d);
-        
-        shape_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
-        edge_panel.add(shape_panel);
-        gradient_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
-        edge_panel.add(gradient_panel);
-        show_edge_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
-        edge_panel.add(show_edge_panel);
-        arrow_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
-        edge_panel.add(arrow_panel);
-        
-        e_color.setAlignmentX(Component.LEFT_ALIGNMENT);
-        edge_panel.add(e_color);
-        e_labels.setAlignmentX(Component.LEFT_ALIGNMENT);
-        edge_panel.add(e_labels);
+        shape_panel.add( e_wedge );
+        shape_panel.add( e_quad );
+        shape_panel.add( e_cubic );
+        fill_edges = new JCheckBox( "fill edge shapes" );
+        fill_edges.setSelected( false );
+        fill_edges.addActionListener( this );
+        shape_panel.add( fill_edges );
+        shape_panel.setOpaque( true );
+        e_color = new JCheckBox( "edge weight highlighting" );
+        e_color.addActionListener( this );
+        e_labels = new JCheckBox( "show edge weights" );
+        e_labels.addActionListener( this );
+        e_uarrow_pred = new JCheckBox( "undirected" );
+        e_uarrow_pred.addActionListener( this );
+        e_darrow_pred = new JCheckBox( "directed" );
+        e_darrow_pred.addActionListener( this );
+        e_darrow_pred.setSelected( true );
+        JPanel arrow_panel = new JPanel( new GridLayout( 1, 0 ) );
+        arrow_panel.setBorder( BorderFactory.createTitledBorder( "Show arrows" ) );
+        arrow_panel.add( e_uarrow_pred );
+        arrow_panel.add( e_darrow_pred );
+
+        e_show_d = new JCheckBox( "directed" );
+        e_show_d.addActionListener( this );
+        e_show_d.setSelected( true );
+        e_show_u = new JCheckBox( "undirected" );
+        e_show_u.addActionListener( this );
+        e_show_u.setSelected( true );
+        JPanel show_edge_panel = new JPanel( new GridLayout( 1, 0 ) );
+        show_edge_panel.setBorder( BorderFactory.createTitledBorder( "Show edges" ) );
+        show_edge_panel.add( e_show_u );
+        show_edge_panel.add( e_show_d );
+
+        shape_panel.setAlignmentX( Component.LEFT_ALIGNMENT );
+        edge_panel.add( shape_panel );
+        gradient_panel.setAlignmentX( Component.LEFT_ALIGNMENT );
+        edge_panel.add( gradient_panel );
+        show_edge_panel.setAlignmentX( Component.LEFT_ALIGNMENT );
+        edge_panel.add( show_edge_panel );
+        arrow_panel.setAlignmentX( Component.LEFT_ALIGNMENT );
+        edge_panel.add( arrow_panel );
+
+        e_color.setAlignmentX( Component.LEFT_ALIGNMENT );
+        edge_panel.add( e_color );
+        e_labels.setAlignmentX( Component.LEFT_ALIGNMENT );
+        edge_panel.add( e_labels );
 
         // set up zoom controls
-        zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>");
-        zoom_at_mouse.addActionListener(this);
-        
+        zoom_at_mouse = new JCheckBox( "<html><center>zoom at mouse<p>(wheel only)</center></html>" );
+        zoom_at_mouse.addActionListener( this );
+
         final ScalingControl scaler = new CrossoverScalingControl();
 
-        JButton plus = new JButton("+");
-        plus.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                scaler.scale(vv, 1.1f, vv.getCenter());
-            }
-        });
-        JButton minus = new JButton("-");
-        minus.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                scaler.scale(vv, 0.9f, vv.getCenter());
+        JButton plus = new JButton( "+" );
+        plus.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                scaler.scale( vv, 1.1f, vv.getCenter() );
             }
-        });
+        } );
+        JButton minus = new JButton( "-" );
+        minus.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                scaler.scale( vv, 0.9f, vv.getCenter() );
+            }
+        } );
 
         Box zoomPanel = Box.createVerticalBox();
-        zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));
-        plus.setAlignmentX(Component.CENTER_ALIGNMENT);
-        zoomPanel.add(plus);
-        minus.setAlignmentX(Component.CENTER_ALIGNMENT);
-        zoomPanel.add(minus);
-        zoom_at_mouse.setAlignmentX(Component.CENTER_ALIGNMENT);
-        zoomPanel.add(zoom_at_mouse);
-        
+        zoomPanel.setBorder( BorderFactory.createTitledBorder( "Zoom" ) );
+        plus.setAlignmentX( Component.CENTER_ALIGNMENT );
+        zoomPanel.add( plus );
+        minus.setAlignmentX( Component.CENTER_ALIGNMENT );
+        zoomPanel.add( minus );
+        zoom_at_mouse.setAlignmentX( Component.CENTER_ALIGNMENT );
+        zoomPanel.add( zoom_at_mouse );
+
         // add font and zoom controls to center panel
-        font = new JCheckBox("bold text");
-        font.addActionListener(this);
-        font.setAlignmentX(Component.CENTER_ALIGNMENT);
-        
-        both_panel.add(zoomPanel);
-        both_panel.add(font);
-        
+        font = new JCheckBox( "bold text" );
+        font.addActionListener( this );
+        font.setAlignmentX( Component.CENTER_ALIGNMENT );
+
+        both_panel.add( zoomPanel );
+        both_panel.add( font );
+
         JComboBox modeBox = gm.getModeComboBox();
-        modeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
-        JPanel modePanel = new JPanel(new BorderLayout()) {
-            public Dimension getMaximumSize() {
+        modeBox.setAlignmentX( Component.CENTER_ALIGNMENT );
+        JPanel modePanel = new JPanel( new BorderLayout() )
+        {
+            public Dimension getMaximumSize()
+            {
                 return getPreferredSize();
             }
         };
-        modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
-        modePanel.add(modeBox);
-        both_panel.add(modePanel);
+        modePanel.setBorder( BorderFactory.createTitledBorder( "Mouse Mode" ) );
+        modePanel.add( modeBox );
+        both_panel.add( modePanel );
     }
-    
-    public void actionPerformed(ActionEvent e)
+
+    public void actionPerformed( ActionEvent e )
     {
-        AbstractButton source = (AbstractButton)e.getSource();
-        if (source == v_color)
+        AbstractButton source = (AbstractButton) e.getSource();
+        if ( source == v_color )
         {
-            vcf.setSeedColoring(source.isSelected());
+            vcf.setSeedColoring( source.isSelected() );
         }
-        else if (source == e_color)
+        else if ( source == e_color )
         {
-            ewcs.setWeighted(source.isSelected());
+            ewcs.setWeighted( source.isSelected() );
         }
-        else if (source == v_stroke) 
+        else if ( source == v_stroke )
         {
-            vsh.setHighlight(source.isSelected());
+            vsh.setHighlight( source.isSelected() );
         }
-        else if (source == v_labels)
+        else if ( source == v_labels )
         {
-            if (source.isSelected())
-                pr.setVertexStringer(vs);
+            if ( source.isSelected() )
+                pr.setVertexStringer( vs );
             else
-                pr.setVertexStringer(vs_none);
+                pr.setVertexStringer( vs_none );
         }
-        else if (source == e_labels)
+        else if ( source == e_labels )
         {
-            if (source.isSelected())
-                pr.setEdgeStringer(es);
+            if ( source.isSelected() )
+                pr.setEdgeStringer( es );
             else
-                pr.setEdgeStringer(es_none);
+                pr.setEdgeStringer( es_none );
         }
-        else if (source == e_uarrow_pred)
+        else if ( source == e_uarrow_pred )
         {
-            show_arrow.showUndirected(source.isSelected());
+            show_arrow.showUndirected( source.isSelected() );
         }
-        else if (source == e_darrow_pred)
+        else if ( source == e_darrow_pred )
         {
-            show_arrow.showDirected(source.isSelected());
+            show_arrow.showDirected( source.isSelected() );
         }
-        else if (source == font)
+        else if ( source == font )
         {
-            ff.setBold(source.isSelected());
+            ff.setBold( source.isSelected() );
         }
-        else if (source == v_shape)
+        else if ( source == v_shape )
         {
-            vssa.useFunnyShapes(source.isSelected());
+            vssa.useFunnyShapes( source.isSelected() );
         }
-        else if (source == v_size)
+        else if ( source == v_size )
         {
-            vssa.setScaling(source.isSelected());
+            vssa.setScaling( source.isSelected() );
         }
-        else if (source == v_aspect)
+        else if ( source == v_aspect )
         {
-            vssa.setStretching(source.isSelected());
+            vssa.setStretching( source.isSelected() );
         }
-        else if (source == e_line) 
+        else if ( source == e_line )
         {
-            if(source.isSelected())
+            if ( source.isSelected() )
             {
-                pr.setEdgeShapeFunction(new EdgeShape.Line());
+                pr.setEdgeShapeFunction( new EdgeShape.Line() );
             }
         }
-        else if (source == e_wedge)
+        else if ( source == e_wedge )
         {
-            if (source.isSelected())
-                pr.setEdgeShapeFunction(new EdgeShape.Wedge(10));
+            if ( source.isSelected() )
+                pr.setEdgeShapeFunction( new EdgeShape.Wedge( 10 ) );
         }
 //        else if (source == e_bent) 
 //        {
@@ -621,127 +630,131 @@
 //                pr.setEdgeShapeFunction(new EdgeShape.BentLine());
 //            }
 //        }
-        else if (source == e_quad) 
+        else if ( source == e_quad )
         {
-            if(source.isSelected())
+            if ( source.isSelected() )
             {
-                pr.setEdgeShapeFunction(new EdgeShape.QuadCurve());
+                pr.setEdgeShapeFunction( new EdgeShape.QuadCurve() );
             }
         }
-        else if (source == e_cubic) 
+        else if ( source == e_cubic )
         {
-            if(source.isSelected())
+            if ( source.isSelected() )
             {
-                pr.setEdgeShapeFunction(new EdgeShape.CubicCurve());
+                pr.setEdgeShapeFunction( new EdgeShape.CubicCurve() );
             }
         }
-       else if (source == e_show_d)
+        else if ( source == e_show_d )
+        {
+            show_edge.showDirected( source.isSelected() );
+        }
+        else if ( source == e_show_u )
         {
-            show_edge.showDirected(source.isSelected());
+            show_edge.showUndirected( source.isSelected() );
         }
-        else if (source == e_show_u)
+        else if ( source == v_small )
         {
-            show_edge.showUndirected(source.isSelected());
+            show_vertex.filterSmall( source.isSelected() );
         }
-        else if (source == v_small)
+        else if ( source == zoom_at_mouse )
         {
-            show_vertex.filterSmall(source.isSelected());
+            gm.setZoomAtMouse( source.isSelected() );
         }
-        else if(source == zoom_at_mouse)
+        else if ( source == no_gradient )
         {
-            gm.setZoomAtMouse(source.isSelected());
-        } 
-        else if (source == no_gradient) {
-			if (source.isSelected()) {
-				gradient_level = GRADIENT_NONE;
-			}
+            if ( source.isSelected() )
+            {
+                gradient_level = GRADIENT_NONE;
+            }
 //		} else if (source == gradient_absolute) {
 //			if (source.isSelected()) {
 //				gradient_level = GRADIENT_ABSOLUTE;
 //			}
-		} 
-        else if (source == gradient_relative) {
-			if (source.isSelected()) {
-				gradient_level = GRADIENT_RELATIVE;
-			}
-		}
-        else if (source == fill_edges)
+        }
+        else if ( source == gradient_relative )
         {
-            edgePaint.useFill(source.isSelected());
+            if ( source.isSelected() )
+            {
+                gradient_level = GRADIENT_RELATIVE;
+            }
+        }
+        else if ( source == fill_edges )
+        {
+            edgePaint.useFill( source.isSelected() );
         }
         vv.repaint();
     }
-    
+
     private final class SeedColor implements VertexPaintFunction
     {
         protected PickedInfo pi;
         protected final static float dark_value = 0.8f;
         protected final static float light_value = 0.2f;
         protected boolean seed_coloring;
-        
-        public SeedColor(PickedInfo pi)
+
+        public SeedColor( PickedInfo pi )
         {
             this.pi = pi;
             seed_coloring = false;
         }
 
-        public void setSeedColoring(boolean b)
+        public void setSeedColoring( boolean b )
         {
             this.seed_coloring = b;
         }
-        
-        public Paint getDrawPaint(Vertex v)
+
+        public Paint getDrawPaint( Vertex v )
         {
             return Color.BLACK;
         }
-        
-        public Paint getFillPaint(Vertex v)
+
+        public Paint getFillPaint( Vertex v )
         {
-            float alpha = transparency.getNumber(v).floatValue();
-            if (pi.isPicked(v))
+            float alpha = transparency.getNumber( v ).floatValue();
+            if ( pi.isPicked( v ) )
             {
-                return new Color(1f, 1f, 0, alpha); 
+                return new Color( 1f, 1f, 0, alpha );
             }
             else
             {
-                if (seed_coloring && v.containsUserDatumKey(BarabasiAlbertGenerator.SEED))
+                if ( seed_coloring && v.containsUserDatumKey( BarabasiAlbertGenerator.SEED ) )
                 {
-                    Color dark = new Color(0, 0, dark_value, alpha);
-                    Color light = new Color(0, 0, light_value, alpha);
-                    return new GradientPaint( 0, 0, dark, 10, 0, light, true);
+                    Color dark = new Color( 0, 0, dark_value, alpha );
+                    Color light = new Color( 0, 0, light_value, alpha );
+                    return new GradientPaint( 0, 0, dark, 10, 0, light, true );
                 }
                 else
-                    return new Color(1f, 0, 0, alpha);
+                    return new Color( 1f, 0, 0, alpha );
             }
-                
+
         }
     }
-    
+
     private final static class EdgeWeightStrokeFunction
-    implements EdgeStrokeFunction
+        implements EdgeStrokeFunction
     {
-        protected static final Stroke basic = new BasicStroke(1);
-        protected static final Stroke heavy = new BasicStroke(2);
+        protected static final Stroke basic = new BasicStroke( 1 );
+        protected static final Stroke heavy = new BasicStroke( 2 );
         protected static final Stroke dotted = PluggableRenderer.DOTTED;
-        
+
         protected boolean weighted = false;
         protected NumberEdgeValue edge_weight;
-        
-        public EdgeWeightStrokeFunction(NumberEdgeValue edge_weight)
+
+        public EdgeWeightStrokeFunction( NumberEdgeValue edge_weight )
         {
             this.edge_weight = edge_weight;
         }
-        
-        public void setWeighted(boolean weighted)
+
+        public void setWeighted( boolean weighted )
         {
             this.weighted = weighted;
         }
-        
-        public Stroke getStroke(Edge e)
+
+        public Stroke getStroke( Edge e )
         {
-            if (weighted)
+            if ( weighted )
             {
-                if (drawHeavy(e))
+                if ( drawHeavy( e ) )
                     return heavy;
                 else
                     return dotted;
@@ -749,325 +762,350 @@
             else
                 return basic;
         }
-        
-        protected boolean drawHeavy(Edge e)
+
+        protected boolean drawHeavy( Edge e )
         {
-            double value = edge_weight.getNumber(e).doubleValue();
-            if (value > 0.7)
+            double value = edge_weight.getNumber( e ).doubleValue();
+            if ( value > 0.7 )
                 return true;
             else
                 return false;
         }
-        
+
     }
-    
+
     private final static class VertexStrokeHighlight implements VertexStrokeFunction
     {
         protected boolean highlight = false;
-        protected Stroke heavy = new BasicStroke(5);
-        protected Stroke medium = new BasicStroke(3);
-        protected Stroke light = new BasicStroke(1);
+        protected Stroke heavy = new BasicStroke( 5 );
+        protected Stroke medium = new BasicStroke( 3 );
+        protected Stroke light = new BasicStroke( 1 );
         protected PickedInfo pi;
-        
-        public VertexStrokeHighlight(PickedInfo pi)
+
+        public VertexStrokeHighlight( PickedInfo pi )
         {
             this.pi = pi;
         }
-        
-        public void setHighlight(boolean highlight)
+
+        public void setHighlight( boolean highlight )
         {
             this.highlight = highlight;
         }
-        
-        public Stroke getStroke(Vertex v)
+
+        public Stroke getStroke( Vertex v )
         {
-            if (highlight)
+            if ( highlight )
             {
-                if (pi.isPicked(v))
+                if ( pi.isPicked( v ) )
                     return heavy;
                 else
                 {
-                    for (Iterator iter = v.getNeighbors().iterator(); iter.hasNext(); )
+                    for ( Iterator iter = v.getNeighbors().iterator(); iter.hasNext(); )
                     {
-                        Vertex w = (Vertex)iter.next();
-                        if (pi.isPicked(w))
+                        Vertex w = (Vertex) iter.next();
+                        if ( pi.isPicked( w ) )
                             return medium;
                     }
                     return light;
                 }
             }
             else
-                return light; 
+                return light;
         }
     }
-    
+
     private final static class FontHandler implements VertexFontFunction, EdgeFontFunction
     {
         protected boolean bold = false;
-        Font f = new Font("Helvetica", Font.PLAIN, 12);
-        Font b = new Font("Helvetica", Font.BOLD, 12);
-        
-        public void setBold(boolean bold)
+        Font f = new Font( "Helvetica", Font.PLAIN, 12 );
+        Font b = new Font( "Helvetica", Font.BOLD, 12 );
+
+        public void setBold( boolean bold )
         {
             this.bold = bold;
         }
-        
-        public Font getFont(Vertex v)
+
+        public Font getFont( Vertex v )
         {
-            if (bold)
+            if ( bold )
                 return b;
             else
                 return f;
         }
-        
-        public Font getFont(Edge e)
+
+        public Font getFont( Edge e )
         {
-            if (bold)
+            if ( bold )
                 return b;
-            else 
+            else
                 return f;
         }
     }
-    
+
     private final static class DirectionDisplayPredicate implements Predicate
     {
         protected boolean show_d;
         protected boolean show_u;
-        
-        public DirectionDisplayPredicate(boolean show_d, boolean show_u)
+
+        public DirectionDisplayPredicate( boolean show_d, boolean show_u )
         {
             this.show_d = show_d;
             this.show_u = show_u;
         }
-        
-        public void showDirected(boolean b)
+
+        public void showDirected( boolean b )
         {
             show_d = b;
         }
-        
-        public void showUndirected(boolean b)
+
+        public void showUndirected( boolean b )
         {
             show_u = b;
         }
-        
-        public boolean evaluate(Object arg0)
+
+        public boolean evaluate( Object arg0 )
         {
-            if (arg0 instanceof DirectedEdge && show_d)
+            if ( arg0 instanceof DirectedEdge && show_d )
                 return true;
-            if (arg0 instanceof UndirectedEdge && show_u)
+            if ( arg0 instanceof UndirectedEdge && show_u )
                 return true;
             return false;
         }
     }
-    
+
     private final static class VertexDisplayPredicate implements Predicate
     {
         protected boolean filter_small;
         protected final static int MIN_DEGREE = 4;
-        
-        public VertexDisplayPredicate(boolean filter)
+
+        public VertexDisplayPredicate( boolean filter )
         {
             this.filter_small = filter;
         }
-        
-        public void filterSmall(boolean b)
+
+        public void filterSmall( boolean b )
         {
             filter_small = b;
         }
-        
-        public boolean evaluate(Object arg0)
+
+        public boolean evaluate( Object arg0 )
         {
-            Vertex v = (Vertex)arg0;
-            if (filter_small)
-                return (v.degree() >= MIN_DEGREE);
+            Vertex v = (Vertex) arg0;
+            if ( filter_small )
+                return ( v.degree() >= MIN_DEGREE );
             else
                 return true;
         }
     }
-    
+
     /**
      * Controls the shape, size, and aspect ratio for each vertex.
-     * 
+     *
      * @author Joshua O'Madadhain
      */
-    private final static class VertexShapeSizeAspect 
-    extends AbstractVertexShapeFunction 
-    implements VertexSizeFunction, VertexAspectRatioFunction
+    private final static class VertexShapeSizeAspect
+        extends AbstractVertexShapeFunction
+        implements VertexSizeFunction, VertexAspectRatioFunction
     {
         protected boolean stretch = false;
         protected boolean scale = false;
         protected boolean funny_shapes = false;
         protected NumberVertexValue voltages;
-        
-        public VertexShapeSizeAspect(NumberVertexValue voltages)
+
+        public VertexShapeSizeAspect( NumberVertexValue voltages )
         {
             this.voltages = voltages;
-            setSizeFunction(this);
-            setAspectRatioFunction(this);
+            setSizeFunction( this );
+            setAspectRatioFunction( this );
         }
-        
-        public void setStretching(boolean stretch)
+
+        public void setStretching( boolean stretch )
         {
             this.stretch = stretch;
         }
-        
-        public void setScaling(boolean scale)
+
+        public void setScaling( boolean scale )
         {
             this.scale = scale;
         }
-        
-        public void useFunnyShapes(boolean use)
+
+        public void useFunnyShapes( boolean use )
         {
             this.funny_shapes = use;
         }
-        
-        public int getSize(Vertex v)
+
+        public int getSize( Vertex v )
         {
-            if (scale)
-                return (int)(voltages.getNumber(v).doubleValue() * 30) + 20;
+            if ( scale )
+                return (int) ( voltages.getNumber( v ).doubleValue() * 30 ) + 20;
             else
                 return 20;
         }
-        
-        public float getAspectRatio(Vertex v)
+
+        public float getAspectRatio( Vertex v )
         {
-            if (stretch)
-                return (float)(v.inDegree() + 1) / (v.outDegree() + 1);
+            if ( stretch )
+                return (float) ( v.inDegree() + 1 ) / ( v.outDegree() + 1 );
             else
                 return 1.0f;
         }
-        
-        public Shape getShape(Vertex v)
+
+        public Shape getShape( Vertex v )
         {
-            if (funny_shapes)
+            if ( funny_shapes )
             {
-                if (v.degree() < 5)
+                if ( v.degree() < 5 )
                 {
-                    int sides = Math.max(v.degree(), 3);
-                    return factory.getRegularPolygon(v, sides);
+                    int sides = Math.max( v.degree(), 3 );
+                    return factory.getRegularPolygon( v, sides );
                 }
                 else
-                    return factory.getRegularStar(v, v.degree());
+                    return factory.getRegularStar( v, v.degree() );
             }
             else
-                return factory.getEllipse(v);
+                return factory.getEllipse( v );
         }
-        
+
     }
-    
+
     /**
      * a GraphMousePlugin that offers popup
      * menu support
      */
-    protected class PopupGraphMousePlugin extends AbstractPopupGraphMousePlugin implements MouseListener {
-        
-        public PopupGraphMousePlugin() {
-            this(MouseEvent.BUTTON3_MASK);
+    protected class PopupGraphMousePlugin extends AbstractPopupGraphMousePlugin implements MouseListener
+    {
+
+        public PopupGraphMousePlugin()
+        {
+            this( MouseEvent.BUTTON3_MASK );
         }
-        public PopupGraphMousePlugin(int modifiers) {
-            super(modifiers);
+
+        public PopupGraphMousePlugin( int modifiers )
+        {
+            super( modifiers );
         }
-        
+
         /**
          * If this event is over a Vertex, pop up a menu to
          * allow the user to increase/decrease the voltage
          * attribute of this Vertex
+         *
          * @param e
          */
-        protected void handlePopup(MouseEvent e) {
-            final VisualizationViewer vv = 
-                (VisualizationViewer)e.getSource();
-            Point2D p = vv.inverseViewTransform(e.getPoint());
-            
+        protected void handlePopup( MouseEvent e )
+        {
+            final VisualizationViewer vv =
+                (VisualizationViewer) e.getSource();
+            Point2D p = vv.inverseViewTransform( e.getPoint() );
+
             PickSupport pickSupport = vv.getPickSupport();
-            if(pickSupport != null) {
-                final Vertex v = pickSupport.getVertex(p.getX(), p.getY());
-                if(v != null) {
+            if ( pickSupport != null )
+            {
+                final Vertex v = pickSupport.getVertex( p.getX(), p.getY() );
+                if ( v != null )
+                {
                     JPopupMenu popup = new JPopupMenu();
-                    popup.add(new AbstractAction("Decrease Transparency") {
-                        public void actionPerformed(ActionEvent e) {
-                            MutableDouble value = (MutableDouble)transparency.getNumber(v);
-                            value.setDoubleValue(Math.min(1, value.doubleValue() + 0.1));
+                    popup.add( new AbstractAction( "Decrease Transparency" )
+                    {
+                        public void actionPerformed( ActionEvent e )
+                        {
+                            MutableDouble value = (MutableDouble) transparency.getNumber( v );
+                            value.setDoubleValue( Math.min( 1, value.doubleValue() + 0.1 ) );
                             vv.repaint();
                         }
-                    });
-                    popup.add(new AbstractAction("Increase Transparency"){
-                        public void actionPerformed(ActionEvent e) {
-                            MutableDouble value = (MutableDouble)transparency.getNumber(v);
-                            value.setDoubleValue(Math.max(0, value.doubleValue() - 0.1));
+                    } );
+                    popup.add( new AbstractAction( "Increase Transparency" )
+                    {
+                        public void actionPerformed( ActionEvent e )
+                        {
+                            MutableDouble value = (MutableDouble) transparency.getNumber( v );
+                            value.setDoubleValue( Math.max( 0, value.doubleValue() - 0.1 ) );
                             vv.repaint();
                         }
-                    });
-                    popup.show(vv, e.getX(), e.getY());
-                } else {
-                    final Edge edge = pickSupport.getEdge(p.getX(), p.getY());
-                    if(edge != null) {
+                    } );
+                    popup.show( vv, e.getX(), e.getY() );
+                }
+                else
+                {
+                    final Edge edge = pickSupport.getEdge( p.getX(), p.getY() );
+                    if ( edge != null )
+                    {
                         JPopupMenu popup = new JPopupMenu();
-                        popup.add(new AbstractAction(edge.toString()) {
-                            public void actionPerformed(ActionEvent e) {
-                                System.err.println("got "+edge);
+                        popup.add( new AbstractAction( edge.toString() )
+                        {
+                            public void actionPerformed( ActionEvent e )
+                            {
+                                System.err.println( "got " + edge );
                             }
-                        });
-                        popup.show(vv, e.getX(), e.getY());
-                       
+                        } );
+                        popup.show( vv, e.getX(), e.getY() );
+
                     }
                 }
             }
         }
     }
-    
-    public class VoltageTips extends DefaultToolTipFunction {
-        
-        public String getToolTipText(Vertex v) {
-           return "Voltage:"+voltages.getNumber(v);
+
+    public class VoltageTips extends DefaultToolTipFunction
+    {
+
+        public String getToolTipText( Vertex v )
+        {
+            return "Voltage:" + voltages.getNumber( v );
         }
-        public String getToolTipText(Edge edge) {
+
+        public String getToolTipText( Edge edge )
+        {
             return edge.toString();
         }
     }
-    
-    public class GradientPickedEdgePaintFunction extends GradientEdgePaintFunction 
+
+    public class GradientPickedEdgePaintFunction extends GradientEdgePaintFunction
     {
         private PickedInfo pi;
         private EdgePaintFunction defaultFunc;
         private final Predicate self_loop = SelfLoopEdgePredicate.getInstance();
         protected boolean fill_edge = false;
-        
-        public GradientPickedEdgePaintFunction( EdgePaintFunction defaultEdgePaintFunction, HasGraphLayout vv, 
-                LayoutTransformer transformer, PickedInfo pi ) 
+
+        public GradientPickedEdgePaintFunction( EdgePaintFunction defaultEdgePaintFunction, HasGraphLayout vv,
+                                                LayoutTransformer transformer, PickedInfo pi )
         {
-            super(Color.WHITE, Color.BLACK, vv, transformer);
+            super( Color.WHITE, Color.BLACK, vv, transformer );
             this.defaultFunc = defaultEdgePaintFunction;
             this.pi = pi;
         }
-        
-        public void useFill(boolean b)
+
+        public void useFill( boolean b )
         {
             fill_edge = b;
         }
-        
-        public Paint getDrawPaint(Edge e) {
-            if (gradient_level == GRADIENT_NONE) {
-                return defaultFunc.getDrawPaint(e);
-            } else {
-                return super.getDrawPaint(e);
+
+        public Paint getDrawPaint( Edge e )
+        {
+            if ( gradient_level == GRADIENT_NONE )
+            {
+                return defaultFunc.getDrawPaint( e );
+            }
+            else
+            {
+                return super.getDrawPaint( e );
             }
         }
-        
-        protected Color getColor2(Edge e)
+
+        protected Color getColor2( Edge e )
         {
-            return pi.isPicked(e)? Color.CYAN : c2;
+            return pi.isPicked( e ) ? Color.CYAN : c2;
         }
-        
-        public Paint getFillPaint(Edge e)
+
+        public Paint getFillPaint( Edge e )
         {
-            if (self_loop.evaluate(e) || !fill_edge)
+            if ( self_loop.evaluate( e ) || !fill_edge )
                 return null;
             else
-                return getDrawPaint(e);
+                return getDrawPaint( e );
         }
-        
+
     }
-    
+
 }
 

Added: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java?rev=355901&view=auto
==============================================================================
--- maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java (added)
+++ maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java Sat Dec 10 20:35:13 2005
@@ -0,0 +1,54 @@
+package org.apache.maven.pomo;
+
+import java.io.IOException;
+
+import javax.swing.JFrame;
+
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.io.PajekNetReader;
+import edu.uci.ics.jung.visualization.PluggableRenderer;
+import edu.uci.ics.jung.visualization.SpringLayout;
+import edu.uci.ics.jung.visualization.VisualizationViewer;
+
+/**
+ * Illustrates the simplest possible drawing program.
+ * Does the following:
+ * <ul>
+ * <li/>reads in a graph
+ * <li/>creates a <code>Layout</code> based on that graph
+ * <li/>creates a <code>Renderer</code>
+ * <li/>creates a <code>VisualizationViewer</code> based on that layout and renderer
+ * <li/>adds the <code>VisualizationViewer</code> object to a Swing <code>JFrame</code>'s
+ * content pane.
+ * </ul>
+ * Does no processing, no filtering, and no customization of the rendering.
+ *
+ * @author danyelf
+ */
+public class SimpleGraphDraw
+{
+
+    public static void main( String[] args ) throws IOException
+    {
+        JFrame jf = new JFrame();
+        Graph g = getGraph();
+        VisualizationViewer vv = new VisualizationViewer( new SpringLayout( g ), new PluggableRenderer() );
+        jf.getContentPane().add( vv );
+        jf.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
+        jf.pack();
+        jf.show();
+    }
+
+    /**
+     * Generates a graph: in this case, reads it from the file
+     * "samples/datasetsgraph/simple.net"
+     *
+     * @return A sample undirected graph
+     */
+    public static Graph getGraph() throws IOException
+    {
+        PajekNetReader pnr = new PajekNetReader();
+        Graph g = pnr.load( "samples/datasets/simple.net" );
+        return g;
+    }
+}

Propchange: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SimpleGraphDraw.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java?rev=355901&view=auto
==============================================================================
--- maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java (added)
+++ maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java Sat Dec 10 20:35:13 2005
@@ -0,0 +1,230 @@
+package org.apache.maven.pomo;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.geom.Point2D;
+
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import edu.uci.ics.jung.graph.ArchetypeVertex;
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.graph.decorators.DefaultToolTipFunction;
+import edu.uci.ics.jung.graph.decorators.EdgeShape;
+import edu.uci.ics.jung.graph.decorators.PickableEdgePaintFunction;
+import edu.uci.ics.jung.utils.TestGraphs;
+import edu.uci.ics.jung.visualization.DefaultVisualizationModel;
+import edu.uci.ics.jung.visualization.FRLayout;
+import edu.uci.ics.jung.visualization.GraphZoomScrollPane;
+import edu.uci.ics.jung.visualization.MultiPickedState;
+import edu.uci.ics.jung.visualization.PickedState;
+import edu.uci.ics.jung.visualization.PluggableRenderer;
+import edu.uci.ics.jung.visualization.ShapePickSupport;
+import edu.uci.ics.jung.visualization.VisualizationModel;
+import edu.uci.ics.jung.visualization.VisualizationViewer;
+import edu.uci.ics.jung.visualization.control.CrossoverScalingControl;
+import edu.uci.ics.jung.visualization.control.DefaultModalGraphMouse;
+import edu.uci.ics.jung.visualization.control.ModalGraphMouse;
+import edu.uci.ics.jung.visualization.control.ScalingControl;
+import edu.uci.ics.jung.visualization.subLayout.CircularSubLayout;
+import edu.uci.ics.jung.visualization.subLayout.SubLayout;
+import edu.uci.ics.jung.visualization.subLayout.SubLayoutDecorator;
+
+/**
+ * Demonstrates the Cluster, CircularCluster, and ClusteringLayout
+ * classes. In this demo, vertices are visually clustered as they
+ * are selected. The cluster is formed in a circle centered at the
+ * location of the first vertex selected.
+ *
+ * @author Tom Nelson - RABA Technologies
+ */
+public class SubLayoutDemo extends JApplet
+{
+
+    String instructions =
+        "<html>Use the mouse to select multiple vertices" +
+            "<p>either by dragging a region, or by shift-clicking" +
+            "<p>on multiple vertices." +
+            "<p>As you select vertices, they become part of a" +
+            "<p>cluster, centered at the location of the first" +
+            "<p>selected vertex." +
+            "<p>You can drag the cluster with the mouse." +
+            "<p>Use the 'Picking'/'Transforming' combo-box to switch" +
+            "<p>between picking and transforming mode.</html>";
+    /**
+     * the graph
+     */
+    Graph graph;
+
+    /**
+     * the visual component and renderer for the graph
+     */
+    VisualizationViewer vv;
+
+    SubLayoutDecorator clusteringLayout;
+
+    PickedState ps;
+
+    /**
+     * create an instance of a simple graph with controls to
+     * demo the zoomand hyperbolic features.
+     */
+    public SubLayoutDemo()
+    {
+
+        // create a simple graph for the demo
+        graph = TestGraphs.getOneComponentGraph();
+
+        PluggableRenderer pr = new PluggableRenderer();
+        // ClusteringLayout is a decorator class that delegates
+        // to another layout, but can also sepately manage the
+        // layout of sub-sets of vertices in circular clusters.
+        clusteringLayout = new SubLayoutDecorator( new FRLayout( graph ) );
+
+
+        Dimension preferredSize = new Dimension( 400, 400 );
+        final VisualizationModel visualizationModel =
+            new DefaultVisualizationModel( clusteringLayout, preferredSize );
+        vv = new VisualizationViewer( visualizationModel, pr, preferredSize );
+        vv.setPickSupport( new ShapePickSupport() );
+        pr.setEdgeShapeFunction( new EdgeShape.QuadCurve() );
+
+        vv.setPickedState( new ClusterListener( clusteringLayout ) );
+        ps = vv.getPickedState();
+        pr.setEdgePaintFunction( new PickableEdgePaintFunction( ps, Color.black, Color.red ) );
+        vv.setBackground( Color.white );
+
+        // add a listener for ToolTips
+        vv.setToolTipFunction( new DefaultToolTipFunction() );
+
+        /**
+         * the regular graph mouse for the normal view
+         */
+        final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();
+
+        vv.setGraphMouse( graphMouse );
+
+        Container content = getContentPane();
+        GraphZoomScrollPane gzsp = new GraphZoomScrollPane( vv );
+        content.add( gzsp );
+
+        JComboBox modeBox = graphMouse.getModeComboBox();
+        modeBox.addItemListener( graphMouse.getModeListener() );
+        graphMouse.setMode( ModalGraphMouse.Mode.PICKING );
+
+        final ScalingControl scaler = new CrossoverScalingControl();
+
+        JButton plus = new JButton( "+" );
+        plus.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                scaler.scale( vv, 1.1f, vv.getCenter() );
+            }
+        } );
+        JButton minus = new JButton( "-" );
+        minus.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                scaler.scale( vv, 0.9f, vv.getCenter() );
+            }
+        } );
+
+        JButton help = new JButton( "Help" );
+        help.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                JOptionPane.showMessageDialog( (JComponent) e.getSource(), instructions, "Help", JOptionPane.PLAIN_MESSAGE );
+            }
+        } );
+
+        JPanel controls = new JPanel();
+        JPanel zoomControls = new JPanel( new GridLayout( 2, 1 ) );
+        zoomControls.setBorder( BorderFactory.createTitledBorder( "Zoom" ) );
+        zoomControls.add( plus );
+        zoomControls.add( minus );
+        controls.add( zoomControls );
+        controls.add( modeBox );
+        controls.add( help );
+        content.add( controls, BorderLayout.SOUTH );
+    }
+
+    class ClusterListener extends MultiPickedState
+    {
+
+        SubLayoutDecorator layout;
+        Point2D center;
+
+        /* (non-Javadoc)
+        * @see edu.uci.ics.jung.visualization.MultiPickedState#pick(edu.uci.ics.jung.graph.ArchetypeVertex, boolean)
+        */
+        public boolean pick( ArchetypeVertex v, boolean picked )
+        {
+            boolean result = super.pick( v, picked );
+            if ( picked )
+            {
+                vertexPicked( v );
+            }
+            else
+            {
+                vertexUnpicked( v );
+            }
+            return result;
+        }
+
+        public ClusterListener( SubLayoutDecorator layout )
+        {
+            this.layout = layout;
+        }
+
+        public void vertexPicked( ArchetypeVertex v )
+        {
+            if ( center == null )
+            {
+                center = layout.getLocation( v );
+            }
+            layout.removeAllSubLayouts();
+            SubLayout subLayout = new CircularSubLayout( getPickedVertices(), 20, center );
+            layout.addSubLayout( subLayout );
+        }
+
+        public void vertexUnpicked( ArchetypeVertex v )
+        {
+            layout.removeAllSubLayouts();
+            if ( getPickedVertices().isEmpty() == false )
+            {
+                SubLayout subLayout = new CircularSubLayout( getPickedVertices(), 20, center );
+                layout.addSubLayout( subLayout );
+            }
+            else
+            {
+                center = null;
+            }
+        }
+    }
+
+    /**
+     * a driver for this demo
+     */
+    public static void main( String[] args )
+    {
+        JFrame f = new JFrame();
+        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
+        f.getContentPane().add( new SubLayoutDemo() );
+        f.pack();
+        f.show();
+    }
+}

Propchange: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/SubLayoutDemo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java
URL: http://svn.apache.org/viewcvs/maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java?rev=355901&view=auto
==============================================================================
--- maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java (added)
+++ maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java Sat Dec 10 20:35:13 2005
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.pomo;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JApplet;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.decorators.DefaultToolTipFunction;
+import edu.uci.ics.jung.graph.decorators.EdgeShape;
+import edu.uci.ics.jung.graph.decorators.EllipseVertexShapeFunction;
+import edu.uci.ics.jung.graph.decorators.PickableEdgePaintFunction;
+import edu.uci.ics.jung.graph.decorators.PickableVertexPaintFunction;
+import edu.uci.ics.jung.graph.impl.DirectedSparseEdge;
+import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;
+import edu.uci.ics.jung.graph.impl.SparseTree;
+import edu.uci.ics.jung.visualization.DefaultGraphLabelRenderer;
+import edu.uci.ics.jung.visualization.GraphZoomScrollPane;
+import edu.uci.ics.jung.visualization.Layout;
+import edu.uci.ics.jung.visualization.PluggableRenderer;
+import edu.uci.ics.jung.visualization.ShapePickSupport;
+import edu.uci.ics.jung.visualization.VisualizationViewer;
+import edu.uci.ics.jung.visualization.contrib.TreeLayout;
+import edu.uci.ics.jung.visualization.control.CrossoverScalingControl;
+import edu.uci.ics.jung.visualization.control.CrossoverScalingGraphMousePlugin;
+import edu.uci.ics.jung.visualization.control.PickingGraphMousePlugin;
+import edu.uci.ics.jung.visualization.control.PluggableGraphMouse;
+import edu.uci.ics.jung.visualization.control.ScalingControl;
+import edu.uci.ics.jung.visualization.control.ViewScalingGraphMousePlugin;
+
+/**
+ * Demonstrates the use of images to represent graph vertices.
+ * The images are supplied via the VertexShapeFunction so that
+ * both the image and its shape can be utilized.
+ * <p/>
+ * The images used in this demo (courtesy of slashdot.org) are
+ * rectangular but with a transparent background. When vertices
+ * are represented by these images, it looks better if the actual
+ * shape of the opaque part of the image is computed so that the
+ * edge arrowheads follow the visual shape of the image. This demo
+ * uses the FourPassImageShaper class to compute the Shape from
+ * an image with transparent background.
+ *
+ * @author Tom Nelson - RABA Technologies
+ */
+public class TreeLayoutDemo extends JApplet
+{
+
+    /**
+     * the graph
+     */
+    SparseTree graph;
+
+    /**
+     * the visual component and renderer for the graph
+     */
+    VisualizationViewer vv;
+
+    Vertex root;
+
+    public TreeLayoutDemo()
+    {
+
+        root = new DirectedSparseVertex();
+        // create a simple graph for the demo
+        graph = new SparseTree( root );
+        Vertex[] vertices = createVertices( root, 11 );
+
+        createEdges( vertices );
+
+        final PluggableRenderer pr = new PluggableRenderer();
+
+        pr.setVertexPaintFunction( new PickableVertexPaintFunction( pr, Color.black, Color.white, Color.yellow ) );
+        pr.setEdgePaintFunction( new PickableEdgePaintFunction( pr, Color.black, Color.cyan ) );
+        pr.setGraphLabelRenderer( new DefaultGraphLabelRenderer( Color.cyan, Color.cyan ) );
+
+        pr.setVertexShapeFunction( new EllipseVertexShapeFunction() );
+
+        Layout layout = new TreeLayout( graph );
+
+        vv = new VisualizationViewer( layout, pr, new Dimension( 400, 400 ) );
+        vv.setPickSupport( new ShapePickSupport() );
+        pr.setEdgeShapeFunction( new EdgeShape.QuadCurve() );
+        vv.setBackground( Color.white );
+
+        // add a listener for ToolTips
+        vv.setToolTipFunction( new DefaultToolTipFunction() );
+
+        Container content = getContentPane();
+        final GraphZoomScrollPane panel = new GraphZoomScrollPane( vv );
+        content.add( panel );
+
+        final PluggableGraphMouse graphMouse = new PluggableGraphMouse();
+        graphMouse.add( new PickingGraphMousePlugin() );
+        graphMouse.add( new ViewScalingGraphMousePlugin() );
+        graphMouse.add( new CrossoverScalingGraphMousePlugin() );
+
+        vv.setGraphMouse( graphMouse );
+
+        final ScalingControl scaler = new CrossoverScalingControl();
+
+        JButton plus = new JButton( "+" );
+        plus.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                scaler.scale( vv, 1.1f, vv.getCenter() );
+            }
+        } );
+        JButton minus = new JButton( "-" );
+        minus.addActionListener( new ActionListener()
+        {
+            public void actionPerformed( ActionEvent e )
+            {
+                scaler.scale( vv, 0.9f, vv.getCenter() );
+            }
+        } );
+
+        JPanel scaleGrid = new JPanel( new GridLayout( 1, 0 ) );
+        scaleGrid.setBorder( BorderFactory.createTitledBorder( "Zoom" ) );
+
+        JPanel controls = new JPanel();
+        scaleGrid.add( plus );
+        scaleGrid.add( minus );
+        controls.add( scaleGrid );
+
+        content.add( controls, BorderLayout.SOUTH );
+    }
+
+    /**
+     * create some vertices
+     *
+     * @param count how many to create
+     * @return the Vertices in an array
+     */
+    private Vertex[] createVertices( Vertex root, int count )
+    {
+        Vertex[] v = new Vertex[count];
+        v[0] = root;
+        for ( int i = 1; i < count; i++ )
+        {
+            v[i] = graph.addVertex( new DirectedSparseVertex() );
+        }
+        return v;
+    }
+
+    /**
+     * create edges for this demo graph
+     *
+     * @param v an array of Vertices to connect
+     */
+    void createEdges( Vertex[] v )
+    {
+        graph.addEdge( new DirectedSparseEdge( v[0], v[1] ) );
+        graph.addEdge( new DirectedSparseEdge( v[0], v[2] ) );
+        graph.addEdge( new DirectedSparseEdge( v[2], v[3] ) );
+        graph.addEdge( new DirectedSparseEdge( v[1], v[4] ) );
+        graph.addEdge( new DirectedSparseEdge( v[2], v[5] ) );
+        graph.addEdge( new DirectedSparseEdge( v[4], v[6] ) );
+        graph.addEdge( new DirectedSparseEdge( v[4], v[7] ) );
+        graph.addEdge( new DirectedSparseEdge( v[3], v[8] ) );
+        graph.addEdge( new DirectedSparseEdge( v[6], v[9] ) );
+        graph.addEdge( new DirectedSparseEdge( v[4], v[10] ) );
+    }
+
+    /**
+     * a driver for this demo
+     */
+    public static void main( String[] args )
+    {
+        JFrame frame = new JFrame();
+        Container content = frame.getContentPane();
+        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
+
+        content.add( new TreeLayoutDemo() );
+        frame.pack();
+        frame.show();
+    }
+}

Propchange: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/pomo/src/main/java/org/apache/maven/pomo/TreeLayoutDemo.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"



Mime
View raw message