com.raelity.jvi.swing
Class CommandLine.CommandLineEntry

java.lang.Object
  extended by com.raelity.jvi.swing.CommandLine.CommandLineEntry
All Implemented Interfaces:
ViCmdEntry, ActionListener, EventListener
Direct Known Subclasses:
InlineCmdEntry, WindowCmdEntry
Enclosing class:
CommandLine

public abstract static class CommandLine.CommandLineEntry
extends Object
implements ViCmdEntry, ActionListener

The CommandLine JPanel may be embedded in a Dialog or put on a glass pane; CommandLineEntry is some common handling particularly for the ViCmdEntry interface.


Field Summary
protected  CommandLine commandLine
           
protected  int entryType
           
protected  String initialText
           
protected  String lastCommand
          result of last entry
protected  ActionListener listener
          reference back to the user of this entry widget
protected  ViTextView tv
           
 
Fields inherited from interface com.raelity.jvi.ViCmdEntry
COLON_ENTRY, SEARCH_ENTRY
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void activate(String mode, ViTextView parent)
          ViCmdEntry interface
 void activate(String mode, ViTextView tv, String initialText, boolean passThru)
          Start taking input.
 void addActionListener(ActionListener l)
          When command entry is complete, this listener is invoked.
 void append(char c)
          This method is used to append characters to the command line.
 void cancel()
          Stop command entry.
protected abstract  void finishActivate()
           
protected  void fireEvent(ActionEvent e)
          Send the event If it is a successful entry, a CR, then record the input.
 String getCommand()
          This is used to retrieve the command that was entered.
 JTextComponent getTextComponent()
          Retrieve the component used for the data entry.
protected  Rectangle positionCommandEntry(Component root, Component entry)
          Calculate the bounds for the entry component relative to the root component when placed immediately under the tv's editor.
protected abstract  void prepareShutdown()
           
 void removeActionListener(ActionListener l)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastCommand

protected String lastCommand
result of last entry


listener

protected ActionListener listener
reference back to the user of this entry widget


entryType

protected int entryType

commandLine

protected CommandLine commandLine

tv

protected ViTextView tv

initialText

protected String initialText
Method Detail

activate

public final void activate(String mode,
                           ViTextView parent)
ViCmdEntry interface

Specified by:
activate in interface ViCmdEntry

activate

public final void activate(String mode,
                           ViTextView tv,
                           String initialText,
                           boolean passThru)
Start taking input. As a side effect of invoking this, the variable is set.

Specified by:
activate in interface ViCmdEntry
tv - component associated with the entry
initialText - text widget starts out with this text
passThru - when true, fire action with initialText as the command

append

public void append(char c)
Description copied from interface: ViCmdEntry
This method is used to append characters to the command line. It is used to prevent lost characters that may occur between the character that initiates command entry and the time the entry field is ready to take characters.

Specified by:
append in interface ViCmdEntry

finishActivate

protected abstract void finishActivate()

prepareShutdown

protected abstract void prepareShutdown()

positionCommandEntry

protected Rectangle positionCommandEntry(Component root,
                                         Component entry)
Calculate the bounds for the entry component relative to the root component when placed immediately under the tv's editor.

Parameters:
root - the root, typically a JFrame
entry - the command entry widget
Returns:
bounds of the widget within the root

getCommand

public String getCommand()
Description copied from interface: ViCmdEntry
This is used to retrieve the command that was entered.

Specified by:
getCommand in interface ViCmdEntry

cancel

public void cancel()
Description copied from interface: ViCmdEntry
Stop command entry.

Specified by:
cancel in interface ViCmdEntry

getTextComponent

public JTextComponent getTextComponent()
Description copied from interface: ViCmdEntry
Retrieve the component used for the data entry.

Specified by:
getTextComponent in interface ViCmdEntry

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

fireEvent

protected void fireEvent(ActionEvent e)
Send the event If it is a successful entry, a CR, then record the input. Note that initial Text is not part of the recorded input.


addActionListener

public void addActionListener(ActionListener l)
                       throws TooManyListenersException
Description copied from interface: ViCmdEntry
When command entry is complete, this listener is invoked. The event is the key event that stopped entry, either a <CR> or an <ESC>. Only a single listener is needed.

Specified by:
addActionListener in interface ViCmdEntry
Throws:
TooManyListenersException

removeActionListener

public void removeActionListener(ActionListener l)
Specified by:
removeActionListener in interface ViCmdEntry