public class TLspKeyActionController extends ALspActionController
A chainable controller that performs certain actions based on keyboard interaction.
To use this controller in a TLspFXView
, use the
JavaFX-based constructor
.
Note: Only the first pressed event will trigger an action. All other pressed events will have no effect until a released event is received.
Constructor and Description |
---|
TLspKeyActionController(ILcdAction aPressedAction,
ILcdAction aReleasedAction,
int aKeyCode)
Constructor for a
TLspKeyActionController . |
TLspKeyActionController(ILcdAction aPressedAction,
ILcdAction aReleasedAction,
javafx.scene.input.KeyCodeCombination aKeyCodeCombination)
JavaFX-based constructor for a
TLspKeyActionController . |
TLspKeyActionController(ILcdAction aAction,
int aKeyCode)
Constructor for a
TLspKeyActionController that will execute the passed action when
a key identified by the passed key code is pressed. |
TLspKeyActionController(ILcdAction aAction,
int aKeyCode,
int aModifiers)
Constructor for a
TLspKeyActionController that will execute the passed action when
a key identified by the passed key code is pressed in combination with the specified modifiers. |
Modifier and Type | Method and Description |
---|---|
AWTEvent |
handleAWTEventImpl(AWTEvent aAWTEvent)
Called by
handleAWTEvent . |
javafx.event.Event |
handleFXEventImpl(javafx.event.Event aEvent)
Called by
handleFXEvent . |
protected void |
startInteractionImpl(ILspView aView)
The specific implementation of
startInteraction for this controller. |
protected void |
terminateInteractionImpl(ILspView aView)
The specific implementation of
terminateInteraction for this controller. |
createActionEvent, performAction
addPropertyChangeListener, addStatusListener, appendController, firePropertyChange, fireStatusEvent, getAWTFilter, getCursor, getFXCursor, getFXFilter, getIcon, getLayered, getName, getNextController, getShortDescription, getView, handleAWTEvent, handleFXEvent, paint, paintImpl, registerViewPropertyNameForReset, removePropertyChangeListener, removeStatusListener, setAWTFilter, setCursor, setFXCursor, setFXFilter, setIcon, setName, setShortDescription, startInteraction, terminateInteraction
public TLspKeyActionController(ILcdAction aAction, int aKeyCode)
TLspKeyActionController
that will execute the passed action when
a key identified by the passed key code is pressed. No action will be executed when the key is
released. The default modifiers are used, none.
The "virtual key" constants defined in KeyEvent
(KeyEvent.VK_*
)can be
used to specify the key code.aAction
- an action that will be called when the key corresponding to aKeyCode
is released.aKeyCode
- the key code identifying the key this controller will interact with.public TLspKeyActionController(ILcdAction aAction, int aKeyCode, int aModifiers)
TLspKeyActionController
that will execute the passed action when
a key identified by the passed key code is pressed in combination with the specified modifiers.
No action will be executed when the key is released.
The "virtual key" constants defined in KeyEvent
(KeyEvent.VK_*
)can be
used to specify the key code.
The modifiers can consist of any combination of:
java.awt.event.InputEvent.SHIFT_DOWN_MASK
java.awt.event.InputEvent.CTRL_DOWN_MASK
java.awt.event.InputEvent.META_DOWN_MASK
java.awt.event.InputEvent.ALT_DOWN_MASK
java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
0
to indicate no modifiers.aAction
- an action that will be called when the key corresponding to aKeyCode
is released.aKeyCode
- the key code identifying the key this controller will interact with.aModifiers
- the modifiers that have to be present for the action to be triggered.public TLspKeyActionController(ILcdAction aPressedAction, ILcdAction aReleasedAction, int aKeyCode)
TLspKeyActionController
. The pressed action will be executed
when the specified key is pressed, the release action when the specified key is released. A
typical use case is starting and stopping an animation. The default modifiers are used, none.
The "virtual key" constants defined in KeyEvent
(KeyEvent.VK_*
)can be
used to specify the key code.aPressedAction
- an action that will be called when the key corresponding to aKeyCode
is pressed.aReleasedAction
- an action that will be called when the key corresponding to aKeyCode
is released.aKeyCode
- the key code identifying the key this controller will interact with.public TLspKeyActionController(ILcdAction aPressedAction, ILcdAction aReleasedAction, javafx.scene.input.KeyCodeCombination aKeyCodeCombination)
TLspKeyActionController
. The pressed action will be executed
when the specified key is pressed in combination with the specified modifiers, the release
action when the specified key is released in combination with the specified modifiers. A
typical use case is starting and stopping an animation.aPressedAction
- an action that will be called when the key corresponding to aKeyCodeCombination
is pressed.aReleasedAction
- an action that will be called when the key corresponding to aKeyCodeCombination
is released.aKeyCodeCombination
- the key code and modifier combination that will trigger this controller's actionsprotected void startInteractionImpl(ILspView aView)
ALspController
startInteraction
for this controller.startInteractionImpl
in class ALspController
aView
- the view to start interaction with.protected void terminateInteractionImpl(ILspView aView)
ALspController
terminateInteraction
for this controller.terminateInteractionImpl
in class ALspController
aView
- the view to terminate interaction with.public AWTEvent handleAWTEventImpl(AWTEvent aAWTEvent)
ALspController
handleAWTEvent
.
Returns null
when the controller consumed the event or a partially consumed event
when the controller partially consumed the event (which could happen with
TLcdTouchEvent
s). When the controller did not use the given event, it is returned
unaltered.handleAWTEventImpl
in class ALspController
aAWTEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.public javafx.event.Event handleFXEventImpl(javafx.event.Event aEvent)
ALspController
handleFXEvent
.
Returns null
when the controller consumed the event. When the controller did not use the
given event, it is returned unaltered.handleFXEventImpl
in class ALspController
aEvent
- the event to be handled.null
when the input event was consumed, the (possibly modified) input
event when it was (partially) consumed.