public abstract class InputHandler extends AbstractInputHandler<EditAction>
This class provides all the necessary support code for an input handler, but doesn't actually do any key binding logic. It is up to the implementations of this class to do so.
DefaultInputHandler
Modifier and Type | Field and Description |
---|---|
protected View |
view |
bindings, currentBindings, keyEventInterceptor, lastAction, lastActionCount, PREFIX_STR, readNextChar, REPEAT_COUNT_THRESHOLD, repeatCount, shortcutOn
Modifier | Constructor and Description |
---|---|
protected |
InputHandler(View view)
Creates a new input handler.
|
Modifier and Type | Method and Description |
---|---|
EditAction |
getLastAction()
Returns the last executed action.
|
int |
getRepeatCount()
Returns the number of times the next action will be repeated.
|
boolean |
handleKey(KeyEventTranslator.Key keyStroke)
Handles a keystroke.
|
void |
invokeAction(EditAction action)
Invokes the specified action, repeating and recording it as
necessary.
|
void |
invokeAction(java.lang.String action)
Invokes the specified action, repeating and recording it as
necessary.
|
void |
invokeLastAction() |
protected void |
invokeReadNextChar(char ch) |
void |
processKeyEvent(java.awt.event.KeyEvent evt,
int from,
boolean global)
Forwards key events directly to the input handler.
|
void |
readNextChar(java.lang.String msg,
java.lang.String code)
Invokes the specified BeanShell code, replacing __char__ in the
code with the next input character.
|
void |
setRepeatCount(int repeatCount)
Sets the number of times the next action will be repeated.
|
protected void |
userInput(char ch) |
addKeyBinding, addKeyBinding, addKeyBinding, getKeyBinding, getKeyEventInterceptor, getLastActionCount, handleKey, isPrefixActive, processKeyEventKeyStrokeHandling, removeAllKeyBindings, removeKeyBinding, resetLastActionCount, sendShortcutPrefixOff, setBindings, setCurrentBindings, setKeyEventInterceptor, toString
protected final View view
protected InputHandler(View view)
view
- The viewpublic final boolean handleKey(KeyEventTranslator.Key keyStroke)
keyStroke
- The key stroke.public void processKeyEvent(java.awt.event.KeyEvent evt, int from, boolean global)
processKeyEvent
in class AbstractInputHandler<EditAction>
evt
- the keyboard eventfrom
- the source, it can be View.VIEW
,
View.ACTION_BAR
or View.TEXT_AREA
global
- tell if the event comes from the DefaultKeyboardFocusManager or notpublic int getRepeatCount()
public void setRepeatCount(int repeatCount)
repeatCount
- The repeat countpublic EditAction getLastAction()
public void readNextChar(java.lang.String msg, java.lang.String code)
msg
- The prompt to display in the status barcode
- The codepublic void invokeAction(java.lang.String action)
invokeAction
in class AbstractInputHandler<EditAction>
action
- The actionpublic void invokeAction(EditAction action)
invokeAction
in class AbstractInputHandler<EditAction>
action
- The actionpublic void invokeLastAction()
protected void userInput(char ch)
protected void invokeReadNextChar(char ch)