WISA.wisa3D.shell
Class Console

java.lang.Object
  |
  +--WISA.wisa3D.shell.Console

public class Console
extends java.lang.Object


Field Summary
protected  java.awt.Component component
           
protected  java.lang.Exception lastExc
           
 java.io.PrintStream out
           
protected static java.lang.String PROMPT
           
 
Constructor Summary
Console()
           
 
Method Summary
 void addCmdInfo(CmdInfo info)
          Add a CmdInfo to this Console.
 void addVar(java.lang.Object var, java.lang.String name)
          Add a variable to this Console.
protected  void clearCommandLine()
           
 void execute(java.lang.String cmd)
          Parses the given command and executes it if possible.
 java.awt.Color getBackground()
           
 CmdInfo getCmdInfo(java.lang.Object o)
          Get the first CmdInfo that accepts the given Object.
 java.awt.Component getComponent()
           
static Console getConsole()
          Construct a new Console if there was not yet any constructed or return the first one which was constructed in this VM.
 int getFontSize()
           
 java.awt.Color getForeground()
           
 int getRows()
           
 java.lang.Object getVar(java.lang.String name)
          Get the variable with the given name.
 void removeVar(java.lang.String name)
          Removes the variable with the given name from the variables of this Console.
 void setBackground(java.awt.Color color)
           
protected  void setCommandLine(java.lang.String cmd)
           
 void setFontSize(int size)
           
 void setForeground(java.awt.Color color)
           
 void setRows(int rows)
           
protected  int verifyCaretPosition()
          Verify the position of the caret.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastExc

protected java.lang.Exception lastExc

PROMPT

protected static final java.lang.String PROMPT
See Also:
Constant Field Values

component

protected java.awt.Component component

out

public java.io.PrintStream out
Constructor Detail

Console

public Console()
Method Detail

clearCommandLine

protected void clearCommandLine()

setCommandLine

protected void setCommandLine(java.lang.String cmd)

addVar

public void addVar(java.lang.Object var,
                   java.lang.String name)
            throws ConsoleException
Add a variable to this Console.

Parameters:
var - The variable to be added.
name - The name with which the variable can be referenced.
Throws:
ConsoleException - If a variable with the given name allready exists.

removeVar

public void removeVar(java.lang.String name)
Removes the variable with the given name from the variables of this Console.

Parameters:
name - The name of the variable to be removed.

getVar

public java.lang.Object getVar(java.lang.String name)
Get the variable with the given name.

Parameters:
name - The name of the variable.
Returns:
The variable with the given name or null if there is none.

addCmdInfo

public void addCmdInfo(CmdInfo info)
Add a CmdInfo to this Console.

Parameters:
info - The CmdInfo to be added.

getCmdInfo

public CmdInfo getCmdInfo(java.lang.Object o)
Get the first CmdInfo that accepts the given Object.

Parameters:
o - The Object to be accepted by the CmdInfo.
Returns:
The CmdInfo for the specified Object or null if there is none.

verifyCaretPosition

protected int verifyCaretPosition()
Verify the position of the caret. The position is valid if the caret is positioned after the last prompt. If the position is not valid it will be changed to a valid one.

Returns:
The verified caret position. The same like before if the position was valid.

getComponent

public java.awt.Component getComponent()

getConsole

public static Console getConsole()
Construct a new Console if there was not yet any constructed or return the first one which was constructed in this VM.

Returns:
Either a newly constructed Console or an existing.

execute

public void execute(java.lang.String cmd)
Parses the given command and executes it if possible.

Parameters:
cmd - The command to be executed.

setBackground

public void setBackground(java.awt.Color color)

getBackground

public java.awt.Color getBackground()

setForeground

public void setForeground(java.awt.Color color)

getForeground

public java.awt.Color getForeground()

setRows

public void setRows(int rows)

getRows

public int getRows()

setFontSize

public void setFontSize(int size)

getFontSize

public int getFontSize()