com.raelity.jvi.swing
Class DefaultViFactory

java.lang.Object
  extended by com.raelity.jvi.swing.DefaultViFactory
All Implemented Interfaces:
ViFactory

public class DefaultViFactory
extends Object
implements ViFactory

This provides the Vi items to interface with standard swing JEditorPane. NEEDSWORK:


Nested Class Summary
static class DefaultViFactory.EnqueCharAction
          This is the default key action.
static class DefaultViFactory.EnqueKeyAction
          Catch non-printing keys with this class.
 
Field Summary
protected  Map<Document,Object> docSet
           
protected  WeakHashMap<JEditorPane,Object> editorSet
           
protected static DefaultViFactory INSTANCE
           
static String PROP_BUF
           
static String PROP_VITV
           
 
Constructor Summary
DefaultViFactory()
           
 
Method Summary
 void commandEntryAssist(ViCmdEntry cmdEntry, boolean enable)
           
protected  Buffer createBuffer(ViTextView tv)
          subclass probably wants to override this
 Action createCharAction(String name)
           
 ViCmdEntry createCmdEntry(int type)
          A command entry object will be created if needed.
 Action createInsertModeKeyAction(String name, char vkey, String desc)
           
 Action createKeyAction(String name, char key)
           
 Action createNormalModeKeyAction(String name, int vkey, String desc)
           
 ViOutputStream createOutputStream(ViTextView tv, Object type, Object info, int priority)
          create an output stream for some kind of results.
 PropertyDescriptor createPropertyDescriptor(String optName, String methodName, Class clazz)
          Create a property descriptor.
protected  ViTextView createViTextView(JEditorPane editorPane)
          subclass probably wants to override this
 void displayTags()
           
 void finishTagPush(ViTextView tv)
           
 Buffer getBuffer(JEditorPane editorPane)
          Return a Buffer, create one if it doesn't already exist
 Set<Buffer> getBufferSet()
           
 String getDisplayFilename(Object o)
          For an environmental object, used for debug output
 ViTextView getExistingViTextView(Object editorPane)
           
 ViFS getFS()
          File manipulation handled through this object.
 Preferences getPreferences()
           
 ViTextView getViTextView(JEditorPane editorPane)
          Return a TextView, create one if it doesn't already exist
 Set<ViTextView> getViTextViewSet()
           
 boolean isStandalone()
           
 boolean isVisible(ViTextView tv)
           
 Class loadClass(String name)
           
 Window lookupWindow(JEditorPane editorPane)
          The factory keeps track of which Window is active when there is a switch.
 void registerEditorPane(JEditorPane editorPane)
          Register editor pane for use with vi.
 void shutdown(JEditorPane ep)
          This editor pane is going away, forget about it.
 void startGlassKeyCatch(KeyListener kl)
          Method to establish a glass pane with the param key listener and all mouse events are blocked.
 void startModalKeyCatch(KeyListener kl)
           
 void startTagPush(ViTextView tv, String ident)
           
 void stopGlassKeyCatch()
           
 void stopModalKeyCatch()
           
 void tagDialog(ColonCommands.ColonEvent e)
           
 void tagStack(ViTextView.TAGOP op, int count)
           
 ActionListener xlateKeymapAction(ActionListener act)
          The actions used for keymap translation may be munged by the environment so we need a way to get back the original action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

protected static DefaultViFactory INSTANCE

PROP_VITV

public static final String PROP_VITV
See Also:
Constant Field Values

PROP_BUF

public static final String PROP_BUF
See Also:
Constant Field Values

docSet

protected Map<Document,Object> docSet

editorSet

protected WeakHashMap<JEditorPane,Object> editorSet
Constructor Detail

DefaultViFactory

public DefaultViFactory()
Method Detail

loadClass

public Class loadClass(String name)
                throws ClassNotFoundException
Specified by:
loadClass in interface ViFactory
Throws:
ClassNotFoundException

isStandalone

public boolean isStandalone()
Specified by:
isStandalone in interface ViFactory
Returns:
true if standalone (debug), else false

getExistingViTextView

public ViTextView getExistingViTextView(Object editorPane)
Specified by:
getExistingViTextView in interface ViFactory
Returns:
null if TextView does not exist

getViTextView

public ViTextView getViTextView(JEditorPane editorPane)
Description copied from interface: ViFactory
Return a TextView, create one if it doesn't already exist

Specified by:
getViTextView in interface ViFactory

createViTextView

protected ViTextView createViTextView(JEditorPane editorPane)
subclass probably wants to override this


getViTextViewSet

public Set<ViTextView> getViTextViewSet()
Specified by:
getViTextViewSet in interface ViFactory
Returns:
Set of active ViTextView, some may have retired

isVisible

public boolean isVisible(ViTextView tv)
Specified by:
isVisible in interface ViFactory
Returns:
true if the argument ViTextView is visible

getBuffer

public Buffer getBuffer(JEditorPane editorPane)
Description copied from interface: ViFactory
Return a Buffer, create one if it doesn't already exist

Specified by:
getBuffer in interface ViFactory

createBuffer

protected Buffer createBuffer(ViTextView tv)
subclass probably wants to override this


getBufferSet

public Set<Buffer> getBufferSet()
Specified by:
getBufferSet in interface ViFactory
Returns:
Set of active Buffer, some may have retired

shutdown

public void shutdown(JEditorPane ep)
Description copied from interface: ViFactory
This editor pane is going away, forget about it.

Specified by:
shutdown in interface ViFactory

getFS

public ViFS getFS()
Description copied from interface: ViFactory
File manipulation handled through this object.

Specified by:
getFS in interface ViFactory

createOutputStream

public ViOutputStream createOutputStream(ViTextView tv,
                                         Object type,
                                         Object info,
                                         int priority)
Description copied from interface: ViFactory
create an output stream for some kind of results.

Specified by:
createOutputStream in interface ViFactory
type - Should be a constant from ViOutputStream, e.g. ViOutputStream.SEARCH.
info - qualifier for the output stream, e.g. search pattern.
priority - 0 - 10 where 0 is lowest priority, 5 is normal, 0-2 is low, don't raise window.

startGlassKeyCatch

public void startGlassKeyCatch(KeyListener kl)
Method to establish a glass pane with the param key listener and all mouse events are blocked. This is not modal, in particular the event thread is still running, but it blocks the current window.

Specified by:
startGlassKeyCatch in interface ViFactory

stopGlassKeyCatch

public void stopGlassKeyCatch()
Specified by:
stopGlassKeyCatch in interface ViFactory

startModalKeyCatch

public void startModalKeyCatch(KeyListener kl)
Specified by:
startModalKeyCatch in interface ViFactory

stopModalKeyCatch

public void stopModalKeyCatch()
Specified by:
stopModalKeyCatch in interface ViFactory

registerEditorPane

public void registerEditorPane(JEditorPane editorPane)
Register editor pane for use with vi. Install a vi cursor. This is a nop if already registered.

Specified by:
registerEditorPane in interface ViFactory

lookupWindow

public Window lookupWindow(JEditorPane editorPane)
Description copied from interface: ViFactory
The factory keeps track of which Window is active when there is a switch. The argument may or may not be used depending on the implementation.

Specified by:
lookupWindow in interface ViFactory
Returns:
the Window for the specified editor

createPropertyDescriptor

public PropertyDescriptor createPropertyDescriptor(String optName,
                                                   String methodName,
                                                   Class clazz)
                                            throws IntrospectionException
Description copied from interface: ViFactory
Create a property descriptor. Typically for an option bean.

Specified by:
createPropertyDescriptor in interface ViFactory
Returns:
Throws:
IntrospectionException

createCmdEntry

public ViCmdEntry createCmdEntry(int type)
Description copied from interface: ViFactory
A command entry object will be created if needed.

Specified by:
createCmdEntry in interface ViFactory
Returns:
a CmdEntry object to handle the specified type of user input.

createCharAction

public Action createCharAction(String name)
Specified by:
createCharAction in interface ViFactory
Returns:
action suitable for default key action

createKeyAction

public Action createKeyAction(String name,
                              char key)
Specified by:
createKeyAction in interface ViFactory
Returns:
action for picking up specified key

createInsertModeKeyAction

public Action createInsertModeKeyAction(String name,
                                        char vkey,
                                        String desc)
Specified by:
createInsertModeKeyAction in interface ViFactory
Returns:
edit mode action for specific operation

createNormalModeKeyAction

public Action createNormalModeKeyAction(String name,
                                        int vkey,
                                        String desc)
Specified by:
createNormalModeKeyAction in interface ViFactory
Returns:
normal mode action for specific operation

xlateKeymapAction

public ActionListener xlateKeymapAction(ActionListener act)
Description copied from interface: ViFactory
The actions used for keymap translation may be munged by the environment so we need a way to get back the original action.

Specified by:
xlateKeymapAction in interface ViFactory

getPreferences

public Preferences getPreferences()
Specified by:
getPreferences in interface ViFactory

getDisplayFilename

public String getDisplayFilename(Object o)
Description copied from interface: ViFactory
For an environmental object, used for debug output

Specified by:
getDisplayFilename in interface ViFactory

startTagPush

public void startTagPush(ViTextView tv,
                         String ident)
Specified by:
startTagPush in interface ViFactory

finishTagPush

public void finishTagPush(ViTextView tv)
Specified by:
finishTagPush in interface ViFactory

tagStack

public void tagStack(ViTextView.TAGOP op,
                     int count)
Specified by:
tagStack in interface ViFactory

displayTags

public void displayTags()
Specified by:
displayTags in interface ViFactory

tagDialog

public void tagDialog(ColonCommands.ColonEvent e)
Specified by:
tagDialog in interface ViFactory

commandEntryAssist

public void commandEntryAssist(ViCmdEntry cmdEntry,
                               boolean enable)
Specified by:
commandEntryAssist in interface ViFactory