|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjunit.extensions.jfcunit.keyboard.AbstractKeyMapping
Abstract key mapping is used to translate key codes
or characters into key strokes. Any characters or
key codes which do not map are dropped.
To create a new mapping:
1) extend this class
2) Define the Object[][]: See DefaultKeyMapping for example.
3) Create a default constructor that passes the code array
to this class.
4) Install the class into the AbstractKeyEventData by calling
AbstractKeyEventData.setKeyMapping(yourMapping)
Note: Not all key codes are valid on all systems with the Robot.
Invalid keycodes or modifiers for the OS will throw exceptions.
Extensions of this class can be used to allow users to map their
keyboard mappings.
| Field Summary | |
private java.util.HashMap |
m_mapChar
The hash map is used to quickly access the key strokes for characters. |
private java.util.HashMap |
m_mapCode
The hash map is used to quickly access the key strokes for codes. |
| Constructor Summary | |
AbstractKeyMapping(java.lang.Object[][] charMap)
Constructor that loads the two distinct mappings of the charMap into a HashMap for quick access. |
|
| Method Summary | |
JFCKeyStroke[] |
getKeyStrokes(char c)
Get the key codes required to construct the character. |
JFCKeyStroke[] |
getKeyStrokes(int keyCode)
Get the key strokes required to construct the keyCode. |
private JFCKeyStroke[] |
getKeyStrokes(java.lang.Object key,
java.util.HashMap map)
Get the key strokes form the mapping specified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private final java.util.HashMap m_mapChar
private final java.util.HashMap m_mapCode
| Constructor Detail |
public AbstractKeyMapping(java.lang.Object[][] charMap)
charMap - mapping to be loaded.| Method Detail |
public JFCKeyStroke[] getKeyStrokes(char c)
getKeyStrokes in interface KeyMappingc - Character to be constructed.
public JFCKeyStroke[] getKeyStrokes(int keyCode)
getKeyStrokes in interface KeyMappingkeyCode - Key code to be constructed.
JFCKeyStroke[] containing the key strokes
used to enter the key code.
private JFCKeyStroke[] getKeyStrokes(java.lang.Object key,
java.util.HashMap map)
key - Key object to be found.map - Map to look for the key in.
JFCKeyStroke[] array of key strokes copied from
the mapping.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||