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

Quick Search    Search Deep

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

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

public abstract class JEditInputHandler
extends java.awt.event.KeyAdapter

An abstract class for a key event handler. Concrete implementations provide specific keystroke to action mappings.

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

Nested Class Summary
static class JEditInputHandler.backspace
           
static class JEditInputHandler.backspace_word
           
static class JEditInputHandler.delete
           
static class JEditInputHandler.delete_word
           
static class JEditInputHandler.end
           
static class JEditInputHandler.home
           
static class JEditInputHandler.insert_break
           
static class JEditInputHandler.insert_char
           
static class JEditInputHandler.insert_tab
           
static interface JEditInputHandler.MacroRecorder
          Macro recorder.
static class JEditInputHandler.next_char
           
static class JEditInputHandler.next_line
           
static class JEditInputHandler.next_page
           
static class JEditInputHandler.next_word
           
static interface JEditInputHandler.NonRecordable
          If an action implements this interface, it should not be recorded by the macro recorder.
static interface JEditInputHandler.NonRepeatable
          If an action implements this interface, it should not be repeated.
static class JEditInputHandler.overwrite
           
static class JEditInputHandler.prev_char
           
static class JEditInputHandler.prev_line
           
static class JEditInputHandler.prev_page
           
static class JEditInputHandler.prev_word
           
static class JEditInputHandler.repeat
           
static class JEditInputHandler.toggle_rect
           
 
Field Summary
private static java.util.Hashtable actions
           
static java.awt.event.ActionListener BACKSPACE
           
static java.awt.event.ActionListener BACKSPACE_WORD
           
static java.awt.event.ActionListener DELETE
           
static java.awt.event.ActionListener DELETE_WORD
           
static java.awt.event.ActionListener END
           
protected  java.awt.event.ActionListener grabAction
           
static java.awt.event.ActionListener HOME
           
static java.awt.event.ActionListener INSERT_BREAK
           
static java.awt.event.ActionListener INSERT_CHAR
           
static java.awt.event.ActionListener INSERT_TAB
           
static java.awt.event.ActionListener NEXT_CHAR
           
static java.awt.event.ActionListener NEXT_LINE
           
static java.awt.event.ActionListener NEXT_PAGE
           
static java.awt.event.ActionListener NEXT_WORD
           
static java.awt.event.ActionListener OVERWRITE
           
static java.awt.event.ActionListener PREV_CHAR
           
static java.awt.event.ActionListener PREV_LINE
           
static java.awt.event.ActionListener PREV_PAGE
           
static java.awt.event.ActionListener PREV_WORD
           
protected  JEditInputHandler.MacroRecorder recorder
           
protected  boolean repeat
           
static java.awt.event.ActionListener REPEAT
           
protected  int repeatCount
           
static java.awt.event.ActionListener SELECT_END
           
static java.awt.event.ActionListener SELECT_HOME
           
static java.awt.event.ActionListener SELECT_NEXT_CHAR
           
static java.awt.event.ActionListener SELECT_NEXT_LINE
           
static java.awt.event.ActionListener SELECT_NEXT_PAGE
           
static java.awt.event.ActionListener SELECT_NEXT_WORD
           
static java.awt.event.ActionListener SELECT_PREV_CHAR
           
static java.awt.event.ActionListener SELECT_PREV_LINE
           
static java.awt.event.ActionListener SELECT_PREV_PAGE
           
static java.awt.event.ActionListener SELECT_PREV_WORD
           
static java.lang.String SMART_HOME_END_PROPERTY
          If this client property is set to Boolean.TRUE on the text area, the home/end keys will support 'smart' BRIEF-like behaviour (one press = start/end of line, two presses = start/end of viewscreen, three presses = start/end of document)
static java.awt.event.ActionListener TOGGLE_RECT
           
 
Constructor Summary
JEditInputHandler()
           
 
Method Summary
abstract  void addDefaultKeyBindings()
          Adds the default key bindings to this input handler.
abstract  void addKeyBinding(java.lang.String keyBinding, java.awt.event.ActionListener action)
          Adds a key binding to this input handler.
abstract  JEditInputHandler copy()
          Returns a copy of this input handler that shares the same key bindings.
 void executeAction(java.awt.event.ActionListener listener, java.lang.Object source, java.lang.String actionCommand)
          Executes the specified action.
static java.awt.event.ActionListener getAction(java.lang.String name)
          Returns a named text area action.
static java.lang.String getActionName(java.awt.event.ActionListener listener)
          Returns an action's name.
static java.util.Enumeration getActions()
          Returns an enumeration of all available actions.
 JEditInputHandler.MacroRecorder getMacroRecorder()
          Returns the macro recorder.
 int getRepeatCount()
          Returns the number of times the next action will be repeated.
static JEditTextArea getTextArea(java.util.EventObject evt)
          Returns the text area that fired the specified event.
 void grabNextKeyStroke(java.awt.event.ActionListener listener)
          Grabs the next key typed event and invokes the specified action with the key as a the action command.
protected  void handleGrabAction(java.awt.event.KeyEvent evt)
          If a key is being grabbed, this method should be called with the appropriate key event.
 boolean isRepeatEnabled()
          Returns if repeating is enabled.
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 setMacroRecorder(JEditInputHandler.MacroRecorder recorder)
          Sets the macro recorder.
 void setRepeatCount(int repeatCount)
          Sets the number of times the next action will be repeated.
 void setRepeatEnabled(boolean repeat)
          Enables repeating.
 
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

SMART_HOME_END_PROPERTY

public static final java.lang.String SMART_HOME_END_PROPERTY
If this client property is set to Boolean.TRUE on the text area, the home/end keys will support 'smart' BRIEF-like behaviour (one press = start/end of line, two presses = start/end of viewscreen, three presses = start/end of document)

See Also:
Constant Field Values

BACKSPACE

public static final java.awt.event.ActionListener BACKSPACE

BACKSPACE_WORD

public static final java.awt.event.ActionListener BACKSPACE_WORD

DELETE

public static final java.awt.event.ActionListener DELETE

DELETE_WORD

public static final java.awt.event.ActionListener DELETE_WORD

END

public static final java.awt.event.ActionListener END

SELECT_END

public static final java.awt.event.ActionListener SELECT_END

INSERT_BREAK

public static final java.awt.event.ActionListener INSERT_BREAK

INSERT_TAB

public static final java.awt.event.ActionListener INSERT_TAB

HOME

public static final java.awt.event.ActionListener HOME

SELECT_HOME

public static final java.awt.event.ActionListener SELECT_HOME

NEXT_CHAR

public static final java.awt.event.ActionListener NEXT_CHAR

NEXT_LINE

public static final java.awt.event.ActionListener NEXT_LINE

NEXT_PAGE

public static final java.awt.event.ActionListener NEXT_PAGE

NEXT_WORD

public static final java.awt.event.ActionListener NEXT_WORD

SELECT_NEXT_CHAR

public static final java.awt.event.ActionListener SELECT_NEXT_CHAR

SELECT_NEXT_LINE

public static final java.awt.event.ActionListener SELECT_NEXT_LINE

SELECT_NEXT_PAGE

public static final java.awt.event.ActionListener SELECT_NEXT_PAGE

SELECT_NEXT_WORD

public static final java.awt.event.ActionListener SELECT_NEXT_WORD

OVERWRITE

public static final java.awt.event.ActionListener OVERWRITE

PREV_CHAR

public static final java.awt.event.ActionListener PREV_CHAR

PREV_LINE

public static final java.awt.event.ActionListener PREV_LINE

PREV_PAGE

public static final java.awt.event.ActionListener PREV_PAGE

PREV_WORD

public static final java.awt.event.ActionListener PREV_WORD

SELECT_PREV_CHAR

public static final java.awt.event.ActionListener SELECT_PREV_CHAR

SELECT_PREV_LINE

public static final java.awt.event.ActionListener SELECT_PREV_LINE

SELECT_PREV_PAGE

public static final java.awt.event.ActionListener SELECT_PREV_PAGE

SELECT_PREV_WORD

public static final java.awt.event.ActionListener SELECT_PREV_WORD

REPEAT

public static final java.awt.event.ActionListener REPEAT

TOGGLE_RECT

public static final java.awt.event.ActionListener TOGGLE_RECT

INSERT_CHAR

public static final java.awt.event.ActionListener INSERT_CHAR

actions

private static java.util.Hashtable actions

grabAction

protected java.awt.event.ActionListener grabAction

repeat

protected boolean repeat

repeatCount

protected int repeatCount

recorder

protected JEditInputHandler.MacroRecorder recorder
Constructor Detail

JEditInputHandler

public JEditInputHandler()
Method Detail

getAction

public static java.awt.event.ActionListener getAction(java.lang.String name)
Returns a named text area action.


getActionName

public static java.lang.String getActionName(java.awt.event.ActionListener listener)
Returns an action's name.


getActions

public static java.util.Enumeration getActions()
Returns an enumeration of all available actions.


addDefaultKeyBindings

public abstract void addDefaultKeyBindings()
Adds the default key bindings to this input handler.


addKeyBinding

public abstract void addKeyBinding(java.lang.String keyBinding,
                                   java.awt.event.ActionListener action)
Adds a key binding to this input handler.


removeKeyBinding

public abstract void removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler.


removeAllKeyBindings

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


grabNextKeyStroke

public void grabNextKeyStroke(java.awt.event.ActionListener listener)
Grabs the next key typed event and invokes the specified action with the key as a the action command.


isRepeatEnabled

public boolean isRepeatEnabled()
Returns if repeating is enabled. When repeating is enabled, actions will be executed multiple times. This is usually invoked with a special key stroke in the input handler.


setRepeatEnabled

public void setRepeatEnabled(boolean repeat)
Enables repeating. When repeating is enabled, actions will be executed multiple times. Once repeating is enabled, the input handler should read a number from the keyboard.


getRepeatCount

public int getRepeatCount()
Returns the number of times the next action will be repeated.


setRepeatCount

public void setRepeatCount(int repeatCount)
Sets the number of times the next action will be repeated.


getMacroRecorder

public JEditInputHandler.MacroRecorder getMacroRecorder()
Returns the macro recorder. If this is non-null, all executed actions should be forwarded to the recorder.


setMacroRecorder

public void setMacroRecorder(JEditInputHandler.MacroRecorder recorder)
Sets the macro recorder. If this is non-null, all executed actions should be forwarded to the recorder.


copy

public abstract 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.


executeAction

public void executeAction(java.awt.event.ActionListener listener,
                          java.lang.Object source,
                          java.lang.String actionCommand)
Executes the specified action.


getTextArea

public static JEditTextArea getTextArea(java.util.EventObject evt)
Returns the text area that fired the specified event.


handleGrabAction

protected void handleGrabAction(java.awt.event.KeyEvent evt)
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.