abbot.tester
Class KeyStrokeMap

java.lang.Object
  extended by abbot.tester.KeyStrokeMap
All Implemented Interfaces:
KeyStrokeMapProvider
Direct Known Subclasses:
MapGenerator

public class KeyStrokeMap
extends Object
implements KeyStrokeMapProvider

Provides read of local-specific mappings for virtual keycode-based KeyStrokes to characters and vice versa. The map format is a properties file with each line containing an entry of the form
VKNAME.MOD=VALUE
The VKNAME is the String suffix of the KeyEvent VK_ keycode. MOD is the integer value of the current modifier mask (assumes only a single modifier has any effect on key output, interesting values are considered to be 0, 1, 2, 8). VALUE is the char value of the KEY_TYPED keyChar corresponding to the VK_ keycode and modifiers, as an integer value.


Constructor Summary
KeyStrokeMap()
           
 
Method Summary
static char getChar(KeyStroke ks)
          Given a keycode-based KeyStroke, return the equivalent character.
protected static String getFilename(String base)
          Convert a String containing a unique identifier for the map into a unique filename.
static KeyStroke getKeyStroke(char ch)
          Return the keycode-based KeyStroke corresponding to the given character, as best we can guess it, or null if we don't know how to generate it.
protected static String[] getMapDescriptions()
           
protected static String[] getMapNames()
           
 Map loadCharacterMap()
          Load a map for the current locale to translate a character into a corresponding virtual keycode-based KeyStroke.
 Map loadKeyStrokeMap()
          Load a map for the current locale to translate a virtual keycode into a character-based KeyStroke.
static void main(String[] args)
          Return currently available locales.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyStrokeMap

public KeyStrokeMap()
Method Detail

getKeyStroke

public static KeyStroke getKeyStroke(char ch)
Return the keycode-based KeyStroke corresponding to the given character, as best we can guess it, or null if we don't know how to generate it.


getChar

public static char getChar(KeyStroke ks)
Given a keycode-based KeyStroke, return the equivalent character. Defined properly for US keyboards only. Please contribute your own.

Returns:
KeyEvent.VK_UNDEFINED if the result is unknown.

loadCharacterMap

public Map loadCharacterMap()
Load a map for the current locale to translate a character into a corresponding virtual keycode-based KeyStroke.

Specified by:
loadCharacterMap in interface KeyStrokeMapProvider

loadKeyStrokeMap

public Map loadKeyStrokeMap()
Load a map for the current locale to translate a virtual keycode into a character-based KeyStroke.

Specified by:
loadKeyStrokeMap in interface KeyStrokeMapProvider

getFilename

protected static String getFilename(String base)
Convert a String containing a unique identifier for the map into a unique filename.


getMapNames

protected static String[] getMapNames()

getMapDescriptions

protected static String[] getMapDescriptions()

main

public static void main(String[] args)
Return currently available locales.



Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge