Package docking.action
Class KeyBindingData
java.lang.Object
docking.action.KeyBindingData
A class for storing an action's key stroke, mouse binding or both.
Note: this class creates key strokes that work on key pressed
. This effectively
normalizes all client key bindings to work on the same type of key stroke (pressed, typed or
released).
-
Constructor Summary
ConstructorDescriptionKeyBindingData
(char c, int modifiers) KeyBindingData
(int keyCode, int modifiers) KeyBindingData
(ActionTrigger actionTrigger) Creates a key binding data with the given action trigger.KeyBindingData
(MouseBinding mouseBinding) Constructs an instance of this class that uses a mouse binding instead of a key stroke.KeyBindingData
(String keyStrokeString) Creates a key stroke from the given text.KeyBindingData
(KeyStroke keyStroke) KeyBindingData
(KeyStroke keyStroke, KeyBindingPrecedence precedence) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Creates a new action trigger with the values of this classReturns an accelerator keystroke to be associated with this action.Returns the keyBindingPrecedence for this actionReturns the mouse binding assigned to this key binding data.int
hashCode()
toString()
static KeyBindingData
update
(KeyBindingData kbData, ActionTrigger newTrigger) Returns a key binding data object that matches the given trigger.
-
Constructor Details
-
KeyBindingData
-
KeyBindingData
public KeyBindingData(char c, int modifiers) -
KeyBindingData
public KeyBindingData(int keyCode, int modifiers) -
KeyBindingData
Constructs an instance of this class that uses a mouse binding instead of a key stroke.- Parameters:
mouseBinding
- the mouse binding.
-
KeyBindingData
Creates a key stroke from the given text. SeeKeyBindingUtils.parseKeyStroke(KeyStroke)
. The key stroke created for this class will always be a keypressed
key stroke.- Parameters:
keyStrokeString
- the key stroke string to parse
-
KeyBindingData
Creates a key binding data with the given action trigger.- Parameters:
actionTrigger
- the trigger; may not be null
-
KeyBindingData
-
-
Method Details
-
update
Returns a key binding data object that matches the given trigger. If the existing key binding object already matches the new trigger, then the existing key binding data is returned. If the new trigger is null, the null will be returned.- Parameters:
kbData
- the existing key binding data; my be nullnewTrigger
- the new action trigger; may be null- Returns:
- a key binding data based on the new action trigger; may be null
-
getKeyBinding
Returns an accelerator keystroke to be associated with this action.- Returns:
- the binding
-
getKeyBindingPrecedence
Returns the keyBindingPrecedence for this action- Returns:
- the precedence
-
getMouseBinding
Returns the mouse binding assigned to this key binding data.- Returns:
- the mouse binding; may be null
-
getActionTrigger
Creates a new action trigger with the values of this class- Returns:
- the action trigger
-
toString
-
hashCode
public int hashCode() -
equals
-