# Coverage details for edu.uci.ics.jung.visualization.transform.shape.ViewLensSupport

Line | Hits | Source
--- | --- | ---
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 |  | `*/`
9 |  | `package edu.uci.ics.jung.visualization.transform.shape;`
10 |  | ``
11 |  | `import java.awt.Dimension;`
12 |  | ``
13 |  | `import edu.uci.ics.jung.visualization.PluggableRenderer;`
14 |  | `import edu.uci.ics.jung.visualization.Renderer;`
15 |  | `import edu.uci.ics.jung.visualization.VisualizationViewer;`
16 |  | `import edu.uci.ics.jung.visualization.control.ModalGraphMouse;`
17 |  | `import edu.uci.ics.jung.visualization.control.ModalLensGraphMouse;`
18 |  | `import edu.uci.ics.jung.visualization.transform.AbstractLensSupport;`
19 |  | `import edu.uci.ics.jung.visualization.transform.LensSupport;`
20 |  | `import edu.uci.ics.jung.visualization.transform.LensTransformer;`
21 |  | ``
22 |  | `/**`
23 |  | `* Uses a LensTransformer to use in the view`
24 |  | `* transform. This one will distort Vertex shapes.`
25 |  | `*`
26 |  | `* @author Tom Nelson - RABA Technologies`
27 |  | `*`
28 |  | `*`
29 |  | `*/`
30 |  | `public class ViewLensSupport extends AbstractLensSupport`
31 |  | `implements LensSupport {`
32 |  | ``
33 |  | `protected PluggableRenderer pluggableRenderer;`
34 |  | `protected TransformingPluggableRenderer transformingPluggableRenderer;`
35 |  | `protected Renderer renderer;`
36 |  | ``
37 |  | `public ViewLensSupport(VisualizationViewer vv) {`
38 | 0 | `this(vv, new HyperbolicShapeTransformer(vv),`
39 |  | `new ModalLensGraphMouse());`
40 | 0 | `}`
41 |  | `public ViewLensSupport(VisualizationViewer vv, LensTransformer lensTransformer,`
42 |  | `ModalGraphMouse lensGraphMouse) {`
43 | 0 | `super(vv, lensGraphMouse);`
44 | 0 | `this.renderer = vv.getRenderer();`
45 | 0 | `this.lensTransformer = lensTransformer;`
46 | 0 | `Dimension d = vv.getSize();`
47 | 0 | `if(d.width == 0 || d.height == 0) {`
48 | 0 | `d = vv.getPreferredSize();`
49 |  | `}`
50 | 0 | `lensTransformer.setViewRadius(d.width/5);`
51 |  | ``
52 | 0 | `if(renderer instanceof PluggableRenderer) {`
53 | 0 | `this.pluggableRenderer = (PluggableRenderer)renderer;`
54 |  | `} else {`
55 | 0 | `this.pluggableRenderer = new PluggableRenderer();`
56 |  | `}`
57 | 0 | `}`
58 |  | `public void activate() {`
59 | 0 | `if(lens == null) {`
60 | 0 | `lens = new Lens(lensTransformer);`
61 |  | `}`
62 | 0 | `if(lensControls == null) {`
63 | 0 | `lensControls = new LensControls(lensTransformer);`
64 |  | `}`
65 | 0 | `vv.setViewTransformer(lensTransformer);`
66 | 0 | `if(transformingPluggableRenderer == null) {`
67 | 0 | `transformingPluggableRenderer =`
68 |  | `new TransformingPluggableRenderer(pluggableRenderer);`
69 |  | `}`
70 | 0 | `transformingPluggableRenderer.setTransformer(lensTransformer);`
71 | 0 | `vv.setRenderer(transformingPluggableRenderer);`
72 | 0 | `vv.addPreRenderPaintable(lens);`
73 | 0 | `vv.addPostRenderPaintable(lensControls);`
74 | 0 | `vv.setGraphMouse(lensGraphMouse);`
75 | 0 | `vv.setToolTipText(instructions);`
76 | 0 | `vv.repaint();`
77 | 0 | `}`
78 |  | ``
79 |  | `public void deactivate() {`
80 | 0 | `vv.setViewTransformer(savedViewTransformer);`
81 | 0 | `vv.removePreRenderPaintable(lens);`
82 | 0 | `vv.removePostRenderPaintable(lensControls);`
83 | 0 | `vv.setRenderer(renderer);`
84 | 0 | `vv.setToolTipText(defaultToolTipText);`
85 | 0 | `vv.setGraphMouse(graphMouse);`
86 | 0 | `vv.repaint();`
87 | 0 | `}`
88 |  | `}`

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.