|
|||||||||
| Home >> All >> org >> jext >> [ console overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.jext.console
Class Console

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JScrollPane
org.jext.console.Console
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.ScrollPaneConstants, java.io.Serializable
- public class Console
- extends javax.swing.JScrollPane
An internal console which provide different kinds of
prompts and which allows to execute both internal and
external (OS specific) commands. The console is embedded
in a JScrollPane and handles it by itself.
| Nested Class Summary | |
private class |
Console.Appender
|
(package private) class |
Console.ConsoleProcess
|
| Nested classes inherited from class javax.swing.JScrollPane |
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private boolean |
alwaysAllowType
|
private static java.lang.String |
COMPLETION_SEPARATORS
|
private Console.ConsoleProcess |
cProcess
|
private java.lang.String |
current
|
private org.jext.console.commands.Command |
currentCmd
|
static java.lang.String[] |
DEFAULT_PROMPTS
Default prompt types: DOS, Jext, Linux and SunOS |
private boolean |
displayPath
|
static int |
DOS_PROMPT
DOS prompt: /export/home/guy > |
java.awt.Color |
errorColor
|
private org.jext.console.commands.Command |
evalCom
|
private org.jext.console.commands.Command |
firstCmd
|
private HistoryModel |
historyModel
|
private java.lang.String |
hostName
|
private int |
index
If the command is taken from the history, this is its position inside it: 0 for the last command, 1 for the one before and so on; if it's -1, the command doesn't come from the history. |
java.awt.Color |
infoColor
|
static int |
JEXT_PROMPT
Jext prompt: Gfx@/export/home/guy > |
static int |
LINUX_PROMPT
Linux prompt: guy@csdlyon$ |
private java.lang.String |
oldPath
|
java.awt.Color |
outputColor
|
private javax.swing.text.Document |
outputDocument
|
private org.jext.JextFrame |
parent
|
private InteractiveInterpreter |
parser
This parser is used as interpreter for the Jython mode |
private java.lang.String |
prompt
|
java.awt.Color |
promptColor
|
private java.lang.String |
promptPattern
|
private java.lang.StringBuffer |
pythonBuf
This buffer stores the incomplete Python command lines |
static int |
SUNOS_PROMPT
SunOS prompt: csdlyon% |
private ConsoleTextPane |
textArea
|
private int |
typingLocation
This is where the user-typed text that hasn't still be accepted ends. |
private int |
userLimit
This is the point from where starts the text the user can edit. |
private java.io.Writer |
writerSTDOUT
|
private java.io.Writer |
writeSTDERR
|
| Fields inherited from class javax.swing.JScrollPane |
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
Console(org.jext.JextFrame parent)
Instanciates a new console without displaying prompt. |
|
Console(org.jext.JextFrame parent,
boolean display)
Creates a new console, embedding it in a JScrollPane. |
|
| Method Summary | |
void |
add(java.lang.String add)
Adds a String to the current command line. |
void |
addCommand(org.jext.console.commands.Command command)
Adds a command to the linked list of commands. |
void |
addHistory(java.lang.String command)
Adds a command to the history. |
void |
append(java.lang.String text,
java.awt.Color color)
This method appends text in the text area. |
private void |
append(java.lang.String text,
java.awt.Color color,
boolean italic,
boolean bold)
This method appends text in the text area. |
private void |
buildPrompt()
|
private boolean |
builtInCommand(java.lang.String command)
Return true if command is built-in. |
void |
deleteChar()
Delete a char from command line. |
void |
displayPrompt()
Displays the prompt according to the current selected prompt type. |
void |
doBackwardSearch()
Search backward in the history for a matching command, according to the command typed in the user typing space. |
void |
doCompletion()
Completes current filename if possible. |
void |
error(java.lang.String display)
Display a message using error color. |
void |
execute(java.lang.String command)
Execute command. |
protected void |
finalize()
Patch -> Memory management improvements : it may help the garbage collector. |
javax.swing.text.Document |
getOutputDocument()
Return the Document in which output is performed. |
org.jext.JextFrame |
getParentFrame()
Returns this Console's parent. |
java.lang.String |
getPromptPattern()
Get prompt pattern. |
java.io.Writer |
getStdErr()
Returns a writer in which external classes can send String to make them being displayed in the
console as error output. |
java.io.Writer |
getStdOut()
Returns a writer in which external classes can send String to make them being displayed in the
console as standard output. |
java.lang.String |
getText()
Returns current command line. |
int |
getTypingLocation()
Returns the position of the end of the console prompt. |
int |
getUserLimit()
Returns the position in characters at which user is allowed to type his commands. |
void |
help()
Displays console help. |
void |
help(java.lang.String display)
Display a message using help color. |
void |
historyNext()
Get next item in the history list. |
void |
historyPrevious()
Get previous item in the history list. |
void |
info(java.lang.String display)
Display a message using information color. |
private void |
initCommands()
|
void |
load()
Load the last saved history. |
void |
output(java.lang.String display)
Display a message using output color. |
java.lang.String |
parseCommand(java.lang.String command)
Parse a command. |
void |
removeChar()
Remove a char from current command line. |
void |
save()
Save the history. |
void |
setBgColor(java.awt.Color color)
Set console background color. |
void |
setErrorColor(java.awt.Color color)
Set console error color. |
void |
setInfoColor(java.awt.Color color)
Set console info color. |
void |
setOutputColor(java.awt.Color color)
Set console output color. |
void |
setPromptColor(java.awt.Color color)
Set console prompt color. |
void |
setPromptPattern(java.lang.String prompt)
Set the prompt pattern. |
void |
setSelectionColor(java.awt.Color color)
Set console selection color. |
void |
setText(java.lang.String text)
Set user's command line content. |
void |
stop()
Stops current task. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
DOS_PROMPT
public static final int DOS_PROMPT
- DOS prompt: /export/home/guy >
- See Also:
- Constant Field Values
JEXT_PROMPT
public static final int JEXT_PROMPT
- Jext prompt: Gfx@/export/home/guy >
- See Also:
- Constant Field Values
LINUX_PROMPT
public static final int LINUX_PROMPT
- Linux prompt: guy@csdlyon$
- See Also:
- Constant Field Values
SUNOS_PROMPT
public static final int SUNOS_PROMPT
- SunOS prompt: csdlyon%
- See Also:
- Constant Field Values
DEFAULT_PROMPTS
public static final java.lang.String[] DEFAULT_PROMPTS
- Default prompt types: DOS, Jext, Linux and SunOS
COMPLETION_SEPARATORS
private static final java.lang.String COMPLETION_SEPARATORS
- See Also:
- Constant Field Values
currentCmd
private org.jext.console.commands.Command currentCmd
firstCmd
private org.jext.console.commands.Command firstCmd
parent
private org.jext.JextFrame parent
cProcess
private Console.ConsoleProcess cProcess
parser
private InteractiveInterpreter parser
- This parser is used as interpreter for the Jython mode
pythonBuf
private java.lang.StringBuffer pythonBuf
- This buffer stores the incomplete Python command lines
current
private java.lang.String current
outputDocument
private javax.swing.text.Document outputDocument
textArea
private ConsoleTextPane textArea
historyModel
private HistoryModel historyModel
userLimit
private int userLimit
- This is the point from where starts the text the user can edit. The text
before was either output or (from the user but accepted with <Enter>)
typingLocation
private int typingLocation
- This is where the user-typed text that hasn't still be accepted ends. If it's
before the document length, the user cannot type.
index
private int index
- If the command is taken from the history, this is its position inside it:
0 for the last command, 1 for the one before and so on; if it's -1, the command
doesn't come from the history.
errorColor
public java.awt.Color errorColor
promptColor
public java.awt.Color promptColor
outputColor
public java.awt.Color outputColor
infoColor
public java.awt.Color infoColor
displayPath
private boolean displayPath
prompt
private java.lang.String prompt
hostName
private java.lang.String hostName
oldPath
private java.lang.String oldPath
promptPattern
private java.lang.String promptPattern
alwaysAllowType
private boolean alwaysAllowType
evalCom
private org.jext.console.commands.Command evalCom
writerSTDOUT
private java.io.Writer writerSTDOUT
writeSTDERR
private java.io.Writer writeSTDERR
| Constructor Detail |
Console
public Console(org.jext.JextFrame parent)
- Instanciates a new console without displaying prompt.
Console
public Console(org.jext.JextFrame parent, boolean display)
- Creates a new console, embedding it in a
JScrollPane. By default console help is displayed.
| Method Detail |
getParentFrame
public org.jext.JextFrame getParentFrame()
- Returns this Console's parent.
getOutputDocument
public javax.swing.text.Document getOutputDocument()
- Return the
Documentin which output is performed.
addCommand
public void addCommand(org.jext.console.commands.Command command)
- Adds a command to the linked list of commands.
builtInCommand
private boolean builtInCommand(java.lang.String command)
- Return true if command is built-in. If command is built-in,
it is also executed.
initCommands
private void initCommands()
setBgColor
public void setBgColor(java.awt.Color color)
- Set console background color.
setErrorColor
public void setErrorColor(java.awt.Color color)
- Set console error color.
setPromptColor
public void setPromptColor(java.awt.Color color)
- Set console prompt color.
setOutputColor
public void setOutputColor(java.awt.Color color)
- Set console output color.
setInfoColor
public void setInfoColor(java.awt.Color color)
- Set console info color.
setSelectionColor
public void setSelectionColor(java.awt.Color color)
- Set console selection color.
save
public void save()
- Save the history.
load
public void load()
- Load the last saved history.
setPromptPattern
public void setPromptPattern(java.lang.String prompt)
- Set the prompt pattern.
getPromptPattern
public java.lang.String getPromptPattern()
- Get prompt pattern.
displayPrompt
public void displayPrompt()
- Displays the prompt according to the current selected
prompt type.
buildPrompt
private void buildPrompt()
append
private void append(java.lang.String text, java.awt.Color color, boolean italic, boolean bold)
- This method appends text in the text area.
append
public void append(java.lang.String text, java.awt.Color color)
- This method appends text in the text area.
addHistory
public void addHistory(java.lang.String command)
- Adds a command to the history.
removeChar
public void removeChar()
- Remove a char from current command line.
Stands for BACKSPACE action.
deleteChar
public void deleteChar()
- Delete a char from command line.
Stands for DELETE action.
add
public void add(java.lang.String add)
- Adds a
Stringto the current command line.
getUserLimit
public int getUserLimit()
- Returns the position in characters at which
user is allowed to type his commands.
getTypingLocation
public int getTypingLocation()
- Returns the position of the end of the console prompt.
doCompletion
public void doCompletion()
- Completes current filename if possible.
doBackwardSearch
public void doBackwardSearch()
- Search backward in the history for a matching command,
according to the command typed in the user typing space.
historyPrevious
public void historyPrevious()
- Get previous item in the history list.
historyNext
public void historyNext()
- Get next item in the history list.
setText
public void setText(java.lang.String text)
- Set user's command line content.
getText
public java.lang.String getText()
- Returns current command line.
help
public void help()
- Displays console help.
info
public void info(java.lang.String display)
- Display a message using information color.
- Since:
- Jext3.2pre4
help
public void help(java.lang.String display)
- Display a message using help color.
error
public void error(java.lang.String display)
- Display a message using error color.
output
public void output(java.lang.String display)
- Display a message using output color.
stop
public void stop()
- Stops current task.
parseCommand
public java.lang.String parseCommand(java.lang.String command)
- Parse a command. Replace internal variables by their
values.
execute
public void execute(java.lang.String command)
- Execute command. First parse it then check if command
is built-in. At last, a process is created and threads
which handle output streams are started.
getStdOut
public java.io.Writer getStdOut()
- Returns a writer in which external classes can send
Stringto make them being displayed in the console as standard output.
getStdErr
public java.io.Writer getStdErr()
- Returns a writer in which external classes can send
Stringto make them being displayed in the console as error output.
finalize
protected void finalize()
throws java.lang.Throwable
- Patch
-> Memory management improvements : it may help the garbage collector.
-> Author : Julien Ponge (julien@izforge.com)
-> Date : 23, May 2001
|
|||||||||
| Home >> All >> org >> jext >> [ console overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC