Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.memoire.jedit
Class JEditDefaultInputHandler  view JEditDefaultInputHandler download JEditDefaultInputHandler.java

java.lang.Object
  extended byjava.awt.event.KeyAdapter
      extended bycom.memoire.jedit.JEditInputHandler
          extended bycom.memoire.jedit.JEditDefaultInputHandler
All Implemented Interfaces:
java.util.EventListener, java.awt.event.KeyListener

public class JEditDefaultInputHandler
extends JEditInputHandler

The default input handler. It maps sequences of keystrokes into actions and inserts key typed events into the text area.

Version:
$Id: JEditDefaultInputHandler.java,v 1.3 2001/07/25 17:39:05 desnoix Exp $

Nested Class Summary
 
Nested classes inherited from class com.memoire.jedit.JEditInputHandler
JEditInputHandler.backspace, JEditInputHandler.backspace_word, JEditInputHandler.delete, JEditInputHandler.delete_word, JEditInputHandler.end, JEditInputHandler.home, JEditInputHandler.insert_break, JEditInputHandler.insert_char, JEditInputHandler.insert_tab, JEditInputHandler.MacroRecorder, JEditInputHandler.next_char, JEditInputHandler.next_line, JEditInputHandler.next_page, JEditInputHandler.next_word, JEditInputHandler.NonRecordable, JEditInputHandler.NonRepeatable, JEditInputHandler.overwrite, JEditInputHandler.prev_char, JEditInputHandler.prev_line, JEditInputHandler.prev_page, JEditInputHandler.prev_word, JEditInputHandler.repeat, JEditInputHandler.toggle_rect
 
Field Summary
private  java.util.Hashtable bindings
           
private  java.util.Hashtable currentBindings
           
 
Fields inherited from class com.memoire.jedit.JEditInputHandler
BACKSPACE, BACKSPACE_WORD, DELETE, DELETE_WORD, 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, repeat, REPEAT, repeatCount, 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
 
Constructor Summary
  JEditDefaultInputHandler()
          Creates a new input handler with no key bindings defined.
private JEditDefaultInputHandler(JEditDefaultInputHandler copy)
           
 
Method Summary
 void addDefaultKeyBindings()
          Sets up the default key bindings.
 void addKeyBinding(java.lang.String keyBinding, java.awt.event.ActionListener action)
          Adds a key binding to this input handler.
 JEditInputHandler copy()
          Returns a copy of this input handler that shares the same key bindings.
 void keyPressed(java.awt.event.KeyEvent evt)
          Handle a key pressed event.
 void keyTyped(java.awt.event.KeyEvent evt)
          Handle a key typed event.
static javax.swing.KeyStroke parseKeyStroke(java.lang.String keyStroke)
          Converts a string to a keystroke.
 void removeAllKeyBindings()
          Removes all key bindings from this input handler.
 void removeKeyBinding(java.lang.String keyBinding)
          Removes a key binding from this input handler.
 
Methods inherited from class com.memoire.jedit.JEditInputHandler
executeAction, getAction, getActionName, getActions, getMacroRecorder, getRepeatCount, getTextArea, grabNextKeyStroke, handleGrabAction, isRepeatEnabled, setMacroRecorder, setRepeatCount, setRepeatEnabled
 
Methods inherited from class java.awt.event.KeyAdapter
keyReleased
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bindings

private java.util.Hashtable bindings

currentBindings

private java.util.Hashtable currentBindings
Constructor Detail

JEditDefaultInputHandler

public JEditDefaultInputHandler()
Creates a new input handler with no key bindings defined.


JEditDefaultInputHandler

private JEditDefaultInputHandler(JEditDefaultInputHandler copy)
Method Detail

addDefaultKeyBindings

public void addDefaultKeyBindings()
Sets up the default key bindings.

Specified by:
addDefaultKeyBindings in class JEditInputHandler

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:
addKeyBinding in class JEditInputHandler

removeKeyBinding

public void removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler. This is not yet implemented.

Specified by:
removeKeyBinding in class JEditInputHandler

removeAllKeyBindings

public void removeAllKeyBindings()
Removes all key bindings from this input handler.

Specified by:
removeAllKeyBindings in class JEditInputHandler

copy

public JEditInputHandler 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:
copy in class JEditInputHandler

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.


keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Handle a key typed event. This inserts the key into the text area.


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 the KeyEvent class, without the VK_ prefix.