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

LineHitsSource
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.ItemSelectable;
15 import java.awt.event.InputEvent;
16  
17  
18 /**
19  *
20  * DefaultModalGraphMouse is a PluggableGraphMouse class that
21  * pre-installs a large collection of plugins for picking and
22  * transforming the graph. Additionally, it carries the notion
23  * of a Mode: Picking or Translating. Switching between modes
24  * allows for a more natural choice of mouse modifiers to
25  * be used for the various plugins. The default modifiers are
26  * intended to mimick those of mainstream software applications
27  * in order to be intuitive to users.
28  *
29  * To change between modes, two different controls are offered,
30  * a combo box and a menu system. These controls are lazily created
31  * in their respective 'getter' methods so they don't impact
32  * code that does not intend to use them.
33  * The menu control can be placed in an unused corner of the
34  * GraphZoomScrollPane, which is a common location for mouse
35  * mode selection menus in mainstream applications.
36  *
37  * @author Tom Nelson
38  */
39 public class DefaultModalGraphMouse extends AbstractModalGraphMouse
40     implements ModalGraphMouse, ItemSelectable {
41     
42     /**
43      * create an instance with default values
44      *
45      */
46     public DefaultModalGraphMouse() {
470        this(1.1f, 1/1.1f);
480    }
49     
50     /**
51      * create an instance with passed values
52      * @param in override value for scale in
53      * @param out override value for scale out
54      */
550    public DefaultModalGraphMouse(float in, float out) {
560        this.in = in;
570        this.out = out;
580        loadPlugins();
590    }
60     
61     /**
62      * create the plugins, and load the plugins for TRANSFORMING mode
63      *
64      */
65     protected void loadPlugins() {
660        pickingPlugin = new PickingGraphMousePlugin();
670        animatedPickingPlugin = new AnimatedPickingGraphMousePlugin();
680        translatingPlugin = new TranslatingGraphMousePlugin(InputEvent.BUTTON1_MASK);
690        scalingPlugin = new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, in, out);
700        rotatingPlugin = new RotatingGraphMousePlugin();
710        shearingPlugin = new ShearingGraphMousePlugin();
72  
730        add(scalingPlugin);
740        setMode(Mode.TRANSFORMING);
750    }
76 }

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.