kawigi.editor
Class KawigiEditKeyMap

java.lang.Object
  extended by kawigi.editor.KawigiEditKeyMap
All Implemented Interfaces:
javax.swing.text.Keymap

public class KawigiEditKeyMap
extends java.lang.Object
implements javax.swing.text.Keymap

Keymap implementation used by KawigiEdit's CodePanes. If you want to map a keystroke in the editor to some specific action, this is the place to do that. Also, I've long had a theory that if I got with some people and implemented one or two more keymaps to swap with this one, it would be reasonably feasible to implement a "Vi" mode on KawigiEdit, which is something I think some people would like.


Constructor Summary
KawigiEditKeyMap(Dispatcher editorSubDispatcher)
          Constructs a KawigiEditKeyMap with the set of actions we bind to keystrokes in the editor.
 
Method Summary
 void addActionForKeyStroke(javax.swing.KeyStroke key, javax.swing.Action a)
          Binds an action to a keystroke.
 javax.swing.Action getAction(javax.swing.KeyStroke key)
          Returns a bound action for the given KeyStroke.
 javax.swing.Action[] getBoundActions()
          Gets all the actions that are bound by this KeyMap.
 javax.swing.KeyStroke[] getBoundKeyStrokes()
          Gets all the keystrokes that are bound by this KeyMap.
 javax.swing.Action getDefaultAction()
          Returns the default action for unbound keystrokes.
 javax.swing.KeyStroke[] getKeyStrokesForAction(javax.swing.Action a)
          Returns the KeyStrokes that execute the given action.
 java.lang.String getName()
          Returns the name of this keymap.
 javax.swing.text.Keymap getResolveParent()
          Returns the parent of this keymap.
 boolean isLocallyDefined(javax.swing.KeyStroke key)
          Returns true if a command is bound to the given key and it's currently available.
 void removeBindings()
          Clears the bindings in the keymap.
 void removeKeyStrokeBinding(javax.swing.KeyStroke keys)
          Clears a specific keystroke binding.
 void setDefaultAction(javax.swing.Action a)
          Sets the default action.
 void setResolveParent(javax.swing.text.Keymap parent)
          Sets the parent keymap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KawigiEditKeyMap

public KawigiEditKeyMap(Dispatcher editorSubDispatcher)
Constructs a KawigiEditKeyMap with the set of actions we bind to keystrokes in the editor. Uses editorSubDispatcher to create all the necessary actions.

Method Detail

addActionForKeyStroke

public void addActionForKeyStroke(javax.swing.KeyStroke key,
                                  javax.swing.Action a)
Binds an action to a keystroke.

Specified by:
addActionForKeyStroke in interface javax.swing.text.Keymap

getAction

public javax.swing.Action getAction(javax.swing.KeyStroke key)
Returns a bound action for the given KeyStroke.

Specified by:
getAction in interface javax.swing.text.Keymap

getBoundActions

public javax.swing.Action[] getBoundActions()
Gets all the actions that are bound by this KeyMap.

Specified by:
getBoundActions in interface javax.swing.text.Keymap

getBoundKeyStrokes

public javax.swing.KeyStroke[] getBoundKeyStrokes()
Gets all the keystrokes that are bound by this KeyMap.

Specified by:
getBoundKeyStrokes in interface javax.swing.text.Keymap

getDefaultAction

public javax.swing.Action getDefaultAction()
Returns the default action for unbound keystrokes.

Specified by:
getDefaultAction in interface javax.swing.text.Keymap

getKeyStrokesForAction

public javax.swing.KeyStroke[] getKeyStrokesForAction(javax.swing.Action a)
Returns the KeyStrokes that execute the given action.

Specified by:
getKeyStrokesForAction in interface javax.swing.text.Keymap

getName

public java.lang.String getName()
Returns the name of this keymap.

Specified by:
getName in interface javax.swing.text.Keymap

getResolveParent

public javax.swing.text.Keymap getResolveParent()
Returns the parent of this keymap.

Specified by:
getResolveParent in interface javax.swing.text.Keymap

isLocallyDefined

public boolean isLocallyDefined(javax.swing.KeyStroke key)
Returns true if a command is bound to the given key and it's currently available.

Specified by:
isLocallyDefined in interface javax.swing.text.Keymap

removeBindings

public void removeBindings()
Clears the bindings in the keymap.

Specified by:
removeBindings in interface javax.swing.text.Keymap

removeKeyStrokeBinding

public void removeKeyStrokeBinding(javax.swing.KeyStroke keys)
Clears a specific keystroke binding.

Specified by:
removeKeyStrokeBinding in interface javax.swing.text.Keymap

setDefaultAction

public void setDefaultAction(javax.swing.Action a)
Sets the default action.

Specified by:
setDefaultAction in interface javax.swing.text.Keymap

setResolveParent

public void setResolveParent(javax.swing.text.Keymap parent)
Sets the parent keymap.

Specified by:
setResolveParent in interface javax.swing.text.Keymap