|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
An instance of this class which allows building a
instance from the string representations of a key code and modifiers.
Please refer to the documentation of the KeyStroke
method for more information regarding these string representations formats.
The aim of this class is to provide a mean for developers to define commands
short cut keys through property files.
buildKeyStroke(String, String)
| Nested Class Summary | |
static class |
KeyStrokeBuilder.keyStrokeBuilderException
Exception indicating that an error occured when trying to build a
with an instance of
|
| Field Summary | |
static java.lang.String |
KEYCODE_PREFIX
Constant representing the keycodes' prefix |
static java.lang.String |
KEYSTROKE_CLASS
Constant representing the KeyStroke class' full name |
static java.lang.String |
MODIFIER_SUFFIX
Constant representing the modifiers' suffix |
static java.lang.String |
MODIFIERS_SEPARATOR
Constant representing the separator used for modifiers in the property files |
static java.lang.String[] |
VALID_MODIFIERS
Constant defining the possible KeyStroke modifiers |
| Method Summary | |
boolean |
assertModifier(java.lang.String modifier)
Simple utility method returning true if the parameter is
a valid modifier, false otherwise.
|
KeyStroke |
buildKeyStroke(java.lang.String keyCode,
java.lang.String modifiers)
This method builds and returns a
instance using the passed string representation of keycode and
modifiers. |
int |
retrieveKeycodeIntValue(java.lang.String keycode)
This method accepts the string representation of a key code as parameter and returns the corresponding integer representation. |
int |
retrieveModifiersIntValue(java.lang.String modifiers)
This method accepts the string representation of modifiers as parameter and returns the corresponding integer representation. |
| Field Detail |
public static final java.lang.String KEYSTROKE_CLASS
public static final java.lang.String KEYCODE_PREFIX
public static final java.lang.String MODIFIER_SUFFIX
public static final java.lang.String MODIFIERS_SEPARATOR
public static final java.lang.String[] VALID_MODIFIERS
| Method Detail |
public int retrieveKeycodeIntValue(java.lang.String keycode)
throws KeyStrokeBuilder.keyStrokeBuilderException
This method accepts the string representation of a key code as parameter
and returns the corresponding integer representation. The integer
representation is in fact the corresponding constant value of the
class. Note that there is a tight coupling between the valid 'keycode'
parameters accepted by this method and the constants starting with the
prefix KeyEvent in the KEYCODE_PREFIX
class. Valid parameters should have a corresponding value in KeyEvent,
when the prefix KeyEvent is added at their
beginning.
KEYCODE_PREFIX
keycode - this is the String representation of a key code.
KeyEvent
class.
KeyStrokeBuilder.keyStrokeBuilderException - this exception is thrown if the routine fails. It should
however not happen.public boolean assertModifier(java.lang.String modifier)
Simple utility method returning true if the parameter is
a valid modifier, false otherwise.
modifier - this is the String representation for a modifier.
true if the parameter is a valid modifier, false
otherwise.{@link #VALID_MODIFIERS}
public int retrieveModifiersIntValue(java.lang.String modifiers)
throws KeyStrokeBuilder.keyStrokeBuilderException
This method accepts the string representation of modifiers as parameter
and returns the corresponding integer representation. The integer
representation is in fact the corresponding constant value of the
class. Note that there is a tight
coupling between the valid 'modifiers' parameters accepted by this method
and constants defined in the KeyStroke class.
KeyStroke
KeyStroke.CTRL_MASK
KeyStroke.ALT_MASK
KeyStroke.SHIFT_MASK
KeyStroke.ALT_GRAPH_MASK
KeyStroke.META_MASK
KeyStroke.NO_MASK
VALID_MODIFIERS. Modifiers must be separated
with the MODIFIERS_SEPARATOR separator.
modifiers - a String representation of modifiers.
KeyStrokeBuilder.keyStrokeBuilderException - this exception is thrown if the routine fails. It should
however not happen.
public KeyStroke buildKeyStroke(java.lang.String keyCode,
java.lang.String modifiers)
throws KeyStrokeBuilder.keyStrokeBuilderException
This method builds and returns a
instance using the passed string representation of keycode and
modifiers. See KeyStroke
and retrieveKeycodeIntValue(String) for more
information regarding the parameters valid formats.
retrieveModifiersIntValue(String)
keyCode - a string representation of a key codemodifiers - a string representation of modifiers
KeyStroke instance
KeyStrokeBuilder.keyStrokeBuilderException - this exception is thrown if the KeyStroke
is not successfully created.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||