Class TLspKeyActionController
java.lang.Object
com.luciad.view.lightspeed.controller.ALspController
com.luciad.view.lightspeed.controller.ALspActionController
com.luciad.view.lightspeed.controller.TLspKeyActionController
- All Implemented Interfaces:
ILcdAWTEventListener
,ILspController
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.
- Since:
- 2012.0
-
Constructor Summary
ConstructorDescriptionTLspKeyActionController
(ILcdAction aAction, int aKeyCode) Constructor for aTLspKeyActionController
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 aTLspKeyActionController
that will execute the passed action when a key identified by the passed key code is pressed in combination with the specified modifiers.TLspKeyActionController
(ILcdAction aPressedAction, ILcdAction aReleasedAction, int aKeyCode) Constructor for aTLspKeyActionController
.TLspKeyActionController
(ILcdAction aPressedAction, ILcdAction aReleasedAction, KeyCodeCombination aKeyCodeCombination) JavaFX-based constructor for aTLspKeyActionController
. -
Method Summary
Modifier and TypeMethodDescriptionhandleAWTEventImpl
(AWTEvent aAWTEvent) Called byhandleAWTEvent
.handleFXEventImpl
(Event aEvent) Called byhandleFXEvent
.protected void
startInteractionImpl
(ILspView aView) The specific implementation ofstartInteraction
for this controller.protected void
terminateInteractionImpl
(ILspView aView) The specific implementation ofterminateInteraction
for this controller.Methods inherited from class com.luciad.view.lightspeed.controller.ALspActionController
createActionEvent, performAction
Methods inherited from class com.luciad.view.lightspeed.controller.ALspController
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
-
Constructor Details
-
TLspKeyActionController
Constructor for aTLspKeyActionController
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 inKeyEvent
(KeyEvent.VK_*
)can be used to specify the key code.- Parameters:
aAction
- an action that will be called when the key corresponding toaKeyCode
is released.aKeyCode
- the key code identifying the key this controller will interact with.
-
TLspKeyActionController
Constructor for aTLspKeyActionController
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 inKeyEvent
(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.- Parameters:
aAction
- an action that will be called when the key corresponding toaKeyCode
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.
-
TLspKeyActionController
Constructor for aTLspKeyActionController
. 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 inKeyEvent
(KeyEvent.VK_*
)can be used to specify the key code.- Parameters:
aPressedAction
- an action that will be called when the key corresponding toaKeyCode
is pressed.aReleasedAction
- an action that will be called when the key corresponding toaKeyCode
is released.aKeyCode
- the key code identifying the key this controller will interact with.
-
TLspKeyActionController
public TLspKeyActionController(ILcdAction aPressedAction, ILcdAction aReleasedAction, KeyCodeCombination aKeyCodeCombination) JavaFX-based constructor for aTLspKeyActionController
. 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.- Parameters:
aPressedAction
- an action that will be called when the key corresponding toaKeyCodeCombination
is pressed.aReleasedAction
- an action that will be called when the key corresponding toaKeyCodeCombination
is released.aKeyCodeCombination
- the key code and modifier combination that will trigger this controller's actions- Since:
- 2020.0
-
-
Method Details
-
startInteractionImpl
Description copied from class:ALspController
The specific implementation ofstartInteraction
for this controller.- Overrides:
startInteractionImpl
in classALspController
- Parameters:
aView
- the view to start interaction with.
-
terminateInteractionImpl
Description copied from class:ALspController
The specific implementation ofterminateInteraction
for this controller.- Overrides:
terminateInteractionImpl
in classALspController
- Parameters:
aView
- the view to terminate interaction with.
-
handleAWTEventImpl
Description copied from class:ALspController
Called byhandleAWTEvent
. Returnsnull
when the controller consumed the event or a partially consumed event when the controller partially consumed the event (which could happen withTLcdTouchEvent
s). When the controller did not use the given event, it is returned unaltered.- Specified by:
handleAWTEventImpl
in classALspController
- Parameters:
aAWTEvent
- the event to be handled.- Returns:
null
when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-
handleFXEventImpl
Description copied from class:ALspController
Called byhandleFXEvent
. Returnsnull
when the controller consumed the event. When the controller did not use the given event, it is returned unaltered.- Overrides:
handleFXEventImpl
in classALspController
- Parameters:
aEvent
- the event to be handled.- Returns:
null
when the input event was consumed, the (possibly modified) input event when it was (partially) consumed.
-