![]() |
Gridarta Editor
|
An input handler converts the user's key strokes into concrete actions. More...
Classes | |
interface | NonRepeatable |
If an action implements this interface, it should not be repeated. More... | |
Public Member Functions | |
abstract void | addDefaultKeyBindings () |
Adds the default key bindings to this input handler. More... | |
abstract InputHandler | copy () |
Returns a copy of this input handler that shares the same key bindings. More... | |
int | getRepeatCount () |
Returns the number of times the next action will be repeated. More... | |
void | setRepeatCount (final int repeatCount) |
Sets the number of times the next action will be repeated. More... | |
void | setRepeatEnabled (final boolean repeat) |
Sets the enabled state of repetition. More... | |
Static Public Member Functions | |
static JEditTextArea | getTextArea (final EventObject evt) |
Returns the text area that fired the specified event. More... | |
Protected Member Functions | |
void | executeAction (final ActionListener listener, final Object source, @Nullable final String actionCommand) |
Executes the specified action, repeating and recording it as necessary. More... | |
boolean | handleGrabAction (final KeyEvent evt) |
If a key is being grabbed, this method should be called with the appropriate key event. More... | |
boolean | isRepeatEnabled () |
Returns if repetition is enabled. More... | |
Protected Attributes | |
int | repeatCount |
Private Attributes | |
ActionListener | grabAction |
boolean | repeat |
Static Private Attributes | |
static final Category | LOG = Logger.getLogger(InputHandler.class) |
The Logger for printing log messages. More... | |
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.
Definition at line 36 of file InputHandler.java.
|
abstract |
Adds the default key bindings to this input handler.
This should not be called in the constructor of this input handler, because applications might load the key bindings from a file, etc.
Reimplemented in net.sf.gridarta.textedit.textarea.DefaultInputHandler.
Referenced by net.sf.gridarta.textedit.textarea.TextAreaDefaults.TextAreaDefaults().
|
abstract |
Returns a copy of this input handler that shares the same key bindings.
Setting key bindings in the copy will also set them in the original.
Reimplemented in net.sf.gridarta.textedit.textarea.DefaultInputHandler.
|
protected |
Executes the specified action, repeating and recording it as necessary.
listener | the action listener |
source | the event source |
actionCommand | the action command |
Definition at line 108 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.grabAction, net.sf.gridarta.textedit.textarea.InputHandler.repeat, and net.sf.gridarta.textedit.textarea.InputHandler.repeatCount.
Referenced by net.sf.gridarta.textedit.textarea.InputHandler.handleGrabAction(), net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyPressed(), and net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyTyped().
int net.sf.gridarta.textedit.textarea.InputHandler.getRepeatCount | ( | ) |
Returns the number of times the next action will be repeated.
Definition at line 83 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.repeat, and net.sf.gridarta.textedit.textarea.InputHandler.repeatCount.
Referenced by net.sf.gridarta.textedit.textarea.actions.InsertChar.actionPerformed(), net.sf.gridarta.textedit.textarea.JEditTextArea.copy(), and net.sf.gridarta.textedit.textarea.JEditTextArea.paste().
|
static |
Returns the text area that fired the specified event.
This method will throw an Error if
does not have a JEditTextArea in it's source component hierarchy.
evt | the event |
Definition at line 144 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.LOG.
Referenced by net.sf.gridarta.textedit.textarea.actions.InsertBreak.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.InsertTab.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Overwrite.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Repeat.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.ToggleRectangle.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Delete.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Backspace.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.InsertChar.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.BackspaceWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.DeleteWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.DocumentHome.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextPage.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextChar.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.End.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextLine.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.DocumentEnd.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevChar.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Home.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevLine.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevPage.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.NextWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.PrevWord.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Copy.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Cut.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Paste.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.FunctionMenu.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.Find.actionPerformed(), net.sf.gridarta.textedit.textarea.actions.FindAgain.actionPerformed(), and net.sf.gridarta.textedit.textarea.actions.Replace.actionPerformed().
|
protected |
If a key is being grabbed, this method should be called with the appropriate key event.
It executes the grab action with the typed character as the parameter.
evt | the key event the key should be grabbed of |
Definition at line 182 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.executeAction(), and net.sf.gridarta.textedit.textarea.InputHandler.grabAction.
Referenced by net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyPressed(), and net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyTyped().
|
protected |
Returns if repetition is enabled.
When repetition is enabled, actions will be executed multiple times. This is usually invoked with a special key stroke in the input handler.
Definition at line 63 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.repeat.
Referenced by net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyTyped().
void net.sf.gridarta.textedit.textarea.InputHandler.setRepeatCount | ( | final int | repeatCount | ) |
Sets the number of times the next action will be repeated.
repeatCount | the repeat count |
Definition at line 91 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.repeatCount.
Referenced by net.sf.gridarta.textedit.textarea.actions.Repeat.actionPerformed().
void net.sf.gridarta.textedit.textarea.InputHandler.setRepeatEnabled | ( | final boolean | repeat | ) |
Sets the enabled state of repetition.
When repetition is enabled, actions will be executed multiple times. Once repeating is enabled, the input handler should read a number from the keyboard.
repeat |
Definition at line 74 of file InputHandler.java.
References net.sf.gridarta.textedit.textarea.InputHandler.repeat.
Referenced by net.sf.gridarta.textedit.textarea.actions.Repeat.actionPerformed(), and net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyTyped().
|
private |
Definition at line 44 of file InputHandler.java.
Referenced by net.sf.gridarta.textedit.textarea.InputHandler.executeAction(), and net.sf.gridarta.textedit.textarea.InputHandler.handleGrabAction().
|
staticprivate |
The Logger for printing log messages.
Definition at line 41 of file InputHandler.java.
Referenced by net.sf.gridarta.textedit.textarea.InputHandler.getTextArea().
|
private |
Definition at line 46 of file InputHandler.java.
Referenced by net.sf.gridarta.textedit.textarea.InputHandler.executeAction(), net.sf.gridarta.textedit.textarea.InputHandler.getRepeatCount(), net.sf.gridarta.textedit.textarea.InputHandler.isRepeatEnabled(), and net.sf.gridarta.textedit.textarea.InputHandler.setRepeatEnabled().
|
protected |
Definition at line 48 of file InputHandler.java.
Referenced by net.sf.gridarta.textedit.textarea.InputHandler.executeAction(), net.sf.gridarta.textedit.textarea.InputHandler.getRepeatCount(), net.sf.gridarta.textedit.textarea.DefaultInputHandler.keyTyped(), and net.sf.gridarta.textedit.textarea.InputHandler.setRepeatCount().