KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > pos > event > CharacterEvents


1 /*
2  * $Id: CharacterEvents.java 7207 2006-04-05 20:21:31Z les7arts $
3  *
4  * Copyright (c) 2004 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.pos.event;
26
27 import org.ofbiz.pos.screen.PosScreen;
28 import org.ofbiz.pos.component.Input;
29
30 /**
31  *
32  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
33  * @version $Rev: 7207 $
34  * @since 3.2
35  */

36 public class CharacterEvents {
37
38     public static boolean capsLockSet = false;
39
40     public static void triggerShift(PosScreen pos) {
41         pos.getInput().setFunction("SHIFT");
42         // TODO refresh the button display
43
}
44
45     public static void triggerCaps(PosScreen pos) {
46         capsLockSet = !capsLockSet;
47         // TODO refresh the button display
48
}
49
50     public static void triggerDel(PosScreen pos) {
51         pos.getInput().stripLastChar();
52     }
53
54     public static void triggerA(PosScreen pos) {
55         Input input = pos.getInput();
56         if (capsLockSet || input.isFunctionSet("SHIFT")) {
57             input.appendChar('A');
58         } else {
59             input.appendChar('a');
60         }
61     }
62
63     public static void triggerB(PosScreen pos) {
64         Input input = pos.getInput();
65         if (capsLockSet || input.isFunctionSet("SHIFT")) {
66             input.appendChar('B');
67         } else {
68             input.appendChar('b');
69         }
70     }
71
72     public static void triggerC(PosScreen pos) {
73         Input input = pos.getInput();
74         if (capsLockSet || input.isFunctionSet("SHIFT")) {
75             input.appendChar('C');
76         } else {
77             input.appendChar('c');
78         }
79     }
80
81     public static void triggerD(PosScreen pos) {
82         Input input = pos.getInput();
83         if (capsLockSet || input.isFunctionSet("SHIFT")) {
84             input.appendChar('D');
85         } else {
86             input.appendChar('d');
87         }
88     }
89
90     public static void triggerE(PosScreen pos) {
91         Input input = pos.getInput();
92         if (capsLockSet || input.isFunctionSet("SHIFT")) {
93             input.appendChar('E');
94         } else {
95             input.appendChar('e');
96         }
97     }
98
99     public static void triggerF(PosScreen pos) {
100         Input input = pos.getInput();
101         if (capsLockSet || input.isFunctionSet("SHIFT")) {
102             input.appendChar('F');
103         } else {
104             input.appendChar('f');
105         }
106     }
107
108     public static void triggerG(PosScreen pos) {
109         Input input = pos.getInput();
110         if (capsLockSet || input.isFunctionSet("SHIFT")) {
111             input.appendChar('G');
112         } else {
113             input.appendChar('g');
114         }
115     }
116
117     public static void triggerH(PosScreen pos) {
118         Input input = pos.getInput();
119         if (capsLockSet || input.isFunctionSet("SHIFT")) {
120             input.appendChar('H');
121         } else {
122             input.appendChar('h');
123         }
124     }
125
126     public static void triggerI(PosScreen pos) {
127         Input input = pos.getInput();
128         if (capsLockSet || input.isFunctionSet("SHIFT")) {
129             input.appendChar('I');
130         } else {
131             input.appendChar('i');
132         }
133     }
134
135     public static void triggerJ(PosScreen pos) {
136         Input input = pos.getInput();
137         if (capsLockSet || input.isFunctionSet("SHIFT")) {
138             input.appendChar('J');
139         } else {
140             input.appendChar('j');
141         }
142     }
143
144     public static void triggerK(PosScreen pos) {
145         Input input = pos.getInput();
146         if (capsLockSet || input.isFunctionSet("SHIFT")) {
147             input.appendChar('K');
148         } else {
149             input.appendChar('k');
150         }
151     }
152
153     public static void triggerL(PosScreen pos) {
154         Input input = pos.getInput();
155         if (capsLockSet || input.isFunctionSet("SHIFT")) {
156             input.appendChar('L');
157         } else {
158             input.appendChar('l');
159         }
160     }
161
162     public static void triggerM(PosScreen pos) {
163         Input input = pos.getInput();
164         if (capsLockSet || input.isFunctionSet("SHIFT")) {
165             input.appendChar('M');
166         } else {
167             input.appendChar('m');
168         }
169     }
170
171     public static void triggerN(PosScreen pos) {
172         Input input = pos.getInput();
173         if (capsLockSet || input.isFunctionSet("SHIFT")) {
174             input.appendChar('N');
175         } else {
176             input.appendChar('n');
177         }
178     }
179
180     public static void triggerO(PosScreen pos) {
181         Input input = pos.getInput();
182         if (capsLockSet || input.isFunctionSet("SHIFT")) {
183             input.appendChar('O');
184         } else {
185             input.appendChar('o');
186         }
187     }
188
189     public static void triggerP(PosScreen pos) {
190         Input input = pos.getInput();
191         if (capsLockSet || input.isFunctionSet("SHIFT")) {
192             input.appendChar('P');
193         } else {
194             input.appendChar('p');
195         }
196     }
197
198     public static void triggerQ(PosScreen pos) {
199         Input input = pos.getInput();
200         if (capsLockSet || input.isFunctionSet("SHIFT")) {
201             input.appendChar('Q');
202         } else {
203             input.appendChar('q');
204         }
205     }
206
207     public static void triggerR(PosScreen pos) {
208         Input input = pos.getInput();
209         if (capsLockSet || input.isFunctionSet("SHIFT")) {
210             input.appendChar('R');
211         } else {
212             input.appendChar('r');
213         }
214     }
215
216     public static void triggerS(PosScreen pos) {
217         Input input = pos.getInput();
218         if (capsLockSet || input.isFunctionSet("SHIFT")) {
219             input.appendChar('S');
220         } else {
221             input.appendChar('s');
222         }
223     }
224
225     public static void triggerT(PosScreen pos) {
226         Input input = pos.getInput();
227         if (capsLockSet || input.isFunctionSet("SHIFT")) {
228             input.appendChar('T');
229         } else {
230             input.appendChar('t');
231         }
232     }
233
234     public static void triggerU(PosScreen pos) {
235         Input input = pos.getInput();
236         if (capsLockSet || input.isFunctionSet("SHIFT")) {
237             input.appendChar('U');
238         } else {
239             input.appendChar('u');
240         }
241     }
242
243     public static void triggerV(PosScreen pos) {
244         Input input = pos.getInput();
245         if (capsLockSet || input.isFunctionSet("SHIFT")) {
246             input.appendChar('V');
247         } else {
248             input.appendChar('v');
249         }
250     }
251
252     public static void triggerW(PosScreen pos) {
253         Input input = pos.getInput();
254         if (capsLockSet || input.isFunctionSet("SHIFT")) {
255             input.appendChar('W');
256         } else {
257             input.appendChar('w');
258         }
259     }
260
261     public static void triggerX(PosScreen pos) {
262         Input input = pos.getInput();
263         if (capsLockSet || input.isFunctionSet("SHIFT")) {
264             input.appendChar('X');
265         } else {
266             input.appendChar('x');
267         }
268     }
269
270     public static void triggerY(PosScreen pos) {
271         Input input = pos.getInput();
272         if (capsLockSet || input.isFunctionSet("SHIFT")) {
273             input.appendChar('Y');
274         } else {
275             input.appendChar('y');
276         }
277     }
278
279     public static void triggerZ(PosScreen pos) {
280         Input input = pos.getInput();
281         if (capsLockSet || input.isFunctionSet("SHIFT")) {
282             input.appendChar('Z');
283         } else {
284             input.appendChar('z');
285         }
286     }
287 }
288
Popular Tags