01: /*
02: * Copyright Javelin Software, All rights reserved.
03: */
04:
05: package com.javelin.swinglets.event;
06:
07: import java.awt.*;
08: import java.awt.event.*;
09:
10: /**
11: * ScriptedKeyListener is used to determine what happens when
12: * a Scripted Event happens, such as a JavaScript event on the client
13: * browser.
14: *
15: * @author Robin Sharp
16: */
17:
18: public class ScriptedKeyListener extends ScriptedListener implements
19: KeyListener {
20: public final static String KEY_TYPED = "onkeypress";
21: public final static String KEY_RELEASED = "onkeydown";
22: public final static String KEY_PRESSED = "onkeyup";
23:
24: /**
25: * Construct a listener with the script content type.
26: */
27: public ScriptedKeyListener(String contentType) {
28: super (contentType);
29: }
30:
31: /**
32: * Get the key Typed Script.
33: */
34: public Object getKeyTypedScript() {
35: return get(KEY_TYPED);
36: }
37:
38: /**
39: * Get the key Typed Script.
40: */
41: public ScriptedKeyListener setKeyTypedScript(Object keyTypedScript) {
42: put(KEY_TYPED, keyTypedScript);
43: return this ;
44: }
45:
46: /**
47: * Get the key Pressed Script.
48: */
49: public Object getKeyPressedScript() {
50: return get(KEY_RELEASED);
51: }
52:
53: /**
54: * Get the key Pressed Script.
55: */
56: public ScriptedKeyListener setKeyPressedScript(
57: Object keyPressedScript) {
58: put(KEY_RELEASED, keyPressedScript);
59: return this ;
60: }
61:
62: /**
63: * Get the key Released Script.
64: */
65: public Object getKeyReleasedScript() {
66: return get(KEY_RELEASED);
67: }
68:
69: /**
70: * Get the key Released Script.
71: */
72: public ScriptedKeyListener setKeyReleasedScript(
73: Object keyReleasedScript) {
74: put(KEY_RELEASED, keyReleasedScript);
75: return this ;
76: }
77:
78: // STUB EVENT HANDLERS /////////////////////////////////////////////////////
79:
80: public void keyTyped(KeyEvent e) {
81: };
82:
83: public void keyPressed(KeyEvent e) {
84: };
85:
86: public void keyReleased(KeyEvent e) {
87: };
88:
89: // PRIVATE /////////////////////////////////////////////////////////////////
90:
91: }
|