public class KeyProcessor
extends java.lang.Object
The keys generated by the driver are expected in the NCURSES-like format,
but to get Progress 4GL compatible key codes additional transformation
is required.
Following transformations are performed:
-The ESC key handled separately. When it appears in the input
from the driver, is is assumed that new ESC sequence is started. When
this happens further key codes (up to 4 in some special cases) are
collected in order to form complete sequence. When sequence is collected
it is translated into one of the Progress 4GL keys for further processing.
- The ESC-<ASCII letter> sequences are translated into
Ctrl+<ASCII letter> code by converting letter to upper case and adding
1024 (which marks pressed Control key).
Note that translation slightly varies from Progress here, because both,
lower and upper case letters are handled identically as upper case letters.
- Translated sequence then is checked for presence in the Keyboard
class internal mappings and if sequence is not present there it is rejected
and -1 is returned. If check is passed then resulting key is returned as result
of mapping.
- Special handling for the ESC-(91, 51, 126) sequence is performed on the
VT220 terminal. This sequence is handled as DELETE key if workaround is
enabled.
- Special keys (see OLD_VK_* constants below) are mapped into
appropriate Progress 4GL/P2J keys (Key
.VK_* constants)
- ENTER and CR are translated as VK_ENTER key.
Refer to Keyboard
class for more details about relationship between
key names and Progress 4GL/P2J codes.
Modifier and Type | Field and Description |
---|---|
private boolean |
escPressed
Was ESC key previously pressed.
|
private boolean |
handleVT220Delete
Flag which enables/disables VT220 DELETE key handling.
|
static int |
OLD_VK_BACK_SPACE |
static int |
OLD_VK_BACK_TAB |
static int |
OLD_VK_CTRL_G |
static int |
OLD_VK_CTRL_U |
static int |
OLD_VK_CTRL_Z |
static int |
OLD_VK_DELETE |
static int |
OLD_VK_DOWN |
static int |
OLD_VK_END |
static int |
OLD_VK_ENTER |
static int |
OLD_VK_ESCAPE |
static int |
OLD_VK_F1 |
static int |
OLD_VK_F10 |
static int |
OLD_VK_F11 |
static int |
OLD_VK_F12 |
static int |
OLD_VK_F13 |
static int |
OLD_VK_F14 |
static int |
OLD_VK_F15 |
static int |
OLD_VK_F16 |
static int |
OLD_VK_F17 |
static int |
OLD_VK_F18 |
static int |
OLD_VK_F19 |
static int |
OLD_VK_F2 |
static int |
OLD_VK_F20 |
static int |
OLD_VK_F3 |
static int |
OLD_VK_F4 |
static int |
OLD_VK_F5 |
static int |
OLD_VK_F6 |
static int |
OLD_VK_F7 |
static int |
OLD_VK_F8 |
static int |
OLD_VK_F9 |
static int |
OLD_VK_HOME |
static int |
OLD_VK_INSERT |
static int |
OLD_VK_LEFT |
static int |
OLD_VK_PAGE_DOWN |
static int |
OLD_VK_PAGE_UP |
static int |
OLD_VK_RIGHT |
static int |
OLD_VK_TAB |
static int |
OLD_VK_UP |
private int |
seqPtr
Pointer in the sequence array.
|
private int[] |
sequence
VT220 sends this sequence (after leading ESC) for DEL key.
|
Constructor and Description |
---|
KeyProcessor()
Constructor with the empty body.
|
Modifier and Type | Method and Description |
---|---|
int |
map(int key)
Maps curses key code to VK_ constants from
ProgressKeys
class. |
void |
setDelWorkaroundActive(boolean enable)
Enable/disable VT220 DELETE key workaround.
|
private int |
translate(int key)
Key translation worker.
|
public static final int OLD_VK_TAB
public static final int OLD_VK_ESCAPE
public static final int OLD_VK_CTRL_G
public static final int OLD_VK_CTRL_U
public static final int OLD_VK_CTRL_Z
public static final int OLD_VK_DOWN
public static final int OLD_VK_UP
public static final int OLD_VK_LEFT
public static final int OLD_VK_RIGHT
public static final int OLD_VK_HOME
public static final int OLD_VK_BACK_SPACE
public static final int OLD_VK_F1
public static final int OLD_VK_F2
public static final int OLD_VK_F3
public static final int OLD_VK_F4
public static final int OLD_VK_F5
public static final int OLD_VK_F6
public static final int OLD_VK_F7
public static final int OLD_VK_F8
public static final int OLD_VK_F9
public static final int OLD_VK_F10
public static final int OLD_VK_F11
public static final int OLD_VK_F12
public static final int OLD_VK_F13
public static final int OLD_VK_F14
public static final int OLD_VK_F15
public static final int OLD_VK_F16
public static final int OLD_VK_F17
public static final int OLD_VK_F18
public static final int OLD_VK_F19
public static final int OLD_VK_F20
public static final int OLD_VK_DELETE
public static final int OLD_VK_INSERT
public static final int OLD_VK_PAGE_DOWN
public static final int OLD_VK_PAGE_UP
public static final int OLD_VK_ENTER
public static final int OLD_VK_BACK_TAB
public static final int OLD_VK_END
private boolean handleVT220Delete
private int[] sequence
private int seqPtr
private boolean escPressed
public KeyProcessor()
public int map(int key)
ProgressKeys
class. This method is called only from keyboard reading thread so thread
safe is not required.key
- Original key code from curses.public void setDelWorkaroundActive(boolean enable)
enable
- true
- enable workaround.private int translate(int key)
key
- Raw keystroke from NCURSES