Subversion Repository Public Repository

litesoft

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

Diff revisions: vs.
  @@ -15,137 +15,153 @@
15 15 */
16 16 package com.google.gwt.gen2.event.dom.client;
17 17
18 - import com.google.gwt.gen2.event.shared.EventHandler;
19 - import com.google.gwt.user.client.Event;
18 + import com.google.gwt.gen2.event.shared.*;
19 + import com.google.gwt.user.client.*;
20 20
21 21 /**
22 22 * Abstract class representing mouse events.
23 - *
23 + *
24 24 * @param <T> event handler type
25 + *
25 26 * @deprecated use the com.google.gwt.event.dom.client classes instead
26 27 */
27 28 @Deprecated
28 - public abstract class MouseEvent<T extends EventHandler> extends DomEvent {
29 + public abstract class MouseEvent<T extends EventHandler> extends DomEvent
30 + {
29 31
30 - /**
31 - * The native Dom button codes.
32 - */
33 - public enum Button {
34 - /**
35 - * Left button.
36 - */
37 - LEFT,
38 - /**
39 - * Middle button.
40 - */
41 - MIDDLE,
42 - /**
43 - * Right button.
44 - */
45 - RIGHT;
46 -
47 - /**
48 - * Gets the button codes.
49 - *
50 - * @param buttonCode the button code
51 - * @return which button
52 - */
53 - public static Button valueOf(int buttonCode) {
54 - switch (buttonCode) {
55 - case Event.BUTTON_LEFT:
56 - return LEFT;
57 - case Event.BUTTON_RIGHT:
58 - return RIGHT;
59 - case Event.BUTTON_MIDDLE:
60 - return MIDDLE;
61 - default:
62 - throw new IllegalStateException("Unknown button code " + buttonCode);
63 - }
64 - }
65 - }
66 -
67 - MouseEvent(Event e) {
68 - super(e);
69 - }
70 -
71 - /**
72 - * Gets the button value.
73 - *
74 - * @return gets the button value.
75 - */
76 - public Button getButton() {
77 - return Button.valueOf(getNativeEvent().getButton());
78 - }
79 -
80 - /**
81 - * Gets the mouse x-position within the browser window's client area.
82 - *
83 - * @return the mouse x-position
84 - */
85 - public int getClientX() {
86 - return getNativeEvent().getClientX();
87 - }
88 -
89 - /**
90 - * Gets the mouse y-position within the browser window's client area.
91 - *
92 - * @return the mouse y-position
93 - */
94 - public int getClientY() {
95 - return getNativeEvent().getClientY();
96 - }
97 -
98 - /**
99 - * Gets the mouse x-position on the user's display.
100 - *
101 - * @return the mouse x-position
102 - */
103 - public int getScreenX() {
104 - return getNativeEvent().getScreenX();
105 - }
106 -
107 - /**
108 - * Gets the mouse y-position on the user's display.
109 - *
110 - * @return the mouse y-position
111 - */
112 - public int getScreenY() {
113 - return getNativeEvent().getScreenY();
114 - }
115 -
116 - /**
117 - * Is <code>alt</code> key down.
118 - *
119 - * @return whether the alt key is down
120 - */
121 - public boolean isAltKeyDown() {
122 - return getNativeEvent().getAltKey();
123 - }
124 -
125 - /**
126 - * Is <code>control</code> key down.
127 - *
128 - * @return whether the control key is down
129 - */
130 - public boolean isControlKeyDown() {
131 - return getNativeEvent().getCtrlKey();
132 - }
133 -
134 - /**
135 - * Is <code>meta</code> key down.
136 - *
137 - * @return whether the meta key is down
138 - */
139 - public boolean isMetaKeyDown() {
140 - return getNativeEvent().getMetaKey();
141 - }
142 -
143 - /**
144 - * Is <code>shift</code> key down.
145 - *
146 - * @return whether the shift key is down
147 - */
148 - public boolean isShiftKeyDown() {
149 - return getNativeEvent().getShiftKey();
150 - }
32 + /**
33 + * The native Dom button codes.
34 + */
35 + public enum Button
36 + {
37 + /**
38 + * Left button.
39 + */
40 + LEFT,
41 + /**
42 + * Middle button.
43 + */
44 + MIDDLE,
45 + /**
46 + * Right button.
47 + */
48 + RIGHT;
49 +
50 + /**
51 + * Gets the button codes.
52 + *
53 + * @param buttonCode the button code
54 + *
55 + * @return which button
56 + */
57 + public static Button valueOf( int buttonCode )
58 + {
59 + switch ( buttonCode )
60 + {
61 + case Event.BUTTON_LEFT:
62 + return LEFT;
63 + case Event.BUTTON_RIGHT:
64 + return RIGHT;
65 + case Event.BUTTON_MIDDLE:
66 + return MIDDLE;
67 + default:
68 + throw new IllegalStateException( "Unknown button code " + buttonCode );
69 + }
70 + }
71 + }
72 +
73 + MouseEvent( Event e )
74 + {
75 + super( e );
76 + }
77 +
78 + /**
79 + * Gets the button value.
80 + *
81 + * @return gets the button value.
82 + */
83 + public Button getButton()
84 + {
85 + return Button.valueOf( getNativeEvent().getButton() );
86 + }
87 +
88 + /**
89 + * Gets the mouse x-position within the browser window's client area.
90 + *
91 + * @return the mouse x-position
92 + */
93 + public int getClientX()
94 + {
95 + return getNativeEvent().getClientX();
96 + }
97 +
98 + /**
99 + * Gets the mouse y-position within the browser window's client area.
100 + *
101 + * @return the mouse y-position
102 + */
103 + public int getClientY()
104 + {
105 + return getNativeEvent().getClientY();
106 + }
107 +
108 + /**
109 + * Gets the mouse x-position on the user's display.
110 + *
111 + * @return the mouse x-position
112 + */
113 + public int getScreenX()
114 + {
115 + return getNativeEvent().getScreenX();
116 + }
117 +
118 + /**
119 + * Gets the mouse y-position on the user's display.
120 + *
121 + * @return the mouse y-position
122 + */
123 + public int getScreenY()
124 + {
125 + return getNativeEvent().getScreenY();
126 + }
127 +
128 + /**
129 + * Is <code>alt</code> key down.
130 + *
131 + * @return whether the alt key is down
132 + */
133 + public boolean isAltKeyDown()
134 + {
135 + return getNativeEvent().getAltKey();
136 + }
137 +
138 + /**
139 + * Is <code>control</code> key down.
140 + *
141 + * @return whether the control key is down
142 + */
143 + public boolean isControlKeyDown()
144 + {
145 + return getNativeEvent().getCtrlKey();
146 + }
147 +
148 + /**
149 + * Is <code>meta</code> key down.
150 + *
151 + * @return whether the meta key is down
152 + */
153 + public boolean isMetaKeyDown()
154 + {
155 + return getNativeEvent().getMetaKey();
156 + }
157 +
158 + /**
159 + * Is <code>shift</code> key down.
160 + *
161 + * @return whether the shift key is down
162 + */
163 + public boolean isShiftKeyDown()
164 + {
165 + return getNativeEvent().getShiftKey();
166 + }
151 167 }