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 6, 2005 | |
9 | */ | |
10 | ||
11 | package edu.uci.ics.jung.visualization.control; | |
12 | ||
13 | import java.awt.Cursor; | |
14 | import java.awt.Point; | |
15 | import java.awt.event.MouseEvent; | |
16 | ||
17 | /** | |
18 | * a base class for GraphMousePlugin instances. Holds some members | |
19 | * common to all GraphMousePlugins | |
20 | * @author thomasnelson | |
21 | * | |
22 | */ | |
23 | public abstract class AbstractGraphMousePlugin implements GraphMousePlugin { | |
24 | ||
25 | /** | |
26 | * modifiers to compare against mouse event modifiers | |
27 | */ | |
28 | protected int modifiers; | |
29 | ||
30 | /** | |
31 | * the location in the View where the mouse was pressed | |
32 | */ | |
33 | protected Point down; | |
34 | ||
35 | /** | |
36 | * the special cursor that plugins may display | |
37 | */ | |
38 | protected Cursor cursor; | |
39 | ||
40 | /** | |
41 | * create an instance with passed values | |
42 | * @param modifiers | |
43 | */ | |
44 | 0 | public AbstractGraphMousePlugin(int modifiers) { |
45 | 0 | this.modifiers = modifiers; |
46 | 0 | } |
47 | ||
48 | /** | |
49 | * getter for mouse modifiers | |
50 | */ | |
51 | public int getModifiers() { | |
52 | 0 | return modifiers; |
53 | } | |
54 | ||
55 | /** | |
56 | * setter for mouse modifiers | |
57 | */ | |
58 | public void setModifiers(int modifiers) { | |
59 | 0 | this.modifiers = modifiers; |
60 | 0 | } |
61 | ||
62 | /** | |
63 | * check the mouse event modifiers against the | |
64 | * instance member modifiers. Default implementation | |
65 | * checks equality. Can be overridden to test with a mask | |
66 | */ | |
67 | public boolean checkModifiers(MouseEvent e) { | |
68 | 0 | return e.getModifiers() == modifiers; |
69 | } | |
70 | ||
71 | /** | |
72 | * @return Returns the cursor. | |
73 | */ | |
74 | public Cursor getCursor() { | |
75 | 0 | return cursor; |
76 | } | |
77 | ||
78 | /** | |
79 | * @param cursor The cursor to set. | |
80 | */ | |
81 | public void setCursor(Cursor cursor) { | |
82 | 0 | this.cursor = cursor; |
83 | 0 | } |
84 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |