public class Behaviours extends Object
InputTriggerMap
/BehaviourMap
pair,
with InputTriggerMap
triggers that are read from a given
InputTriggerConfig
.
The maps can be installed
into
TriggerBehaviourBindings
.Modifier and Type | Field and Description |
---|---|
protected InputTriggerAdder |
inputTriggerAdder |
protected InputTriggerAdder.Factory |
keyConfig |
Constructor and Description |
---|
Behaviours(InputTriggerAdder.Factory keyConfig,
String... keyConfigContexts)
Construct with new, empty
InputTriggerMap and
BehaviourMap . |
Behaviours(InputTriggerMap inputTriggerMap,
BehaviourMap behaviourMap,
InputTriggerAdder.Factory keyConfig,
String... keyConfigContexts)
Construct with the specified
InputTriggerMap and
BehaviourMap . |
Modifier and Type | Method and Description |
---|---|
void |
behaviour(Behaviour behaviour,
String name,
String... defaultTriggers) |
BehaviourMap |
getBehaviourMap() |
InputTriggerMap |
getInputTriggerMap() |
void |
install(TriggerBehaviourBindings triggerBehaviourBindings,
String name)
|
void |
namedBehaviour(AbstractNamedBehaviour behaviour,
String... defaultTriggers) |
void |
updateKeyConfig(InputTriggerConfig keyConfig)
Clears the
InputTriggerMap and re-adds all behaviour keys from
BehaviourMap using the provided keyConfig . |
void |
updateKeyConfig(InputTriggerConfig keyConfig,
boolean clearAll)
Clears the
InputTriggerMap and re-adds all behaviour keys from
BehaviourMap using the provided keyConfig . |
protected InputTriggerAdder.Factory keyConfig
protected InputTriggerAdder inputTriggerAdder
public Behaviours(InputTriggerAdder.Factory keyConfig, String... keyConfigContexts)
InputTriggerMap
and
BehaviourMap
. Behaviours that are added to these maps (using
behaviour(Behaviour, String, String...)
,
namedBehaviour(AbstractNamedBehaviour, String...)
) have their
triggers defined by the specified keyConfig
.keyConfig
- added behaviours have their triggers defined by the specified
keyConfig
. (overrides default triggers.)keyConfigContexts
- for which context names in the keyConfig should triggers be
retrieved.public Behaviours(InputTriggerMap inputTriggerMap, BehaviourMap behaviourMap, InputTriggerAdder.Factory keyConfig, String... keyConfigContexts)
InputTriggerMap
and
BehaviourMap
. Behaviours that are added to these maps (using
behaviour(Behaviour, String, String...)
,
namedBehaviour(AbstractNamedBehaviour, String...)
) have their
triggers defined by the specified keyConfig
.inputTriggerMap
- InputTriggerMap
to add to.behaviourMap
- BehaviourMap
to add to.keyConfig
- added behaviours have their triggers defined by the specified
keyConfig
. (overrides default triggers.)keyConfigContexts
- for which context names in the keyConfig should triggers be
retrieved.public InputTriggerMap getInputTriggerMap()
public BehaviourMap getBehaviourMap()
public void install(TriggerBehaviourBindings triggerBehaviourBindings, String name)
InputTriggerMap
and BehaviourMap
to
triggerBehaviourBindings
under the given name
.
Convenience method for
triggerBehaviourBindings.addInputTriggerMap( name, getInputTriggerMap() ); triggerBehaviourBindings.addBehaviourMap( name, getBehaviourMap() );
triggerBehaviourBindings
- where to install the InputTriggerMap
/
BehaviourMap
.name
- name under which the InputTriggerMap
/
BehaviourMap
is installed.public void namedBehaviour(AbstractNamedBehaviour behaviour, String... defaultTriggers)
public void updateKeyConfig(InputTriggerConfig keyConfig)
InputTriggerMap
and re-adds all behaviour keys from
BehaviourMap
using the provided keyConfig
.keyConfig
- the new keyConfigpublic void updateKeyConfig(InputTriggerConfig keyConfig, boolean clearAll)
InputTriggerMap
and re-adds all behaviour keys from
BehaviourMap
using the provided keyConfig
.
If clearAll==false
, then behaviours that are currently in the
InputTriggerMap
but are not defined in the keyConfig
retain their current keystrokes (note that keyConfig
can map
behaviours to "not mapped").
keyConfig
- the new keyConfigclearAll
- whether to clear all bindings (also of behaviours that are
undefined in keyConfig
)Copyright © 2015–2022 SciJava. All rights reserved.