com.raelity.jvi.swing
Class OpsBase

java.lang.Object
  extended by com.raelity.jvi.swing.OpsBase
All Implemented Interfaces:
TextOps

public class OpsBase
extends Object
implements TextOps

This provides default swings JEditorPane actions that are used by vi. Usually xop(int) is overridden for the environment. When overridden, the superclass should be invoked if given an unrecognized op. This implementation simply uses actions from the editor kit. The action names are taken from the default editor kit. The action map is built as needd, so if the same instance is used with different editors which have different actions, curious results could ensue.


Nested Class Summary
protected static class OpsBase.ReusableEvent
           
 
Field Summary
protected static Map<String,Action> actionMap
           
protected  OpsBase.ReusableEvent event
           
protected  ViTextView textView
           
 
Fields inherited from interface com.raelity.jvi.swing.TextOps
BEGIN_LINE, CURSOR_LEFT, CURSOR_RIGHT, CURSOR_TO_LINE, DELETE_PREVIOUS_CHAR, GOTO_LINE, INSERT_NEW_LINE, INSERT_TAB, INSERT_TEXT, KEY_TYPED
 
Constructor Summary
OpsBase(ViTextView textView)
          Creates a new instance of OpsBase
 
Method Summary
protected  Action findAction(String actionName)
           
 void init(JEditorPane editorPane)
           
 void xact(Action action)
           
 void xact(Action action, String s)
           
 void xact(String actionName)
           
protected  void xact(String actionName, String cmd)
           
 void xop(int op)
          Try to do something useful with the op.
 void xop(int op, String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

textView

protected ViTextView textView

event

protected OpsBase.ReusableEvent event

actionMap

protected static Map<String,Action> actionMap
Constructor Detail

OpsBase

public OpsBase(ViTextView textView)
Creates a new instance of OpsBase

Method Detail

init

public void init(JEditorPane editorPane)
Specified by:
init in interface TextOps

xact

public void xact(Action action)
Specified by:
xact in interface TextOps

xact

public void xact(Action action,
                 String s)
Specified by:
xact in interface TextOps

xop

public void xop(int op,
                String s)
Specified by:
xop in interface TextOps

xact

public void xact(String actionName)
Specified by:
xact in interface TextOps

xop

public void xop(int op)
Try to do something useful with the op.

Specified by:
xop in interface TextOps

xact

protected void xact(String actionName,
                    String cmd)

findAction

protected Action findAction(String actionName)