com.sshtools.terminal
Interface VDUInput

All Known Implementing Classes:
TerminalEmulation

public interface VDUInput

Defines the general contract for terminal input.

Version:
$Revision: 1.1 $
Author:
$author$

Field Summary
static int KEY_ACTION
           
static int KEY_ALT
           
static int KEY_CONTROL
           
static int KEY_SHIFT
           
 
Method Summary
 java.io.OutputStream getKeyboardOutputStream()
          Get an OutputStream which can be used to write data into a terminal much like a keyboard.
 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.
 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 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.
 

Field Detail

KEY_CONTROL

public static final int KEY_CONTROL
See Also:
Constant Field Values

KEY_SHIFT

public static final int KEY_SHIFT
See Also:
Constant Field Values

KEY_ALT

public static final int KEY_ALT
See Also:
Constant Field Values

KEY_ACTION

public static final int KEY_ACTION
See Also:
Constant Field Values
Method Detail

getKeyboardOutputStream

public java.io.OutputStream getKeyboardOutputStream()
Get an OutputStream which can be used to write data into a terminal much like a keyboard.

Returns:

mousePressed

public void mousePressed(int x,
                         int y,
                         int modifiers)
A mouse button has been pressed.

Parameters:
x -
y -
modifiers -

mouseReleased

public void mouseReleased(int x,
                          int y,
                          int modifiers)
A mouse button has been released.

Parameters:
x -
y -
modifiers -

setKeyCodes

public 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. The definition of almost all special keys is possible and follows rules described below:

[SCA] KEY=STRING

The characters enclosed in [ and ] are optional and only one of the characters 'S' (Shift), 'C' (Control) or 'A' (Alt) may appear before the KEY, which is a textual representation (F1, PGUP etc) of the key you would like to redefine.

The new STRING you define to be sent when pressing the key should come after the equal sign (=). Hash marks (#) in the file declare a line as comment and will be ignored. Some examples explain the syntax:

Send the string "test" when pressing the F1 key:

F1 = test

On pressing Control + PGUP send the string "pgup pressed":

CPGUP = pgup pressed

Redefine the key Alt + F12 to send an escape character:

AF12 = \\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.

Parameters:
codes - properites object containing the key codes.

keyPressed

public void keyPressed(int keyCode,
                       char keyChar,
                       int modifiers)
A key has been pressed.

Parameters:
keyCode -
keyChar -
modifiers -

keyTyped

public void keyTyped(int keyCode,
                     char keyChar,
                     int modifiers)
A key has been typed.

Parameters:
keyCode -
keyChar -
modifiers -


Copyright © 2003-2004 3SP LTD. All Rights Reserved.