KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icesoft > faces > component > ext > KeyEvent


1 /*
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * "The contents of this file are subject to the Mozilla Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
11  * License for the specific language governing rights and limitations under
12  * the License.
13  *
14  * The Original Code is ICEfaces 1.5 open source software code, released
15  * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
16  * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
17  * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
18  *
19  * Contributor(s): _____________________.
20  *
21  * Alternatively, the contents of this file may be used under the terms of
22  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
23  * License), in which case the provisions of the LGPL License are
24  * applicable instead of those above. If you wish to allow use of your
25  * version of this file only under the terms of the LGPL License and not to
26  * allow others to use your version of this file under the MPL, indicate
27  * your decision by deleting the provisions above and replace them with
28  * the notice and other provisions required by the LGPL License. If you do
29  * not delete the provisions above, a recipient may use your version of
30  * this file under either the MPL or the LGPL License."
31  *
32  */

33
34 package com.icesoft.faces.component.ext;
35
36
37 import javax.faces.component.UIComponent;
38 import javax.faces.event.ActionEvent;
39 import javax.faces.event.FacesListener;
40 import java.util.HashMap JavaDoc;
41 import java.util.Map JavaDoc;
42 import java.util.StringTokenizer JavaDoc;
43
44 public class KeyEvent extends ActionEvent {
45     public static final int ESC = 27;
46     public static final int TAB = 9;
47     public static final int CAPSLOCK = 20;
48     public static final int SHIFT = 16;
49     public static final int CTRL = 17;
50     public static final int START_LEFT = 91;
51     public static final int START_RIGHT = 92;
52     public static final int CONTEXT_MENU = 93;
53     public static final int ALT = 18;
54     public static final int SPACE = 32;
55     public static final int CARRIAGE_RETURN = 13;
56     public static final int LINE_FEED = 10;
57     public static final int BACK_SLASH = 220;
58     public static final int BACK_SPACE = 8;
59
60     public static final int INSERT = 45;
61     public static final int DEL = 46;
62     public static final int HOME = 36;
63     public static final int END = 35;
64     public static final int PAGE_UP = 33;
65     public static final int PAGE_DOWN = 34;
66
67     public static final int PRINT_SCREEN = 44;
68     public static final int SCR_LK = 145;
69     public static final int PAUSE = 19;
70
71
72     public static final int LEFT_ARROW_KEY = 37;
73     public static final int UP_ARROW_KEY = 38;
74     public static final int RIGHT_ARROW_KEY = 39;
75     public static final int DOWN_ARROW_KEY = 40;
76
77
78     public static final int F1 = 112;
79     public static final int F2 = 113;
80     public static final int F3 = 114;
81     public static final int F4 = 115;
82     public static final int F5 = 116;
83     public static final int F6 = 117;
84     public static final int F7 = 118;
85     public static final int F8 = 119;
86     public static final int F9 = 120;
87     public static final int F10 = 121;
88     public static final int F11 = 122;
89     public static final int F12 = 123;
90     private Map JavaDoc requestMap;
91
92     public KeyEvent(UIComponent uiComponent, Map JavaDoc requestMap) {
93         super(uiComponent);
94         this.requestMap = requestMap;
95     }
96
97     public boolean isAltKey() {
98         return Boolean.valueOf((String JavaDoc) this.requestMap.get("ice.event.alt")).booleanValue();
99     }
100
101     public boolean isCtrlKey() {
102         return Boolean.valueOf((String JavaDoc) this.requestMap.get("ice.event.ctrl")).booleanValue();
103     }
104
105     public boolean isShiftKey() {
106         return Boolean.valueOf((String JavaDoc) this.requestMap.get("ice.event.shift")).booleanValue();
107     }
108
109     public int getKeyCode() {
110         String JavaDoc s = (String JavaDoc) this.requestMap.get("ice.event.keycode");
111         if(s == null)return -1;
112         return Integer.parseInt(s);
113     }
114
115     public String JavaDoc getType() {
116         return (String JavaDoc) this.requestMap.get("ice.event.type");
117     }
118
119     public String JavaDoc getComponentId() {
120         return (String JavaDoc) this.requestMap.get("ice.event.captured");
121     }
122
123     public boolean isAppropriateListener(FacesListener arg0) {
124         return false;
125     }
126
127     public void processListener(FacesListener arg0) {
128     }
129 }
130
Popular Tags