|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.keystroke.KeyStrokeMappingsParser
public class KeyStrokeMappingsParser
Understands creation of
s by parsing a text file.
KeyStrokeMapping
Mappings for the following characters:
The following is an example of a mapping file:
a, A, NO_MASK A, A, SHIFT_MASK COMMA, COMMA, NO_MASKEach line represents a character-keystroke mapping where each value is separated by a comma.
The first value represents the character to map. For example 'a' or 'A'. Since each field is separated by a comma, to map the ',' character we need to specify the text "COMMA."
The second value represents the key code, which should be the name of a key code from
without the prefix "VK_". For example, if the key code is KeyEvent
we just need to
specify "COMMA".
KeyEvent.VK_COMMA
The third value represents any modifiers to use, which should be the name of a modifier from
. For example, if the modifier to use is InputEvent
we
need to specify "SHIFT_MASK". If no modifiers are necessary, we just specify "NO_MASK".
InputEvent.SHIFT_MASK
Constructor Summary | |
---|---|
KeyStrokeMappingsParser()
|
Method Summary | |
---|---|
KeyStrokeMappingProvider |
parse(File file)
Creates a containing all the character-keystroke mappings specified
in the given file. |
KeyStrokeMappingProvider |
parse(String file)
Creates a containing all the character-keystroke mappings specified
in the file with the given name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyStrokeMappingsParser()
Method Detail |
---|
public KeyStrokeMappingProvider parse(String file)
KeyStrokeMappingProvider
containing all the character-keystroke mappings specified
in the file with the given name.
Note: This attempts to read the file using
.
ClassLoader.getResourceAsStream(String)
file
- the name of the file to parse.
KeyStrokeMappingProvider
.
NullPointerException
- if the given name is null
.
IllegalArgumentException
- if the given name is empty.
ParsingException
- if any error occurs during parsing.parse(File)
public KeyStrokeMappingProvider parse(File file)
KeyStrokeMappingProvider
containing all the character-keystroke mappings specified
in the given file.
file
- the file to parse.
KeyStrokeMappingProvider
.
NullPointerException
- if the given file is null
.
IllegalArgumentException
- if the given file does not represent an existing file.
ParsingException
- if any error occurs during parsing.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |