Class DefaultInputHandler
- java.lang.Object
-
- java.awt.event.KeyAdapter
-
- com.inductiveautomation.ignition.client.jedittextarea.InputHandler
-
- com.inductiveautomation.ignition.client.jedittextarea.DefaultInputHandler
-
- All Implemented Interfaces:
java.awt.event.KeyListener,java.util.EventListener
- Direct Known Subclasses:
CutCopyPasteInputHandler
public class DefaultInputHandler extends InputHandler
The default input handler. It maps sequences of keystrokes into actions and inserts key typed events into the text area.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.client.jedittextarea.InputHandler
InputHandler.backspace, InputHandler.backspace_word, InputHandler.delete, InputHandler.delete_word, InputHandler.document_end, InputHandler.document_home, InputHandler.end, InputHandler.home, InputHandler.insert_break, InputHandler.insert_char, InputHandler.insert_tab, InputHandler.MacroRecorder, InputHandler.next_char, InputHandler.next_line, InputHandler.next_page, InputHandler.next_word, InputHandler.NonRecordable, InputHandler.NonRepeatable, InputHandler.overwrite, InputHandler.prev_char, InputHandler.prev_line, InputHandler.prev_page, InputHandler.prev_word, InputHandler.redo, InputHandler.repeat, InputHandler.select_all, InputHandler.toggle_rect, InputHandler.undo, InputHandler.Wrapper
-
-
Field Summary
-
Fields inherited from class com.inductiveautomation.ignition.client.jedittextarea.InputHandler
BACKSPACE, BACKSPACE_WORD, DELETE, DELETE_WORD, DOCUMENT_END, DOCUMENT_HOME, END, grabAction, HOME, INSERT_BREAK, INSERT_CHAR, INSERT_TAB, NEXT_CHAR, NEXT_LINE, NEXT_PAGE, NEXT_WORD, OVERWRITE, PREV_CHAR, PREV_LINE, PREV_PAGE, PREV_WORD, recorder, REDO, repeat, REPEAT, repeatCount, SELECT_ALL, SELECT_DOC_END, SELECT_DOC_HOME, SELECT_END, SELECT_HOME, SELECT_NEXT_CHAR, SELECT_NEXT_LINE, SELECT_NEXT_PAGE, SELECT_NEXT_WORD, SELECT_PREV_CHAR, SELECT_PREV_LINE, SELECT_PREV_PAGE, SELECT_PREV_WORD, SMART_HOME_END_PROPERTY, TOGGLE_RECT, UNDO
-
-
Constructor Summary
Constructors Constructor Description DefaultInputHandler()Creates a new input handler with no key bindings defined.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaultKeyBindings()Sets up the default key bindings.voidaddKeyBinding(java.lang.String keyBinding, java.awt.event.ActionListener action)Adds a key binding to this input handler.InputHandlercopy()Returns a copy of this input handler that shares the same key bindings.voidkeyPressed(java.awt.event.KeyEvent evt)Handle a key pressed event.voidkeyTyped(java.awt.event.KeyEvent evt)Handle a key typed event.static javax.swing.KeyStrokeparseKeyStroke(java.lang.String keyStroke)Converts a string to a keystroke.voidremoveAllKeyBindings()Removes all key bindings from this input handler.voidremoveKeyBinding(java.lang.String keyBinding)Removes a key binding from this input handler.-
Methods inherited from class com.inductiveautomation.ignition.client.jedittextarea.InputHandler
executeAction, getAction, getActionName, getActions, getMacroRecorder, getRepeatCount, getTextArea, grabNextKeyStroke, handleGrabAction, isRepeatEnabled, setMacroRecorder, setRepeatCount, setRepeatEnabled
-
-
-
-
Method Detail
-
addDefaultKeyBindings
public void addDefaultKeyBindings()
Sets up the default key bindings.- Specified by:
addDefaultKeyBindingsin classInputHandler
-
addKeyBinding
public void addKeyBinding(java.lang.String keyBinding, java.awt.event.ActionListener action)Adds a key binding to this input handler. The key binding is a list of white space separated key strokes of the form [modifiers+]key where modifier is C for Control, A for Alt, or S for Shift, and key is either a character (a-z) or a field name in the KeyEvent class prefixed with VK_ (e.g., BACK_SPACE)- Specified by:
addKeyBindingin classInputHandler- Parameters:
keyBinding- The key bindingaction- The action
-
removeKeyBinding
public void removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler. This is not yet implemented.- Specified by:
removeKeyBindingin classInputHandler- Parameters:
keyBinding- The key binding
-
removeAllKeyBindings
public void removeAllKeyBindings()
Removes all key bindings from this input handler.- Specified by:
removeAllKeyBindingsin classInputHandler
-
copy
public InputHandler copy()
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.- Specified by:
copyin classInputHandler
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent evt)
Handle a key pressed event. This will look up the binding for the key stroke and execute it.- Specified by:
keyPressedin interfacejava.awt.event.KeyListener- Overrides:
keyPressedin classjava.awt.event.KeyAdapter
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent evt)
Handle a key typed event. This inserts the key into the text area.- Specified by:
keyTypedin interfacejava.awt.event.KeyListener- Overrides:
keyTypedin classjava.awt.event.KeyAdapter
-
parseKeyStroke
public static javax.swing.KeyStroke parseKeyStroke(java.lang.String keyStroke)
Converts a string to a keystroke. The string should be of the form modifiers+shortcut where modifiers is any combination of A for Alt, C for Control, S for Shift or M for Meta, and shortcut is either a single character, or a keycode name from theKeyEventclass, without theVK_prefix.- Parameters:
keyStroke- A string description of the key stroke
-
-