Source Code Cross Referenced for MapMouseEvent.java in  » GIS » udig-1.1 » net » refractions » udig » project » ui » render » displayAdapter » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » udig 1.1 » net.refractions.udig.project.ui.render.displayAdapter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
003:         * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
004:         * under the terms of the GNU Lesser General Public License as published by the Free Software
005:         * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
006:         * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
007:         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
008:         */
009:        package net.refractions.udig.project.ui.render.displayAdapter;
010:
011:        import java.awt.Point;
012:
013:        import org.eclipse.swt.SWT;
014:
015:        import net.refractions.udig.project.render.displayAdapter.IMapDisplay;
016:
017:        /**
018:         * Encapsulates a mouse event. MapMouseListeners receive MapMouse events.
019:         * 
020:         * @author jeichar
021:         */
022:        public class MapMouseEvent {
023:
024:            /** Indicates no modifiers or no buttons. */
025:            public static final int NONE = 0;
026:            /** Indicates that the alt key is down */
027:            public static final int ALT_DOWN_MASK = SWT.ALT;
028:
029:            /** Indicates that the ctrl key is down */
030:            public static final int CTRL_DOWN_MASK = SWT.CTRL;
031:
032:            /** Indicates that the shift key is down */
033:            public static final int SHIFT_DOWN_MASK = SWT.SHIFT;
034:
035:            /** Indicates that the mod1 key is down */
036:            public static final int MOD1_DOWN_MASK = SWT.MOD1;
037:
038:            /** Indicates that the mod2 key is down */
039:            public static final int MOD2_DOWN_MASK = SWT.MOD2;
040:
041:            /** Indicates that the mod3 key is down */
042:            public static final int MOD3_DOWN_MASK = SWT.MOD3;
043:
044:            /** Indicates that the mod3 key is down */
045:            public static final int MOD4_DOWN_MASK = SWT.MOD4;
046:
047:            /** Indicates that the 1st mouse button, the left button on right handed mouses */
048:            public static final int BUTTON1 = 1 << 3;
049:
050:            /** Indicates that the 2nd mouse button. */
051:            public static final int BUTTON2 = 1 << 4;
052:
053:            /** Indicates that the 3rd mouse button. */
054:            public static final int BUTTON3 = 1 << 5;
055:
056:            /** The Viewport pane that raised the event. */
057:            public final IMapDisplay source;
058:
059:            /** 
060:             * The state consists buttons|modifiers
061:             * @deprecated user modifiers and buttons
062:             */
063:            public final int state;
064:
065:            /**
066:             * All the buttons that are currently down ORed together
067:             */
068:            public final int buttons;
069:
070:            /**
071:             * All the key modifiers ORed together
072:             */
073:            public final int modifiers;
074:
075:            /** indicates the button that last changed */
076:            public final int button;
077:
078:            /** indicates the x position of the event */
079:            public final int x;
080:
081:            /** indicates the y position of the event */
082:            public final int y;
083:
084:            /** the time the event occurred */
085:            public final long timestamp;
086:
087:            /**
088:             * Construct <code>MapMouseEvent</code>.
089:             * 
090:             * @param source The object that raised the event
091:             * @param x the x position of the event
092:             * @param y the y position of the event
093:             * @param modifiers indicates what modifiers are down.  Modifiers are ORed together
094:             * @param buttons indicates the buttons that are down.  button ids are ORed together.
095:             * @param button the button that last changed
096:             */
097:            public MapMouseEvent(IMapDisplay source, int x, int y,
098:                    int modifiers, int buttons, int button) {
099:                this .source = source;
100:                this .state = modifiers | buttons;
101:                this .x = x;
102:                this .y = y;
103:                this .button = button;
104:                this .buttons = buttons;
105:                this .modifiers = modifiers;
106:                timestamp = System.currentTimeMillis();
107:            }
108:
109:            /**
110:             * Returns the location of the event.
111:             * 
112:             * @return the location of the event.
113:             * @see Point
114:             */
115:            public Point getPoint() {
116:                return new Point(x, y);
117:            }
118:
119:            /**
120:             * Returns true if shift key is down.
121:             * 
122:             * @return true if shift key is down.
123:             */
124:            public boolean isShiftDown() {
125:                return isModifierDown(SHIFT_DOWN_MASK);
126:            }
127:
128:            /**
129:             * Returns true if control key is down.
130:             * 
131:             * @return true if control key is down.
132:             */
133:            public boolean isControlDown() {
134:                return isModifierDown(CTRL_DOWN_MASK);
135:            }
136:
137:            /**
138:             * Returns true if alt key is down.
139:             * 
140:             * @return true if alt key is down.
141:             */
142:            public boolean isAltDown() {
143:                return isModifierDown(ALT_DOWN_MASK);
144:            }
145:
146:            /**
147:             * Returns true if the modifier is down 
148:             * 
149:             * @see #CTRL_DOWN_MASK
150:             * @see #ALT_DOWN_MASK
151:             * @see #SHIFT_DOWN_MASK
152:             * @see #MOD1_DOWN_MASK
153:             * @see #MOD2_DOWN_MASK
154:             * @see #MOD3_DOWN_MASK
155:             * @see #MOD4_DOWN_MASK
156:             *
157:             * @param mask the modifier to test for.
158:             * @return true if modifier is down.
159:             */
160:            public boolean isModifierDown(int mask) {
161:                return (modifiers & mask) != 0;
162:            }
163:
164:            /**
165:             * @return Returns true if a keyboard modifier is down.
166:             */
167:            public boolean modifiersDown() {
168:                return isModifierDown(MOD1_DOWN_MASK)
169:                        || isModifierDown(MOD2_DOWN_MASK)
170:                        || isModifierDown(MOD3_DOWN_MASK)
171:                        || isModifierDown(MOD4_DOWN_MASK)
172:                        || isModifierDown(ALT_DOWN_MASK)
173:                        || isModifierDown(CTRL_DOWN_MASK)
174:                        || isModifierDown(SHIFT_DOWN_MASK);
175:            }
176:
177:            /**
178:             * @return Returns true if a button is down.
179:             */
180:            public boolean buttonsDown() {
181:                return buttons != 0;
182:            }
183:
184:        }
w___w_w.j__a__v_a___2__s___.___c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.