public class Actions extends Object
InputMap
/ActionMap
pair,
with InputMap
keys that are read from a given
InputTriggerConfig
.
The maps can be installed
into
InputActionBindings
.Modifier and Type | Field and Description |
---|---|
protected KeyStrokeAdder.Factory |
keyConfig |
protected KeyStrokeAdder |
keyStrokeAdder |
Constructor and Description |
---|
Actions(InputMap inputMap,
ActionMap actionMap,
KeyStrokeAdder.Factory keyConfig,
String... keyConfigContexts)
|
Actions(KeyStrokeAdder.Factory keyConfig,
String... keyConfigContexts)
|
Modifier and Type | Method and Description |
---|---|
ActionMap |
getActionMap() |
InputMap |
getInputMap() |
void |
install(InputActionBindings inputActionBindings,
String name)
|
void |
namedAction(AbstractNamedAction action,
String... defaultKeyStrokes)
Install the specified
AbstractNamedAction . |
void |
runnableAction(Runnable runnable,
String name,
String... defaultKeyStrokes)
|
void |
updateKeyConfig(InputTriggerConfig keyConfig)
|
void |
updateKeyConfig(InputTriggerConfig keyConfig,
boolean clearAll)
|
protected KeyStrokeAdder.Factory keyConfig
protected KeyStrokeAdder keyStrokeAdder
public Actions(KeyStrokeAdder.Factory keyConfig, String... keyConfigContexts)
InputMap
and ActionMap
. Actions
that are added to these maps (using
namedAction(AbstractNamedAction, String...)
,
runnableAction(Runnable, String, String...)
) have their key
stroke triggers defined by the specified keyConfig
.keyConfig
- added actions have their key stroke triggers defined by the
specified keyConfig
. (overrides default key strokes.)keyConfigContexts
- for which context names in the keyConfig should key strokes be
retrieved.public Actions(InputMap inputMap, ActionMap actionMap, KeyStrokeAdder.Factory keyConfig, String... keyConfigContexts)
InputMap
and ActionMap
. Actions
that are added to these maps (using
namedAction(AbstractNamedAction, String...)
,
runnableAction(Runnable, String, String...)
) have their key
stroke triggers defined by the specified keyConfig
.public InputMap getInputMap()
public ActionMap getActionMap()
public void install(InputActionBindings inputActionBindings, String name)
public void runnableAction(Runnable runnable, String name, String... defaultKeyStrokes)
Action
with the specified
name
that calls the specified Runnable
when triggered.runnable
- action to install.name
- name of the action.defaultKeyStrokes
- default key strokes that trigger the action. These are used,
if no mapping in the InputTriggerConfig
(specified in
the constructor) is found.public void namedAction(AbstractNamedAction action, String... defaultKeyStrokes)
AbstractNamedAction
.action
- action to install.defaultKeyStrokes
- default key strokes that trigger the action. These are used,
if no mapping in the InputTriggerConfig
(specified in
the constructor) is found.public void updateKeyConfig(InputTriggerConfig keyConfig)
InputMap
and re-adds all (String
) action keys
from ActionMap
using the provided keyConfig
.keyConfig
- the new keyConfigpublic void updateKeyConfig(InputTriggerConfig keyConfig, boolean clearAll)
InputMap
and re-adds all (String
) action keys
from ActionMap
using the provided keyConfig
.
Actions that are currently in the InputMap
but are not defined in
the keyConfig
retain their current keystrokes (note that
keyConfig
can map actions to "not mapped").
keyConfig
- the new keyConfigclearAll
- whether to clear all bindings (also of actions that are
undefined in keyConfig
)Copyright © 2015–2022 SciJava. All rights reserved.