001: /*
002: ItsNat Java Web Application Framework
003: Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
004: Author: Jose Maria Arranz Santamaria
005:
006: This program is free software: you can redistribute it and/or modify
007: it under the terms of the GNU Affero General Public License as published by
008: the Free Software Foundation, either version 3 of the License, or
009: (at your option) any later version. See the GNU Affero General Public
010: License for more details. See the copy of the GNU Affero General Public License
011: included in this program. If not, see <http://www.gnu.org/licenses/>.
012: */
013:
014: package org.itsnat.core.event;
015:
016: import org.w3c.dom.events.UIEvent;
017: import org.w3c.dom.views.AbstractView;
018:
019: /**
020: * This interface is a Java DOM version of <a href="http://lxr.mozilla.org/seamonkey/source/dom/public/idl/events/nsIDOMKeyEvent.idl">Mozilla/FireFox's KeyEvent</a>
021: * interface because there is no W3C DOM Level 2 key event interface.
022: *
023: * <p>Is similar to <a href="http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-KeyboardEvent-keyIdentifier">W3C DOM Level 3 KeyboardEvent</a>.</p>
024: *
025: * <p>MSIE 6 key events are converted to this event type.</p>
026: *
027: * <p>Default implementation inherits from <code>java.util.EventObject</code>.</p>
028: *
029: * <p>More <a href="http://developer.mozilla.org/en/docs/DOM:event">info</a>.</p>
030: *
031: * @author Jose Maria Arranz Santamaria
032: */
033: public interface KeyEvent extends UIEvent {
034: // Como lo define Firefox, difiere un poco del draft del DOM-3 KeyboardEvent
035: // http://lxr.mozilla.org/seamonkey/source/dom/public/idl/events/nsIDOMKeyEvent.idl
036: // http://developer.mozilla.org/en/docs/DOM:event
037: // Tuvo un intento de estandarizarse casi igual en el W3C
038: // http://www.w3.org/TR/2001/WD-DOM-Level-3-Events-20010410/events.html#Events-KeyEvent
039:
040: public long DOM_VK_CANCEL = 0x03;
041: public long DOM_VK_HELP = 0x06;
042: public long DOM_VK_BACK_SPACE = 0x08;
043: public long DOM_VK_TAB = 0x09;
044: public long DOM_VK_CLEAR = 0x0C;
045: public long DOM_VK_RETURN = 0x0D;
046: public long DOM_VK_ENTER = 0x0E;
047: public long DOM_VK_SHIFT = 0x10;
048: public long DOM_VK_CONTROL = 0x11;
049: public long DOM_VK_ALT = 0x12;
050: public long DOM_VK_PAUSE = 0x13;
051: public long DOM_VK_CAPS_LOCK = 0x14;
052: public long DOM_VK_ESCAPE = 0x1B;
053: public long DOM_VK_SPACE = 0x20;
054: public long DOM_VK_PAGE_UP = 0x21;
055: public long DOM_VK_PAGE_DOWN = 0x22;
056: public long DOM_VK_END = 0x23;
057: public long DOM_VK_HOME = 0x24;
058: public long DOM_VK_LEFT = 0x25;
059: public long DOM_VK_UP = 0x26;
060: public long DOM_VK_RIGHT = 0x27;
061: public long DOM_VK_DOWN = 0x28;
062: public long DOM_VK_PRINTSCREEN = 0x2C;
063: public long DOM_VK_INSERT = 0x2D;
064: public long DOM_VK_DELETE = 0x2E;
065: public long DOM_VK_0 = 0x30;
066: public long DOM_VK_1 = 0x31;
067: public long DOM_VK_2 = 0x32;
068: public long DOM_VK_3 = 0x33;
069: public long DOM_VK_4 = 0x34;
070: public long DOM_VK_5 = 0x35;
071: public long DOM_VK_6 = 0x36;
072: public long DOM_VK_7 = 0x37;
073: public long DOM_VK_8 = 0x38;
074: public long DOM_VK_9 = 0x39;
075: public long DOM_VK_SEMICOLON = 0x3B;
076: public long DOM_VK_EQUALS = 0x3D;
077: public long DOM_VK_A = 0x41;
078: public long DOM_VK_B = 0x42;
079: public long DOM_VK_C = 0x43;
080: public long DOM_VK_D = 0x44;
081: public long DOM_VK_E = 0x45;
082: public long DOM_VK_F = 0x46;
083: public long DOM_VK_G = 0x47;
084: public long DOM_VK_H = 0x48;
085: public long DOM_VK_I = 0x49;
086: public long DOM_VK_J = 0x4A;
087: public long DOM_VK_K = 0x4B;
088: public long DOM_VK_L = 0x4C;
089: public long DOM_VK_M = 0x4D;
090: public long DOM_VK_N = 0x4E;
091: public long DOM_VK_O = 0x4F;
092: public long DOM_VK_P = 0x50;
093: public long DOM_VK_Q = 0x51;
094: public long DOM_VK_R = 0x52;
095: public long DOM_VK_S = 0x53;
096: public long DOM_VK_T = 0x54;
097: public long DOM_VK_U = 0x55;
098: public long DOM_VK_V = 0x56;
099: public long DOM_VK_W = 0x57;
100: public long DOM_VK_X = 0x58;
101: public long DOM_VK_Y = 0x59;
102: public long DOM_VK_Z = 0x5A;
103: public long DOM_VK_CONTEXT_MENU = 0x5D;
104: public long DOM_VK_NUMPAD0 = 0x60;
105: public long DOM_VK_NUMPAD1 = 0x61;
106: public long DOM_VK_NUMPAD2 = 0x62;
107: public long DOM_VK_NUMPAD3 = 0x63;
108: public long DOM_VK_NUMPAD4 = 0x64;
109: public long DOM_VK_NUMPAD5 = 0x65;
110: public long DOM_VK_NUMPAD6 = 0x66;
111: public long DOM_VK_NUMPAD7 = 0x67;
112: public long DOM_VK_NUMPAD8 = 0x68;
113: public long DOM_VK_NUMPAD9 = 0x69;
114: public long DOM_VK_MULTIPLY = 0x6A;
115: public long DOM_VK_ADD = 0x6B;
116: public long DOM_VK_SEPARATOR = 0x6C;
117: public long DOM_VK_SUBTRACT = 0x6D;
118: public long DOM_VK_DECIMAL = 0x6E;
119: public long DOM_VK_DIVIDE = 0x6F;
120: public long DOM_VK_F1 = 0x70;
121: public long DOM_VK_F2 = 0x71;
122: public long DOM_VK_F3 = 0x72;
123: public long DOM_VK_F4 = 0x73;
124: public long DOM_VK_F5 = 0x74;
125: public long DOM_VK_F6 = 0x75;
126: public long DOM_VK_F7 = 0x76;
127: public long DOM_VK_F8 = 0x77;
128: public long DOM_VK_F9 = 0x78;
129: public long DOM_VK_F10 = 0x79;
130: public long DOM_VK_F11 = 0x7A;
131: public long DOM_VK_F12 = 0x7B;
132: public long DOM_VK_F13 = 0x7C;
133: public long DOM_VK_F14 = 0x7D;
134: public long DOM_VK_F15 = 0x7E;
135: public long DOM_VK_F16 = 0x7F;
136: public long DOM_VK_F17 = 0x80;
137: public long DOM_VK_F18 = 0x81;
138: public long DOM_VK_F19 = 0x82;
139: public long DOM_VK_F20 = 0x83;
140: public long DOM_VK_F21 = 0x84;
141: public long DOM_VK_F22 = 0x85;
142: public long DOM_VK_F23 = 0x86;
143: public long DOM_VK_F24 = 0x87;
144: public long DOM_VK_NUM_LOCK = 0x90;
145: public long DOM_VK_SCROLL_LOCK = 0x91;
146: public long DOM_VK_COMMA = 0xBC;
147: public long DOM_VK_PERIOD = 0xBE;
148: public long DOM_VK_SLASH = 0xBF;
149: public long DOM_VK_BACK_QUOTE = 0xC0;
150: public long DOM_VK_OPEN_BRACKET = 0xDB;
151: public long DOM_VK_BACK_SLASH = 0xDC;
152: public long DOM_VK_CLOSE_BRACKET = 0xDD;
153: public long DOM_VK_QUOTE = 0xDE;
154: public long DOM_VK_META = 0xE0;
155:
156: /**
157: * The <code>initKeyEvent</code> method is used to initialize the value of
158: * a <code>KeyEvent</code> created through the <code>DocumentEvent</code>
159: * interface. This method may only be called before the
160: * <code>KeyEvent</code> has been dispatched via the
161: * <code>dispatchEvent</code> method, though it may be called multiple
162: * times during that phase if necessary. If called multiple times, the
163: * final invocation takes precedence.
164: *
165: * @param typeArg specifies the event type.
166: * @param canBubbleArg specifies whether or not the event can bubble.
167: * @param cancelableArg specifies whether or not the event's default
168: * action can be prevented.
169: * @param viewArg specifies the <code>Event</code>'s <code>AbstractView</code>.
170: * @param ctrlKeyArg specifies whether or not control key was depressed
171: * during the <code>Event</code>.
172: * @param altKeyArg specifies whether or not alt key was depressed during
173: * the <code>Event</code>.
174: * @param shiftKeyArg specifies whether or not shift key was depressed
175: * during the <code>Event</code>.
176: * @param metaKeyArg specifies whether or not meta key was depressed
177: * during the <code>Event</code>.
178: * @param keyCodeArg specifies the Unicode value of a non-character key in a keypress event or any key in any other type of keyboard event.
179: * @param charCodeArg specifies the Unicode value of a character key that was pressed as part of a keypress event.
180: */
181: public void initKeyEvent(String typeArg, boolean canBubbleArg,
182: boolean cancelableArg, AbstractView viewArg,
183: boolean ctrlKeyArg, boolean altKeyArg, boolean shiftKeyArg,
184: boolean metaKeyArg, long keyCodeArg, long charCodeArg);
185:
186: /**
187: * If the alternative (Alt) key modifier is activated.
188: *
189: * @return true if Alt is activated.
190: */
191: public boolean getAltKey();
192:
193: /**
194: * Returns the Unicode value of a character key that was pressed as part of a keypress event.
195: *
196: * @return the character code.
197: */
198: public long getCharCode();
199:
200: /**
201: * If the Ctrl key modifier is activated.
202: *
203: * @return true if Ctrl is activated.
204: */
205: public boolean getCtrlKey();
206:
207: /**
208: * Returns the Unicode value of a non-character key in a keypress event or any key in any other type of keyboard event.
209: *
210: * @return the key code.
211: */
212: public long getKeyCode();
213:
214: /**
215: * If the Meta key modifier is activated. Only Mac keyboards.
216: *
217: * @return true if Meta is activated.
218: */
219: public boolean getMetaKey();
220:
221: /**
222: * If the Shift key modifier is activated.
223: *
224: * @return true if Shift is activated.
225: */
226: public boolean getShiftKey();
227:
228: }
|