Subversion Repository Public Repository

litesoft

Diff Revisions 282 vs 475 for /trunk/Java/GWT/Client/src/com/google/gwt/gen2/event/dom/client/KeyEvent.java

Diff revisions: vs.
  @@ -15,91 +15,94 @@
15 15 */
16 16 package com.google.gwt.gen2.event.dom.client;
17 17
18 - import com.google.gwt.user.client.DOM;
19 - import com.google.gwt.user.client.Event;
18 + import com.google.gwt.user.client.*;
20 19
21 20 /**
22 21 * Base class for Key events. The native keyboard events are somewhat a mess
23 22 * (http://www.quirksmode.org/js/keys.html), we do some trivial normalization
24 23 * here, but do not attempt any complex patching, so user be warned.
25 - *
24 + *
26 25 * @deprecated use the com.google.gwt.event.dom.client classes instead
27 26 */
28 27 @Deprecated
29 - public abstract class KeyEvent extends DomEvent {
28 + public abstract class KeyEvent extends DomEvent
29 + {
30 30
31 - /**
32 - * Alt modifier.
33 - */
34 - public static final int MODIFIER_ALT = 4;
35 - /**
36 - * Control modifier.
37 - */
38 - public static final int MODIFIER_CTRL = 2;
39 - /**
40 - * Meta modifier.
41 - */
42 - public static final int MODIFIER_META = 8;
43 - /**
44 - * Shift modifier.
45 - */
46 - public static final int MODIFIER_SHIFT = 1;
47 -
48 - /**
49 - * Constructor.
50 - *
51 - * @param nativeEvent the wrapped native event
52 - */
53 - protected KeyEvent(Event nativeEvent) {
54 - super(nativeEvent);
55 - }
56 -
57 - /**
58 - * Gets the key modifiers associated with this event.
59 - *
60 - * @return the modifiers as defined in {@link KeyCodeEvent}.
61 - */
62 - public int getKeyModifiers() {
63 - Event event = getNativeEvent();
64 - return (DOM.eventGetShiftKey(event) ? MODIFIER_SHIFT : 0)
65 - | (DOM.eventGetMetaKey(event) ? MODIFIER_META : 0)
66 - | (DOM.eventGetCtrlKey(event) ? MODIFIER_CTRL : 0)
67 - | (DOM.eventGetAltKey(event) ? MODIFIER_ALT : 0);
68 - }
69 -
70 - /**
71 - * Is the <code>alt</code> key down?
72 - *
73 - * @return whether the alt key is down
74 - */
75 - public boolean isAltKeyDown() {
76 - return getNativeEvent().getAltKey();
77 - }
78 -
79 - /**
80 - * Gets the key-repeat state of this event.
81 - *
82 - * @return <code>true</code> if this key event was an auto-repeat
83 - */
84 - public boolean isAutoRepeat() {
85 - return getNativeEvent().getRepeat();
86 - }
87 -
88 - /**
89 - * Is the <code>control</code> key down?
90 - *
91 - * @return whether the control key is down
92 - */
93 - public boolean isControlKeyDown() {
94 - return getNativeEvent().getCtrlKey();
95 - }
96 -
97 - /**
98 - * Is the <code>shift</code> key down?
99 - *
100 - * @return whether the shift key is down
101 - */
102 - public boolean isShiftKeyDown() {
103 - return getNativeEvent().getShiftKey();
104 - }
31 + /**
32 + * Alt modifier.
33 + */
34 + public static final int MODIFIER_ALT = 4;
35 + /**
36 + * Control modifier.
37 + */
38 + public static final int MODIFIER_CTRL = 2;
39 + /**
40 + * Meta modifier.
41 + */
42 + public static final int MODIFIER_META = 8;
43 + /**
44 + * Shift modifier.
45 + */
46 + public static final int MODIFIER_SHIFT = 1;
47 +
48 + /**
49 + * Constructor.
50 + *
51 + * @param nativeEvent the wrapped native event
52 + */
53 + protected KeyEvent( Event nativeEvent )
54 + {
55 + super( nativeEvent );
56 + }
57 +
58 + /**
59 + * Gets the key modifiers associated with this event.
60 + *
61 + * @return the modifiers as defined in {@link KeyCodeEvent}.
62 + */
63 + public int getKeyModifiers()
64 + {
65 + Event event = getNativeEvent();
66 + return (DOM.eventGetShiftKey( event ) ? MODIFIER_SHIFT : 0) | (DOM.eventGetMetaKey( event ) ? MODIFIER_META : 0) | (DOM.eventGetCtrlKey( event ) ? MODIFIER_CTRL : 0) | (DOM.eventGetAltKey( event ) ? MODIFIER_ALT : 0);
67 + }
68 +
69 + /**
70 + * Is the <code>alt</code> key down?
71 + *
72 + * @return whether the alt key is down
73 + */
74 + public boolean isAltKeyDown()
75 + {
76 + return getNativeEvent().getAltKey();
77 + }
78 +
79 + /**
80 + * Gets the key-repeat state of this event.
81 + *
82 + * @return <code>true</code> if this key event was an auto-repeat
83 + */
84 + public boolean isAutoRepeat()
85 + {
86 + return getNativeEvent().getRepeat();
87 + }
88 +
89 + /**
90 + * Is the <code>control</code> key down?
91 + *
92 + * @return whether the control key is down
93 + */
94 + public boolean isControlKeyDown()
95 + {
96 + return getNativeEvent().getCtrlKey();
97 + }
98 +
99 + /**
100 + * Is the <code>shift</code> key down?
101 + *
102 + * @return whether the shift key is down
103 + */
104 + public boolean isShiftKeyDown()
105 + {
106 + return getNativeEvent().getShiftKey();
107 + }
105 108 }