|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.event.KeyAdapter | +--org.gjt.sp.jedit.gui.InputHandler
An input handler converts the user's key strokes into concrete actions. It also takes care of macro recording and action repetition.
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
Field Summary | |
protected EditAction |
lastAction
|
protected int |
lastActionCount
|
protected java.lang.String |
readNextChar
|
protected boolean |
repeat
|
protected int |
repeatCount
|
protected View |
view
|
Constructor Summary | |
InputHandler(View view)
Creates a new input handler. |
Method Summary | |
abstract void |
addKeyBinding(java.lang.String keyBinding,
EditAction action)
Adds a key binding to this input handler. |
EditAction |
getLastAction()
Returns the last executed action. |
int |
getLastActionCount()
Returns the number of times the last action was executed. |
int |
getRepeatCount()
Returns the number of times the next action will be repeated. |
void |
invokeAction(EditAction action)
Invokes the specified action, repeating and recording it as necessary. |
protected void |
invokeReadNextChar(char ch)
|
boolean |
isPrefixActive()
Returns if a prefix key has been pressed. |
boolean |
isRepeatEnabled()
Returns if repeating is enabled. |
void |
processKeyEvent(java.awt.event.KeyEvent evt)
Utility method, calls one of KeyAdapter.keyPressed(KeyEvent) ,
KeyAdapter.keyReleased(KeyEvent) , or KeyAdapter.keyTyped(KeyEvent) . |
void |
readNextChar(java.lang.String code)
Deprecated. Use the other form of this method instead |
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. |
abstract void |
removeAllKeyBindings()
Removes all key bindings from this input handler. |
abstract void |
removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler. |
void |
resetLastActionCount()
Resets the last action count. |
void |
setRepeatCount(int repeatCount)
Sets the number of times the next action will be repeated. |
void |
setRepeatEnabled(boolean repeat)
Enables repeating. |
protected void |
userInput(char ch)
|
Methods inherited from class java.awt.event.KeyAdapter |
keyPressed, keyReleased, keyTyped |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected View view
protected boolean repeat
protected int repeatCount
protected EditAction lastAction
protected int lastActionCount
protected java.lang.String readNextChar
Constructor Detail |
public InputHandler(View view)
view
- The viewMethod Detail |
public void processKeyEvent(java.awt.event.KeyEvent evt)
KeyAdapter.keyPressed(KeyEvent)
,
KeyAdapter.keyReleased(KeyEvent)
, or KeyAdapter.keyTyped(KeyEvent)
.
public abstract void addKeyBinding(java.lang.String keyBinding, EditAction action)
keyBinding
- The key binding (the format of this is
input-handler specific)action
- The actionpublic abstract void removeKeyBinding(java.lang.String keyBinding)
keyBinding
- The key bindingpublic abstract void removeAllKeyBindings()
public boolean isPrefixActive()
public boolean isRepeatEnabled()
public void setRepeatEnabled(boolean repeat)
public int getRepeatCount()
public void setRepeatCount(int repeatCount)
repeatCount
- The repeat countpublic EditAction getLastAction()
public int getLastActionCount()
public void readNextChar(java.lang.String msg, java.lang.String code)
msg
- The prompt to display in the status barcode
- The codepublic void readNextChar(java.lang.String code)
public void resetLastActionCount()
public void invokeAction(EditAction action)
action
- The actionprotected void userInput(char ch)
protected void invokeReadNextChar(char ch)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |