org.araneaframework.jsp.tag.basic
Class BaseKeyboardHandlerTag
java.lang.Object
org.araneaframework.jsp.tag.BaseTag
org.araneaframework.jsp.tag.basic.BaseKeyboardHandlerTag
- All Implemented Interfaces:
- ContainedTagInterface, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
- Direct Known Subclasses:
- FormKeyboardHandlerHtmlTag, KeyboardHandlerHtmlTag, ServerSideKeyboardHandlerHtmlTag
- public abstract class BaseKeyboardHandlerTag
- extends BaseTag
- implements ContainedTagInterface
The base class for a set of "keyboard handler" tags.
All these tags simply emit a "uiRegisterKeyboardHandler" javascript invocation.
Custom subclasses should basically use the "writeRegisterKeypressHandlerScript" static method of
this class to do their job.
- Author:
- Konstantin Tretyakov (kt@webmedia.ee)
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Methods inherited from class org.araneaframework.jsp.tag.BaseTag |
addContextEntry, doCatch, doEndTag, doEndTag, doFinally, doStartTag, evaluate, evaluateNotNull, executeEndSubtag, executeEndTagAndUnregister, executeStartSubtag, executeSubtag, getConfiguration, getContextEntry, getContextWidget, getContextWidgetFullId, getEnvironment, getLocalizationContext, getOutputData, getParent, hideGlobalContextEntries, registerAndExecuteStartTag, registerSubtag, release, requireContextEntry, restoreGlobalContextEntries, setPageContext, setParent, unregisterSubtag |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
defaultKeyCode
protected String defaultKeyCode
intKeyCode
protected String intKeyCode
keyCode
protected String keyCode
defaultKey
protected String defaultKey
intKey
protected String intKey
key
protected String key
keyCombo
protected String keyCombo
BaseKeyboardHandlerTag
public BaseKeyboardHandlerTag()
setKeyCode
public void setKeyCode(String keyCode)
throws javax.servlet.jsp.JspException
- Throws:
javax.servlet.jsp.JspException- Jsp.attribute:
- type = "java.lang.String"
required = "false"
description = "Keycode to which the event must be triggered. 13 means enter.
Either keyCode or key must be specified, but not both."
setKeyCombo
public void setKeyCombo(String keyCombo)
throws javax.servlet.jsp.JspException
- Throws:
javax.servlet.jsp.JspException- Jsp.attribute:
- type = "java.lang.String"
required = "false"
description = "Keycode to which the event must be triggered. 13 means enter.
Either keyCode or key must be specified, but not both."
setKey
public void setKey(String key)
throws javax.servlet.jsp.JspException
- Key to which the event must be triggered.
Similar to
setKeyCode, but accepts key "aliases" instead of codes.
For example, to react to the return key, you either specify keyCode = "13",
or key = "enter" (but you can't specify both!).
A list of available aliases is given in keyToKeyCode(java.lang.String).
- Throws:
javax.servlet.jsp.JspException- See Also:
keyToKeyCode(java.lang.String)- Jsp.attribute:
- type = "java.lang.String"
required = "false"
description = "Key, to which the event must be triggered. Key is specified as a certain 'alias'. The alias may be an
ASCII character or a digit (this will denote the corresponding key on a US keyboard), a space (' '), or
one of the following: 'return', 'escape', 'backspace', 'tab', 'shift', 'control', 'space', 'f1',
'f2', ..., 'f12'."
doStartTag
protected int doStartTag(Writer out)
throws Exception
- Checks that either keyCode or key is specified (not both), and initializes the keyCode field.
When overriding don't forget to invoke superimplementation first.
- Overrides:
doStartTag in class BaseTag
- Throws:
Exception
writeRegisterKeypressHandlerScript
public static final void writeRegisterKeypressHandlerScript(Writer out,
String scope,
String keyCode,
String handler)
throws javax.servlet.jsp.JspException,
IOException
- Writes "uiRegisterKeypressHandler" javascript, surrounded by <script> tags.
Throws exceptions if parameters are not consistent (e.g. keyCode not specified).
- Throws:
javax.servlet.jsp.JspException
IOException
writeRegisterKeycomboHandlerScript
public static final void writeRegisterKeycomboHandlerScript(Writer out,
String scope,
String keyCombo,
String handler)
throws javax.servlet.jsp.JspException,
IOException
- Throws:
javax.servlet.jsp.JspException
IOException
keyToKeyCode
public static final int keyToKeyCode(String key)
- Translates a "key alias" to its key-code.
Under key-code we mean the keyboard code reported by the javascript
keyboard event, when the corresponding key is pushed on a usual US keyboard.
For example keyToKeyCode("A") returns 65.
keyToKeyCode("RETURN") returns 13.
Available key aliases are:
- All ASCII characters and digits
- "F1"..."F12"
- "RETURN"/"ENTER", "BACKSPACE", "ESCAPE", "TAB", "SHIFT", "CONTROL", "SPACE"
- " " (space) is space
Case does not matter.
If input is invalid, zero iz returned.
- Parameters:
key -
- Returns:
- corresponding keyCode (that is supposed