Coverage details for edu.uci.ics.jung.visualization.control.SatelliteScalingGraphMousePlugin

LineHitsSource
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 Aug 15, 2005
9  */
10  
11 package edu.uci.ics.jung.visualization.control;
12  
13 import java.awt.event.MouseWheelEvent;
14 import java.awt.geom.Point2D;
15  
16 import edu.uci.ics.jung.visualization.VisualizationViewer;
17 import edu.uci.ics.jung.visualization.transform.MutableTransformer;
18  
19 /**
20  * Overrides ScalingGraphMousePlugin so that mouse events in the
21  * satellite view will cause scaling in the main view
22  *
23  * @see ScalingGraphMousePlugin
24  * @author Tom Nelson - RABA Technologies
25  *
26  */
27 public class SatelliteScalingGraphMousePlugin extends ScalingGraphMousePlugin {
28  
29     public SatelliteScalingGraphMousePlugin(ScalingControl scaler, int modifiers) {
300        super(scaler, modifiers);
310    }
32  
33     public SatelliteScalingGraphMousePlugin(ScalingControl scaler, int modifiers, float in, float out) {
340        super(scaler, modifiers, in, out);
350    }
36     
37     /**
38      * zoom the master view display in or out, depending on the direction of the
39      * mouse wheel motion.
40      */
41     public void mouseWheelMoved(MouseWheelEvent e) {
420        boolean accepted = checkModifiers(e);
430        if(accepted == true) {
440            VisualizationViewer vv = (VisualizationViewer)e.getSource();
45  
460            if(vv instanceof SatelliteVisualizationViewer) {
470                VisualizationViewer vvMaster =
48                     ((SatelliteVisualizationViewer)vv).getMaster();
49  
500                int amount = e.getWheelRotation();
51                 
520                if(amount > 0) {
530                    scaler.scale(vvMaster, in, vvMaster.getCenter());
54  
550                } else if(amount < 0) {
560                    scaler.scale(vvMaster, out, vvMaster.getCenter());
57                 }
580                e.consume();
590                vv.repaint();
60             }
61         }
620    }
63  
64  
65 }

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.