# Coverage details for edu.uci.ics.jung.visualization.control.SatelliteAnimatedPickingGraphMousePlugin

Line | Hits | Source
--- | --- | ---
1 |  | `/*`
2 |  | `* Copyright (c) 2005, the JUNG Project and the Regents of the University`
3 |  | `* of California`
4 |  | `* All rights reserved.`
5 |  | `*`
6 |  | `* This software is open-source under the BSD license; see either`
7 |  | `* "license.txt" or`
8 |  | `* http://jung.sourceforge.net/license.txt for a description.`
9 |  | `* Created on Mar 8, 2005`
10 |  | `*`
11 |  | `*/`
12 |  | `package edu.uci.ics.jung.visualization.control;`
13 |  | ``
14 |  | `import java.awt.event.InputEvent;`
15 |  | `import java.awt.event.MouseEvent;`
16 |  | `import java.awt.event.MouseListener;`
17 |  | `import java.awt.event.MouseMotionListener;`
18 |  | `import java.awt.geom.Point2D;`
19 |  | ``
20 |  | `import edu.uci.ics.jung.visualization.Layout;`
21 |  | `import edu.uci.ics.jung.visualization.VisualizationViewer;`
22 |  | ``
23 |  | `/**`
24 |  | `* A version of the AnimatedPickingGraphMousePlugin that is for`
25 |  | `* the SatelliteVisualizationViewer. The difference it that when`
26 |  | `* you pick a Vertex in the Satellite View, the 'master view' is`
27 |  | `* translated to move that Vertex to the center.`
28 |  | `* @see AnimatedPickingGraphMousePlugin`
29 |  | `* @author Tom Nelson`
30 |  | `*/`
31 |  | `public class SatelliteAnimatedPickingGraphMousePlugin extends AnimatedPickingGraphMousePlugin`
32 |  | `implements MouseListener, MouseMotionListener {`
33 |  | ``
34 |  | `/**`
35 |  | `* create an instance`
36 |  | `*`
37 |  | `*/`
38 |  | `public SatelliteAnimatedPickingGraphMousePlugin() {`
39 | 0 | `this(InputEvent.BUTTON1_MASK | InputEvent.CTRL_MASK);`
40 | 0 | `}`
41 |  | ``
42 |  | `public SatelliteAnimatedPickingGraphMousePlugin(int selectionModifiers) {`
43 | 0 | `super(selectionModifiers);`
44 | 0 | `}`
45 |  | ``
46 |  | `/**`
47 |  | `* override subclass method to translate the master view instead`
48 |  | `* of this satellite view`
49 |  | `*`
50 |  | `*/`
51 |  | `public void mouseReleased(MouseEvent e) {`
52 | 0 | `if (e.getModifiers() == modifiers) {`
53 | 0 | `final VisualizationViewer vv = (VisualizationViewer) e.getSource();`
54 | 0 | `if (vv instanceof SatelliteVisualizationViewer) {`
55 | 0 | `final VisualizationViewer vvMaster =`
56 |  | `((SatelliteVisualizationViewer) vv).getMaster();`
57 |  | ``
58 | 0 | `if (vertex != null) {`
59 | 0 | `Layout layout = vvMaster.getGraphLayout();`
60 | 0 | `Point2D q = layout.getLocation(vertex);`
61 | 0 | `Point2D lvc =`
62 |  | `vvMaster.inverseLayoutTransform(vvMaster.getCenter());`
63 | 0 | `final double dx = (lvc.getX() - q.getX()) / 10;`
64 | 0 | `final double dy = (lvc.getY() - q.getY()) / 10;`
65 |  | ``
66 | 0 | `Runnable animator = new Runnable() {`
67 |  | ``
68 |  | `public void run() {`
69 |  | `for (int i = 0; i < 10; i++) {`
70 |  | `vvMaster.getLayoutTransformer().translate(dx,`
71 |  | `dy);`
72 |  | `try {`
73 |  | `Thread.sleep(100);`
74 |  | `} catch (InterruptedException ex) {`
75 |  | `}`
76 |  | `}`
77 |  | `}`
78 |  | `};`
79 | 0 | `Thread thread = new Thread(animator);`
80 | 0 | `thread.start();`
81 |  | `}`
82 |  | `}`
83 |  | `}`
84 | 0 | `}`
85 |  | `}`

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.