Record Class KeystrokeTriggerConfig
java.lang.Object
java.lang.Record
com.inductiveautomation.factorypmi.designer.workspace.KeystrokeTriggerConfig
- Record Components:
modifiers- the modifiers that must be held; empty for none.action- when the script fires.key- the key name forKeystrokeChooser.Action.PRESSEDandKeystrokeChooser.Action.RELEASED, elsenull.character- the single character forKeystrokeChooser.Action.TYPED, elsenull.
@NullMarked
public record KeystrokeTriggerConfig(Set<KeystrokeChooser.Modifier> modifiers, KeystrokeChooser.Action action, @Nullable String key, @Nullable String character)
extends Record
The trigger configuration of a Vision client keystroke event script: the keystroke that fires it,
as the keystroke chooser edits it.
Which of key and character applies depends on action, a cross-member
rule the JSON schema cannot express, so this type uses a hand-written extractor that also rejects
a key the chooser's Key list does not offer — a binding the chooser could not display.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConfigSchema<KeystrokeTriggerConfig> The authoritative schema and deserialization for client keystroke trigger configs. -
Constructor Summary
ConstructorsConstructorDescriptionKeystrokeTriggerConfig(Set<KeystrokeChooser.Modifier> modifiers, KeystrokeChooser.Action action, @Nullable String key, @Nullable String character) Creates a configuration. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.@Nullable Stringbinding()The memberactionuses: the slot after the action word in the stroke string.@Nullable StringReturns the value of thecharacterrecord component.final booleanIndicates whether some other object is "equal to" this one.static KeystrokeTriggerConfigfromStroke(String stroke) Reads a stroke string in the form the chooser saves — for example"ctrl pressed S"or"typed !".final inthashCode()Returns a hash code value for this object.@Nullable Stringkey()Returns the value of thekeyrecord component.Returns the value of themodifiersrecord component.final StringtoString()Returns a string representation of this record class.toStroke()
-
Field Details
-
SCHEMA
The authoritative schema and deserialization for client keystroke trigger configs.
-
-
Constructor Details
-
KeystrokeTriggerConfig
public KeystrokeTriggerConfig(Set<KeystrokeChooser.Modifier> modifiers, KeystrokeChooser.Action action, @Nullable String key, @Nullable String character) Creates a configuration. The memberactionuses may still benull, asfromStroke(String)reads a chooser mid-edit.- Throws:
IllegalArgumentException- if the memberactiondoes not use is set —keyforKeystrokeChooser.Action.TYPED, elsecharacter.
-
-
Method Details
-
binding
The memberactionuses: the slot after the action word in the stroke string.- Returns:
- the key name for
KeystrokeChooser.Action.PRESSEDandKeystrokeChooser.Action.RELEASED, or the character forKeystrokeChooser.Action.TYPED— the slot after the action word in the stroke string;nullif unset.
-
fromStroke
Reads a stroke string in the form the chooser saves — for example"ctrl pressed S"or"typed !". Lenient, because it describes the chooser's live state, which may be mid-edit: a "Typed" stroke comes back with the character box text exactly as typed, spaces and keyword-like words included, or anullcharacter when the box is empty, rather than failing.- Parameters:
stroke- a stroke string fromKeystrokeChooser.getStroke().- Returns:
- the configuration the stroke describes.
-
toStroke
- Returns:
- this configuration as a stroke string the chooser can load, for example
"ctrl pressed S".
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
modifiers
-
action
-
key
-
character
-