|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sshtools.terminal.VDUBuffer
com.sshtools.terminal.TerminalEmulation
A VDUBuffer extension that provides VT100, VT220, VT320 and ANSI emulation. Sequences returned from the host are interpreted and the buffer adjusted accordingly.
| Nested Class Summary |
| Nested classes inherited from class com.sshtools.terminal.VDUBuffer |
VDUBuffer.ResizeListener |
| Field Summary | |
static java.lang.String |
ANSI
Supported terminal type |
static java.lang.String |
DEFAULT_REMOTE_CHARSET
Default remote character set "ISO-8859-1" |
static int |
EOL_CR
Line ending type |
static int |
EOL_CR_LF
Line ending type |
static int |
EOL_DEFAULT
Line ending type |
static java.lang.String |
VT100
Supported terminal type |
static java.lang.String |
VT220
Supported terminal type |
static java.lang.String |
VT320
Supported terminal type |
| Fields inherited from class com.sshtools.terminal.VDUBuffer |
BOLD, bufSize, charArray, charAttributes, COLOR, COLOR_BG, COLOR_FG, cursorX, cursorY, display, fill, height, INVERT, listenerList, LOW, maxBufSize, NORMAL, screenBase, SCROLL_DOWN, SCROLL_UP, scrollMarker, showcursor, UNDERLINE, update, width, windowBase |
| Fields inherited from interface com.sshtools.terminal.VDUInput |
KEY_ACTION, KEY_ALT, KEY_CONTROL, KEY_SHIFT |
| Constructor Summary | |
TerminalEmulation(java.lang.String termType)
Construct a new TerminalEmulation given a terminal type and the VirtualTerminal it is being used with. |
|
TerminalEmulation(java.lang.String termType,
int width,
int height)
Construct a new TerminalEmulation given a terminal type, the VirtualTerminal it is being used with and a size. |
|
| Method Summary | |
void |
beep()
Beep the system bell (if present) |
void |
clearScreen()
Clear the screen |
boolean |
getAudibleBell()
Get whether there should be a audible warning when a BEL is received. |
java.net.URL |
getBeepAudioResource()
Set the location of the sound file to play in place of the system beep. |
java.lang.String |
getCharsetName()
Get terminal charset character set name. |
int |
getEOL()
Get the EOL (end of line) type. |
java.io.OutputStream |
getKeyboardOutputStream()
Get an OutputStream which can be used to write data into a terminal much like a keyboard. |
java.awt.Dimension |
getScreenSize()
Return the current size (in characters). |
static java.util.Vector |
getSupportedEmulations()
Return a Vector of supported terminal types for this emulator. |
java.io.InputStream |
getTerminalInputStream()
This InputStream contains the outgoing data from the terminal (such as keystrokes etc) and should typically be attached to the OutputStream of the underlying transport mechanism. |
java.io.OutputStream |
getTerminalOutputStream()
This OutputStream should receive all incoming data for the terminal (such as echo'd keystrokes and process output) and should typically be attached to the InputStream of the underlying transport mechanism. |
java.lang.String |
getTerminalType()
Get the terminal type. |
boolean |
isLocalEcho()
Get whether characters typed should also be echoed to the screen locally. |
boolean |
isReturnOnNewLine()
Get whether a carriage return should be output upon receiving a new line. |
boolean |
isShowCursor()
Get whether the cursor is being shown. |
boolean |
isVisibleBell()
Get whether there should be a visible warning when a BEL is received. |
void |
keyPressed(int keyCode,
char keyChar,
int modifiers)
A key has been pressed. |
void |
keyTyped(int keyCode,
char keyChar,
int modifiers)
A key has been typed. |
char |
map_cp850_unicode(char x)
|
void |
mousePressed(int x,
int y,
int modifiers)
A mouse button has been pressed. |
void |
mouseReleased(int x,
int y,
int modifiers)
A mouse button has been released. |
void |
putString(java.lang.String s)
Write a string to the terminal at the current cursor position |
java.lang.String |
readLine()
Read a line of text from the keyboard, echoing it on the screen and return whatever was type back as a string. |
void |
reset()
Hard-reset the terminal. |
protected void |
sendTelnetCommand(byte cmd)
|
void |
setAnswerBack(java.lang.String ab)
Set the string to send back to the host when the terminal receives an answer back request. |
void |
setAudibleBell(boolean audibleBell)
Set whether there should be a audible warning when a BEL is received. |
void |
setBeepAudioResource(java.net.URL beepAudioResource)
Set the location of the sound file to play in place of the system beep. |
void |
setCharsetName(java.lang.String charsetName)
Set terminal character set name. |
void |
setEOL(int eol)
Set the EOL (end of line) type. |
void |
setIBMCharset(boolean ibm)
Set whether to use the IBM character set |
void |
setKeyCodes(java.util.Properties codes)
The definition of key codes should only be done if your application uses a very different keyboard layout than the standard vt320. |
void |
setLocalEcho(boolean echo)
Set whether characters typed should also be echoed to the screen locally. |
void |
setReturnNewLine(boolean returnOnNewLine)
Set whether a carriage return should be output upon receiving a new line. |
void |
setTerminalType(java.lang.String termType)
Set the terminal type. |
void |
setVisibleBell(boolean visibleBell)
Set whether there should be a visible warning when a BEL is received. |
void |
setVMS(boolean vms)
Set whether the host is VMS. |
void |
startRecording(java.io.OutputStream recordingOutputStream)
|
void |
stopRecording()
|
void |
writeString(java.lang.String string)
Write some text to the terminal. |
| Methods inherited from class com.sshtools.terminal.VDUBuffer |
addResizeListener, deleteArea, deleteArea, deleteChar, deleteLine, fireResize, getAttributes, getBottomMargin, getBufferSize, getChar, getColumns, getCursorX, getCursorY, getLine, getMaxBufferSize, getRows, getTopMargin, getWindowBase, insertChar, insertLine, insertLine, insertLine, insertLine, markLine, putChar, putChar, putString, putString, redraw, removeResizeListener, setBottomMargin, setBufferSize, setCursorPosition, setDisplay, setScreenSize, setTopMargin, setWindowBase |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int EOL_DEFAULT
public static final int EOL_CR_LF
public static final int EOL_CR
public static final java.lang.String DEFAULT_REMOTE_CHARSET
public static final java.lang.String VT320
public static final java.lang.String VT220
public static final java.lang.String VT100
public static final java.lang.String ANSI
| Constructor Detail |
public TerminalEmulation(java.lang.String termType)
termType - terminal type TerminalEmulation.VT100 or
TerminalEmulation.VT220 or
TerminalEmulation.VT320 or
TerminalEmulation.ANSI.
public TerminalEmulation(java.lang.String termType,
int width,
int height)
termType - terminal type TerminalEmulation.VT100 or
TerminalEmulation.VT220 or
TerminalEmulation.VT320 or
TerminalEmulation.ANSI.width - width in characters of displayheight - height in characters of display| Method Detail |
public void setCharsetName(java.lang.String charsetName)
charsetName - character set name
java.lang.IllegalArgumentException - if unsupported encoding.public java.lang.String getCharsetName()
public static java.util.Vector getSupportedEmulations()
public java.lang.String readLine()
Read a line of text from the keyboard, echoing it on the screen and return whatever was type back as a string. This method will interrupt any I/O that is occuring on the streams thats have been set for this terminal and literally take over the terminal.
This may be useful if the caller wants input from the user that is to be used in a context other than a
public void setBeepAudioResource(java.net.URL beepAudioResource)
beepAudioResource - sound locationpublic java.net.URL getBeepAudioResource()
public void beep()
public void setVisibleBell(boolean visibleBell)
visibleBell - visible bellpublic boolean isVisibleBell()
public void setAudibleBell(boolean audibleBell)
audibleBell - audible bellpublic boolean getAudibleBell()
public void setEOL(int eol)
eol - line endings type TerminalEmulation.EOL_DEFAULT or
TerminalEmulation.EOL_CR_LF or
TerminalEmulation.EOL_DEFAULT.public int getEOL()
TerminalEmulation.EOL_DEFAULT or
TerminalEmulation.EOL_CR_LF or
TerminalEmulation.EOL_DEFAULT.public void setTerminalType(java.lang.String termType)
termType - terminal type TerminalEmulation.VT100 or
TerminalEmulation.VT220 or
TerminalEmulation.VT320 or
TerminalEmulation.ANSI.public java.lang.String getTerminalType()
TerminalEmulation.VT100 or
TerminalEmulation.VT220 or TerminalEmulation.VT320 or TerminalEmulation.ANSI.public void putString(java.lang.String s)
s - string to put to terminalprotected void sendTelnetCommand(byte cmd)
public java.io.OutputStream getKeyboardOutputStream()
VDUInput
getKeyboardOutputStream in interface VDUInputpublic java.io.OutputStream getTerminalOutputStream()
public java.io.InputStream getTerminalInputStream()
public void clearScreen()
public void startRecording(java.io.OutputStream recordingOutputStream)
public void stopRecording()
throws java.io.IOException
java.io.IOException
public void mousePressed(int x,
int y,
int modifiers)
VDUInput
mousePressed in interface VDUInputx - y - modifiers -
public void mouseReleased(int x,
int y,
int modifiers)
VDUInput
mouseReleased in interface VDUInputx - y - modifiers - public void setLocalEcho(boolean echo)
echo - local echopublic boolean isLocalEcho()
public void setVMS(boolean vms)
vms - vms hostpublic void setIBMCharset(boolean ibm)
ibm - IBM character setpublic void setKeyCodes(java.util.Properties codes)
VDUInputF1 = testCPGUP = pgup pressedAF12 = \\e
As you can see the string you can define may contain special characters
which may be escaped using the backslash (\). Allowed special characters
follow in the table below:
(Important: for some of the escape codes you need two backslashes as these
are our own definitions and not known by the Java Property mechanism)
Character Explanation
\\b Backspace, this character is usually sent by the <- key
(not the cursor left key!).
\\e Escape, this character is usually sent by the Esc key.
\n (only one backslash) Newline, this character will move the cursor
to a new line. On UNIX systems it is equivalent to carriage return + newline.
Usually the Enter key send this character.
\r (only one backslash) Carriage Return, this key moves the cursor
to the beginning of the line. In conjunction with Newline it moves the cursor
to the beginning of a new line.
\t (only one backslash) Tabulator, the tab character is sent by the
{key:->} key and moves the cursor to the next tab stop defined by the terminal.
\\v Vertical Tabulator, sends a vertical tabulator character.
\\a Bell, sends a terminal bell character which should make the
terminal sound its bell.
\number Inserts the character that is defined by this number in the ISO
Latin1 character set. The number should be a decimal value.
The following table explains which key may be redefined. As explained above
each of the keys may be prefixed by a character defining the redefinition
that occures if it is pressed in conjunction with the shift, control or alt keys.
Key Comments
F1 - F20 The function key, F1, F2 ... up to F20.
PGUP The Page Up key.
PGDOWN The Page Down key.
END The End key.
HOME The Home (Pos 1) key.
INSERT The Insert key.
REMOVE The Remove key.
UP The Cursor Up key.
DOWN The Cursor Down key.
LEFT The Cursor Left key.
RIGHT The Cursor right key.
NUMPAD0 The numbered Numpad keys.
...
NUMPAD9 The numbered Numpad keys.
ESCAPE The ESCAPE key.
BACKSPACE The backspace key.
TAB The tabulator key.
- Specified by:
setKeyCodes in interface VDUInput
- Parameters:
codes - properites object containing the key codes.
public void setAnswerBack(java.lang.String ab)
ab - answer back string
public void keyPressed(int keyCode,
char keyChar,
int modifiers)
VDUInput
keyPressed in interface VDUInputkeyCode - keyChar - modifiers -
public void keyTyped(int keyCode,
char keyChar,
int modifiers)
VDUInput
keyTyped in interface VDUInputkeyCode - keyChar - modifiers - public void reset()
public java.awt.Dimension getScreenSize()
public boolean isShowCursor()
isShowCursor in class VDUBufferpublic void writeString(java.lang.String string)
string - string to write to terminalpublic void setReturnNewLine(boolean returnOnNewLine)
returnOnNewLine - carriage return on new linepublic boolean isReturnOnNewLine()
public char map_cp850_unicode(char x)
x -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||