# Coverage details for edu.uci.ics.jung.visualization.transform.LayoutLensSupport

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | `* Copyright (c) 2005, 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 |  | `* Created on Jul 21, 2005`
9 |  | `*/`
10 |  | ``
11 |  | `package edu.uci.ics.jung.visualization.transform;`
12 |  | ``
13 |  | `import java.awt.Dimension;`
14 |  | ``
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 |  | `/**`
19 |  | `* A class to make it easy to add an`
20 |  | `* examining lens to a jung graph application. See HyperbolicTransformerDemo`
21 |  | `* for an example of how to use it.`
22 |  | `*`
23 |  | `* @author Tom Nelson - RABA Technologies`
24 |  | `*`
25 |  | `*`
26 |  | `*/`
27 |  | `public class LayoutLensSupport extends AbstractLensSupport`
28 |  | `implements LensSupport {`
29 |  | ``
30 |  | `public LayoutLensSupport(VisualizationViewer vv) {`
31 | 0 | `this(vv, new HyperbolicTransformer(vv, vv.getLayoutTransformer()),`
32 |  | `new ModalLensGraphMouse());`
33 | 0 | `}`
34 |  | `/**`
35 |  | `* create the base class, setting common members and creating`
36 |  | `* a custom GraphMouse`
37 |  | `* @param vv the VisualizationViewer to work on`
38 |  | `*/`
39 |  | `public LayoutLensSupport(VisualizationViewer vv, LensTransformer lensTransformer,`
40 |  | `ModalGraphMouse lensGraphMouse) {`
41 | 0 | `super(vv, lensGraphMouse);`
42 | 0 | `this.lensTransformer = lensTransformer;`
43 |  | ``
44 | 0 | `Dimension d = vv.getSize();`
45 | 0 | `if(d.width <= 0 || d.height <= 0) {`
46 | 0 | `d = vv.getPreferredSize();`
47 |  | `}`
48 | 0 | `lensTransformer.setViewRadius(d.width/5);`
49 | 0 | `}`
50 |  | ``
51 |  | `public void activate() {`
52 | 0 | `if(lens == null) {`
53 | 0 | `lens = new Lens(lensTransformer);`
54 |  | `}`
55 | 0 | `if(lensControls == null) {`
56 | 0 | `lensControls = new LensControls(lensTransformer);`
57 |  | `}`
58 | 0 | `vv.setLayoutTransformer(lensTransformer);`
59 | 0 | `vv.setViewTransformer(new MutableAffineTransformer());`
60 | 0 | `vv.addPreRenderPaintable(lens);`
61 | 0 | `vv.addPostRenderPaintable(lensControls);`
62 | 0 | `vv.setGraphMouse(lensGraphMouse);`
63 | 0 | `vv.setToolTipText(instructions);`
64 | 0 | `vv.repaint();`
65 | 0 | `}`
66 |  | ``
67 |  | `public void deactivate() {`
68 | 0 | `if(savedViewTransformer != null) {`
69 | 0 | `vv.setViewTransformer(savedViewTransformer);`
70 |  | `}`
71 | 0 | `if(lensTransformer != null) {`
72 | 0 | `vv.removePreRenderPaintable(lens);`
73 | 0 | `vv.removePostRenderPaintable(lensControls);`
74 | 0 | `vv.setLayoutTransformer(lensTransformer.getDelegate());`
75 |  | `}`
76 | 0 | `vv.setToolTipText(defaultToolTipText);`
77 | 0 | `vv.setGraphMouse(graphMouse);`
78 | 0 | `vv.repaint();`
79 | 0 | `}`
80 |  | `}`

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.