Package com.iizix.term
Class KeyboardRemapper
java.lang.Object
com.iizix.term.KeyboardRemapper
- All Implemented Interfaces:
TerminalKeys
The keyboard remapper that maps KeyEvents to Send Keys.
Field Summary
Fields inherited from interface com.iizix.term.TerminalKeys
KEY_AlternateCursor, KEY_Attention, KEY_Backspace, KEY_BackwardWordTab, KEY_CapsLock, KEY_Clear, KEY_CmdKey, KEY_CursorDown, KEY_CursorDownFast, KEY_CursorLeft, KEY_CursorLeftFast, KEY_CursorRight, KEY_CursorRightFast, KEY_CursorSelect, KEY_CursorUp, KEY_CursorUpFast, KEY_Delete, KEY_DestructiveBackspace, KEY_Dup, KEY_End, KEY_Enter, KEY_EraseEOF, KEY_EraseInput, KEY_FieldExit, KEY_FieldMark, KEY_FieldMinus, KEY_FieldPlus, KEY_ForwardWordTab, KEY_Help, KEY_Home, KEY_Insert, KEY_InsertToggle, KEY_LeftTab, KEY_MinusSign, KEY_NewLine, KEY_PA1, KEY_PA2, KEY_PA3, KEY_PageDown, KEY_PageUp, KEY_PF1, KEY_PF10, KEY_PF11, KEY_PF12, KEY_PF13, KEY_PF14, KEY_PF15, KEY_PF16, KEY_PF17, KEY_PF18, KEY_PF19, KEY_PF2, KEY_PF20, KEY_PF21, KEY_PF22, KEY_PF23, KEY_PF24, KEY_PF3, KEY_PF4, KEY_PF5, KEY_PF6, KEY_PF7, KEY_PF8, KEY_PF9, KEY_PlusSign, KEY_Print, KEY_PrintPC, KEY_PrintPS, KEY_RecordBackspace, KEY_Reset, KEY_RightTab, KEY_Space, KEY_SystemRequest, KEY_Test, KEY_WordDelete
Constructor Summary
ConstructorDescriptionCreates a keyboard remapper with the defaults.Creates a keyboard remapper with the settings from another keyboard remapper.KeyboardRemapper
(XFile file) Initializes the keyboard map from a file.Method Summary
Modifier and TypeMethodDescriptionvoid
addKey
(int key, int[] augmentations) Adds a key with augmentations.static KeyboardRemapper
Creates a clone of the current manager.static int[]
getDefaultSendKeys
(int key) Gets default settings for a key.static int
getHostKey
(int index) Gets the host key value from an index.static int
getKeyFromName
(String name) Gets the key from a key name.static int
getKeyIndex
(int key) Gets the index of a key for the key names table.static String
getKeyName
(int key) Gets the name for a key.static String[]
Returns an enumeration of String object instance of all available key strings.int[]
getKeys()
Gets the array of defined keys.int[]
getSendKeys
(int key) Gets the send keys for all the augmentation keys assigned on a particular key.Gets the table for Terminal remap.static void
Initializes the keyboard map from a file.static void
Installs a new keyboard mapper as the current one.static void
installKeyboardRemapper
(KeyboardRemapper kr, boolean doLogEvent) Installs a new keyboard mapper as the current one.static int
mapToDefaultSendKey
(int key, boolean isShift, boolean isControl, boolean isAlt) Default keyboard remapper.static int
mapToSendKey
(int key, boolean isShift, boolean isControl, boolean isAlt) Default keyboard remapper.int
mapToSendKey2
(int key, boolean isShift, boolean isControl, boolean isAlt) Custom keyboard remapper.boolean
Saves the current definition to the default file "ProgramName.keyboardMap".void
writeToFile
(XOutputFile file) Writes the definition of the keyboard map to the file.
Constructor Details
KeyboardRemapper
public KeyboardRemapper()Creates a keyboard remapper with the defaults.KeyboardRemapper
Creates a keyboard remapper with the settings from another keyboard remapper. If the parameterKeyboardRemapper kr
is null, a default remapper is created.KeyboardRemapper
Initializes the keyboard map from a file.- Throws:
IOException
- when a file error occurs.
Method Details
initializeKeyboardRemapper
Initializes the keyboard map from a file.- Throws:
IOException
- when a file error occurs.
getKeyName
Gets the name for a key.- Returns:
- null if not found.
getKeyIndex
public static int getKeyIndex(int key) Gets the index of a key for the key names table.- Returns:
- -1 if not found.
getHostKey
public static int getHostKey(int index) Gets the host key value from an index.getKeyNames
Returns an enumeration of String object instance of all available key strings.getKeyFromName
Gets the key from a key name.- Returns:
- -1 if not found.
cloneCurrentKeyboardRemapper
Creates a clone of the current manager.installKeyboardRemapper
Installs a new keyboard mapper as the current one.installKeyboardRemapper
Installs a new keyboard mapper as the current one. ThedoLogEvent
flag will cause (or not) an event to be written in the event log.mapToSendKey
public static int mapToSendKey(int key, boolean isShift, boolean isControl, boolean isAlt) Default keyboard remapper.- Returns:
- the send key used by HostSession.sendKey, or -1 for no valid send key.
mapToDefaultSendKey
public static int mapToDefaultSendKey(int key, boolean isShift, boolean isControl, boolean isAlt) Default keyboard remapper.- Returns:
- the send key used by HostSession.sendKey, -1 for no valid send key.
getDefaultSendKeys
public static int[] getDefaultSendKeys(int key) Gets default settings for a key.mapToSendKey2
public int mapToSendKey2(int key, boolean isShift, boolean isControl, boolean isAlt) Custom keyboard remapper.- Returns:
- the send key used by HostSession.sendKey, -1 for no valid send key.
saveToFile
public boolean saveToFile()Saves the current definition to the default file "ProgramName.keyboardMap".writeToFile
Writes the definition of the keyboard map to the file.- Throws:
IOException
- when a file error occurs.
getKeys
public int[] getKeys()Gets the array of defined keys.getSendKeys
public int[] getSendKeys(int key) Gets the send keys for all the augmentation keys assigned on a particular key.The augmentation keys table:
0 - Shift=0, Control=0, Alt=0: No augmentation 1 - Shift=1, Control=0, Alt=0: Shift 2 - Shift=0, Control=1, Alt=0: Control 3 - Shift=1, Control=1, Alt=0: Shift+Control 4 - Shift=0, Control=0, Alt=1: Alt 5 - Shift=1, Control=0, Alt=1: Shift+Alt 6 - Shift=0, Control=1, Alt=1: Control+Alt 7 - Shift=1, Control=1, Alt=1: Shift+Control+Alt
addKey
public void addKey(int key, int[] augmentations) Adds a key with augmentations.getTerminalMap
Gets the table for Terminal remap.