Coverage details for edu.uci.ics.jung.visualization.contrib.BirdsEyeGraphDraw

LineHitsSource
1 /*
2  * Copyright (c) 2003, the JUNG Project and the Regents of the University of
3  * California All rights reserved.
4  *
5  * This software is open-source under the BSD license; see either "license.txt"
6  * or http://jung.sourceforge.net/license.txt for a description.
7  */
8 package edu.uci.ics.jung.visualization.contrib;
9  
10 import java.awt.BorderLayout;
11 import java.awt.Color;
12  
13 import javax.swing.JComponent;
14  
15 import edu.uci.ics.jung.visualization.BirdsEyeVisualizationViewer;
16 import edu.uci.ics.jung.visualization.GraphDraw;
17 import edu.uci.ics.jung.visualization.Layout;
18 import edu.uci.ics.jung.visualization.Renderer;
19  
20 /**
21  * Similar to GraphDraw, but with no method calls that will modify the
22  * underlying graph. This component is used as the view to create a
23  * birds-eye zoom/pan tool
24  *
25  * @author Tom Nelson - adapted from code written by Danyel Fisher
26  * @deprecated As of version 1.7. See SatelliteViewDemo for an example of how to do this.
27  */
28 public class BirdsEyeGraphDraw extends JComponent {
29  
30     /**
31      * the GraphDraw to manage
32      */
33     protected GraphDraw gd;
34     
35     /**
36      * the first SettableRenderer created
37      */
38     private final Renderer originalRenderer;
39     
40     /**
41      * the renderer that is passed thru to the VisualizationViewer
42      */
43     Renderer r;
44     
45     /**
46      * the layout in use
47      */
48     Layout layout;
49     
50     /**
51      * the VisualizationViewer for this GraphDraw. It does not
52      * modify the underlying graph
53      */
54     BirdsEyeVisualizationViewer vv;
55  
56     /**
57      * Creates a read-only graph drawing environment that draws this graph object. By
58      * default, uses the Spring layout, the Fade renderer and the
59      * AbstractSettable renderer,
60      *
61      * @param g the graph
62      * @param scalex the scale in the horizontal axis
63      * @param scaley the scale in the vertical axis
64      */
650    public BirdsEyeGraphDraw(GraphDraw gd, float scalex, float scaley) {
660        this.gd = gd;
67         //StringLabeller sl = StringLabeller.getLabeller(g);
680        layout = gd.getVisualizationViewer().getGraphLayout();
690        originalRenderer = gd.getVisualizationViewer().getRenderer();//new SettableRenderer(sl);
700        r = originalRenderer;
710        vv = new BirdsEyeVisualizationViewer(gd.getVisualizationViewer(), scalex, scaley);
720        setLayout(new BorderLayout());
730        add(vv, BorderLayout.CENTER);
740    }
75  
76     /**
77      * Returns the visualizationviewer that actually does the graph drawing.
78      *
79      * @return
80      */
81     public BirdsEyeVisualizationViewer getVisualizationViewer() {
820        return vv;
83     }
84  
85     public void setBackground(Color bg) {
860        super.setBackground(bg);
870        vv.setBackground(bg);
880    }
89  
90     /**
91      * A method to set the renderer. Passes it to the VisualizationViewer
92      *
93      * @param r
94      * the new renderer
95      */
96     public void setRenderer(Renderer r) {
970        this.r = r;
980        vv.setRenderer(r);
990    }
100  
101     /**
102      * resets to the original renderer. Passes is to the VisualizationViewer
103      *
104      */
105     public void resetRenderer() {
1060        this.r = originalRenderer;
1070        vv.setRenderer(r);
1080    }
109  
110     /**
111      * getter for the original renderer
112      * @return the original renderer
113      */
114     public Renderer getRender() {
1150        return originalRenderer;
116     }
117  
118  
119     /**
120      * Dynamically chooses a new GraphLayout.
121      *
122      * @param l
123      * the new graph layout algorithm
124      */
125     public void setGraphLayout(Layout l) {
1260        this.layout = l;
1270        vv.setGraphLayout(l);
1280    }
129  
130     /**
131      * Returns the currently operative layout.
132      */
133     public Layout getGraphLayout() {
1340        return layout;
135     }
136 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.