asquare.gwt.tk.client.util
Class KeyMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap
asquare.gwt.tk.client.util.KeyMap
- All Implemented Interfaces:
- Serializable, Cloneable, Map
public class KeyMap
- extends HashMap
A map that facilitates looking up which command is associated to a hot key.
Supports (char, Command) pairs. Similar to the Swing
ActionMap.
- See Also:
- Serialized Form
|
Method Summary |
boolean |
containsKey(char keyCode)
Determines if the map contains a mapping for the specified hot key. |
Command |
get(char keyCode)
Get the command to which the specified hot key is mapped. |
void |
put(char keyCode,
Command command)
Create a mapping between a hot key and a command. |
Command |
remove(char keyCode)
Remove a mapping for the specified hot key. |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
KeyMap
public KeyMap()
put
public void put(char keyCode,
Command command)
- Create a mapping between a hot key and a command. To ensure case
consistency across keypress and keydown/keyup events you can convert hot
key characters to upper-case before creating the mapping.
- Parameters:
keyCode - a keyboard shortcutcommand - a Command to associate with the hot key
containsKey
public boolean containsKey(char keyCode)
- Determines if the map contains a mapping for the specified hot key.
- Parameters:
keyCode - a keyboard shortcut
- Returns:
true if a mapping exists for keyCode
get
public Command get(char keyCode)
- Get the command to which the specified hot key is mapped.
- Parameters:
keyCode - a keyboard shortcut
- Returns:
- a Command or
null
remove
public Command remove(char keyCode)
- Remove a mapping for the specified hot key. Returns the previously mapped
command, if applicable.
- Parameters:
keyCode - a keyboard shortcut
- Returns:
- a Command or
null
© 2007 Mat Gessel