Source Code Cross Referenced for BaseEvent.java in  » Ajax » MyGWT » net » mygwt » ui » client » event » 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 » Ajax » MyGWT » net.mygwt.ui.client.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * MyGWT Widget Library
003:         * Copyright(c) 2007, MyGWT.
004:         * licensing@mygwt.net
005:         * 
006:         * http://mygwt.net/license
007:         */
008:        package net.mygwt.ui.client.event;
009:
010:        import net.mygwt.ui.client.MyGWT;
011:        import net.mygwt.ui.client.widget.Component;
012:
013:        import com.google.gwt.user.client.DOM;
014:        import com.google.gwt.user.client.Element;
015:        import com.google.gwt.user.client.Event;
016:        import com.google.gwt.user.client.ui.Widget;
017:
018:        /**
019:         * Instances of this class provide a description of a particular MyGWT event.
020:         * 
021:         * <p>
022:         * Note: For a given event, only the fields which are appropriate will be filled
023:         * in. The appropriate fields for each event are documented by the event source.
024:         * </p>
025:         */
026:        public class BaseEvent {
027:
028:            /**
029:             * The event type.
030:             */
031:            public int type;
032:
033:            /**
034:             * The source object.
035:             */
036:            public Object source;
037:
038:            /**
039:             * Depending on the event, a flag indicating whether the operation should be
040:             * allowed.
041:             */
042:            public boolean doit = true;
043:
044:            /**
045:             * The widget that issued the event.
046:             */
047:            public Widget widget;
048:
049:            /**
050:             * The item that the event occurred in.
051:             */
052:            public Widget item;
053:
054:            /**
055:             * List of widgets.
056:             */
057:            public Component[] items;
058:
059:            /**
060:             * The dom event.
061:             */
062:            public Event event;
063:
064:            /**
065:             * The index.
066:             */
067:            public int index;
068:
069:            /**
070:             * The row index.
071:             */
072:            public int rowIndex;
073:
074:            /**
075:             * The width.
076:             */
077:            public int width;
078:
079:            /**
080:             * The height.
081:             */
082:            public int height;
083:
084:            /**
085:             * X coordinate
086:             */
087:            public int x;
088:
089:            /**
090:             * Y coordinate
091:             */
092:            public int y;
093:
094:            /**
095:             * The size.
096:             */
097:            public int size;
098:
099:            /**
100:             * The name.
101:             */
102:            public String name;
103:
104:            /**
105:             * The value.
106:             */
107:            public Object value;
108:
109:            /**
110:             * The old value.
111:             */
112:            public Object oldValue;
113:
114:            /**
115:             * Creates a new base event.
116:             */
117:            public BaseEvent() {
118:
119:            }
120:
121:            /**
122:             * Creates a new base event.
123:             * 
124:             * @param widget the source widget
125:             */
126:            public BaseEvent(Widget widget) {
127:                this .widget = widget;
128:            }
129:
130:            /**
131:             * Creates a new base event.
132:             * 
133:             * @param widget the source widget
134:             * @param item the item widget
135:             */
136:            public BaseEvent(Widget widget, Widget item) {
137:                this .widget = widget;
138:                this .item = item;
139:            }
140:
141:            /**
142:             * Cancels bubbling for the given event. This will stop the event from being
143:             * propagated to parent elements.
144:             */
145:            public void cancelBubble() {
146:                if (event != null) {
147:                    DOM.eventCancelBubble(event, true);
148:                }
149:            }
150:
151:            /**
152:             * Returns the event's x coordinate.
153:             * 
154:             * @return the x coordinate or -1 if no dom event.
155:             */
156:            public int getClientX() {
157:                if (event != null) {
158:                    return DOM.eventGetClientX(event);
159:                }
160:                return -1;
161:            }
162:
163:            /**
164:             * Returns the event's y coordinate.
165:             * 
166:             * @return the y coordinate or -1 if no dom event.
167:             */
168:            public int getClientY() {
169:                if (event != null) {
170:                    return DOM.eventGetClientY(event);
171:                }
172:                return -1;
173:            }
174:
175:            /**
176:             * Returns the dom event type.
177:             * 
178:             * @return the event type
179:             */
180:            public int getEventType() {
181:                return DOM.eventGetType(event);
182:            }
183:
184:            /**
185:             * Returns the key code associated with this event.
186:             * 
187:             * @return the key code
188:             */
189:            public int getKeyCode() {
190:                return DOM.eventGetKeyCode(event);
191:            }
192:
193:            /**
194:             * Returns the event's target element.
195:             * 
196:             * @return the target element or <code>nulol</code> if no dom event.
197:             */
198:            public Element getTarget() {
199:                if (event != null) {
200:                    return DOM.eventGetTarget(event);
201:                }
202:                return null;
203:            }
204:
205:            /**
206:             * Returns <code>true</code> if the control, alt, shift, or meta key is
207:             * pressed.
208:             * 
209:             * @return the modifier state
210:             */
211:            public boolean hasModifier() {
212:                if (event != null) {
213:                    if (DOM.eventGetAltKey(event) || DOM.eventGetCtrlKey(event)
214:                            || DOM.eventGetShiftKey(event)
215:                            || DOM.eventGetMetaKey(event)) {
216:                        return true;
217:                    }
218:                }
219:                return false;
220:            }
221:
222:            /**
223:             * Returns <code>true</code> if the control key (or meta key) is pressed.
224:             * 
225:             * @return the control key state
226:             */
227:            public boolean isControlKey() {
228:                return event == null ? false
229:                        : (DOM.eventGetCtrlKey(event) || DOM
230:                                .eventGetMetaKey(event));
231:            }
232:
233:            /**
234:             * Returns <code>true</code> if the event is a right click.
235:             * 
236:             * @return the right click state
237:             */
238:            public boolean isRightClick() {
239:                if (event != null) {
240:                    if (DOM.eventGetButton(event) == Event.BUTTON_RIGHT
241:                            || (MyGWT.isMac && DOM.eventGetCtrlKey(event))) {
242:                        return true;
243:                    }
244:                }
245:
246:                return false;
247:            }
248:
249:            /**
250:             * Returns <code>true</code> if the shift key is pressed.
251:             * 
252:             * @return the shift key state
253:             */
254:            public boolean isShiftKey() {
255:                return event == null ? false : DOM.eventGetShiftKey(event);
256:            }
257:
258:            /**
259:             * Prevents the browser from taking its default action for the given event.
260:             */
261:            public void preventDefault() {
262:                DOM.eventPreventDefault(event);
263:            }
264:
265:            /**
266:             * Stops the event (preventDefault and cancelBubble).
267:             */
268:            public void stopEvent() {
269:                cancelBubble();
270:                preventDefault();
271:            }
272:
273:            /**
274:             * Returns <code>true</code> if the target of this event equals or is a
275:             * child of the given element.
276:             * 
277:             * @param element the element
278:             * @return the within state
279:             */
280:            public boolean within(Element element) {
281:                if (event != null) {
282:                    return DOM.isOrHasChild(element, getTarget());
283:                }
284:                return false;
285:            }
286:
287:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.