|
@@ -1,70 +1,70 @@ |
1 |
|
- |
/* |
2 |
|
- |
* Copyright 2008 Google Inc. |
3 |
|
- |
* |
4 |
|
- |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
5 |
|
- |
* use this file except in compliance with the License. You may obtain a copy of |
6 |
|
- |
* the License at |
7 |
|
- |
* |
8 |
|
- |
* http://www.apache.org/licenses/LICENSE-2.0 |
9 |
|
- |
* |
10 |
|
- |
* Unless required by applicable law or agreed to in writing, software |
11 |
|
- |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
12 |
|
- |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
13 |
|
- |
* License for the specific language governing permissions and limitations under |
14 |
|
- |
* the License. |
15 |
|
- |
*/ |
16 |
|
- |
package com.google.gwt.gen2.event.dom.client; |
17 |
|
- |
|
18 |
|
- |
import com.google.gwt.user.client.*; |
19 |
|
- |
|
20 |
|
- |
/** |
21 |
|
- |
* Represents a native key press event. |
22 |
|
- |
* |
23 |
|
- |
* @deprecated use the com.google.gwt.event.dom.client classes instead |
24 |
|
- |
*/ |
25 |
|
- |
@Deprecated |
26 |
|
- |
public class KeyPressEvent extends KeyEvent { |
27 |
|
- |
|
28 |
|
- |
/** |
29 |
|
- |
* Event type for key press events. Represents the meta-data associated with |
30 |
|
- |
* this event. |
31 |
|
- |
*/ |
32 |
|
- |
public static final Type<KeyPressEvent, KeyPressHandler> TYPE = new Type<KeyPressEvent, KeyPressHandler>( Event.ONKEYPRESS ) { |
33 |
|
- |
@Override |
34 |
|
- |
public void fire( KeyPressHandler handler, KeyPressEvent event ) { |
35 |
|
- |
handler.onKeyPress( event ); |
36 |
|
- |
} |
37 |
|
- |
|
38 |
|
- |
@Override |
39 |
|
- |
KeyPressEvent wrap( Event nativeEvent ) { |
40 |
|
- |
return new KeyPressEvent( nativeEvent ); |
41 |
|
- |
} |
42 |
|
- |
}; |
43 |
|
- |
|
44 |
|
- |
/** |
45 |
|
- |
* Constructor. |
46 |
|
- |
* |
47 |
|
- |
* @param nativeEvent the native event object |
48 |
|
- |
*/ |
49 |
|
- |
public KeyPressEvent( Event nativeEvent ) { |
50 |
|
- |
super( nativeEvent ); |
51 |
|
- |
} |
52 |
|
- |
|
53 |
|
- |
/** |
54 |
|
- |
* Gets the char code for this event. |
55 |
|
- |
* |
56 |
|
- |
* @return the char code |
57 |
|
- |
*/ |
58 |
|
- |
public char getCharCode() { |
59 |
|
- |
return getCharCode( getNativeEvent() ); |
60 |
|
- |
} |
61 |
|
- |
|
62 |
|
- |
@Override |
63 |
|
- |
protected Type getType() { |
64 |
|
- |
return TYPE; |
65 |
|
- |
} |
66 |
|
- |
|
67 |
|
- |
private native char getCharCode( Event e )/*-{ |
68 |
|
- |
return e.charCode || e.keyCode; |
69 |
|
- |
}-*/; |
70 |
|
- |
} |
|
1 |
+ |
/* |
|
2 |
+ |
* Copyright 2008 Google Inc. |
|
3 |
+ |
* |
|
4 |
+ |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
|
5 |
+ |
* use this file except in compliance with the License. You may obtain a copy of |
|
6 |
+ |
* the License at |
|
7 |
+ |
* |
|
8 |
+ |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
+ |
* |
|
10 |
+ |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
+ |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
|
12 |
+ |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
|
13 |
+ |
* License for the specific language governing permissions and limitations under |
|
14 |
+ |
* the License. |
|
15 |
+ |
*/ |
|
16 |
+ |
package com.google.gwt.gen2.event.dom.client; |
|
17 |
+ |
|
|
18 |
+ |
import com.google.gwt.user.client.*; |
|
19 |
+ |
|
|
20 |
+ |
/** |
|
21 |
+ |
* Represents a native key press event. |
|
22 |
+ |
* |
|
23 |
+ |
* @deprecated use the com.google.gwt.event.dom.client classes instead |
|
24 |
+ |
*/ |
|
25 |
+ |
@Deprecated |
|
26 |
+ |
public class KeyPressEvent extends KeyEvent { |
|
27 |
+ |
|
|
28 |
+ |
/** |
|
29 |
+ |
* Event type for key press events. Represents the meta-data associated with |
|
30 |
+ |
* this event. |
|
31 |
+ |
*/ |
|
32 |
+ |
public static final Type<KeyPressEvent, KeyPressHandler> TYPE = new Type<KeyPressEvent, KeyPressHandler>( Event.ONKEYPRESS ) { |
|
33 |
+ |
@Override |
|
34 |
+ |
public void fire( KeyPressHandler handler, KeyPressEvent event ) { |
|
35 |
+ |
handler.onKeyPress( event ); |
|
36 |
+ |
} |
|
37 |
+ |
|
|
38 |
+ |
@Override |
|
39 |
+ |
KeyPressEvent wrap( Event nativeEvent ) { |
|
40 |
+ |
return new KeyPressEvent( nativeEvent ); |
|
41 |
+ |
} |
|
42 |
+ |
}; |
|
43 |
+ |
|
|
44 |
+ |
/** |
|
45 |
+ |
* Constructor. |
|
46 |
+ |
* |
|
47 |
+ |
* @param nativeEvent the native event object |
|
48 |
+ |
*/ |
|
49 |
+ |
public KeyPressEvent( Event nativeEvent ) { |
|
50 |
+ |
super( nativeEvent ); |
|
51 |
+ |
} |
|
52 |
+ |
|
|
53 |
+ |
/** |
|
54 |
+ |
* Gets the char code for this event. |
|
55 |
+ |
* |
|
56 |
+ |
* @return the char code |
|
57 |
+ |
*/ |
|
58 |
+ |
public char getCharCode() { |
|
59 |
+ |
return getCharCode( getNativeEvent() ); |
|
60 |
+ |
} |
|
61 |
+ |
|
|
62 |
+ |
@Override |
|
63 |
+ |
protected Type getType() { |
|
64 |
+ |
return TYPE; |
|
65 |
+ |
} |
|
66 |
+ |
|
|
67 |
+ |
private native char getCharCode( Event e )/*-{ |
|
68 |
+ |
return e.charCode || e.keyCode; |
|
69 |
+ |
}-*/; |
|
70 |
+ |
} |