public final class BindingSpec extends BindingBase
Binding
.Modifier and Type | Field and Description |
---|---|
static BindingSpec[] |
EMPTY_LIST
An empty array of binding specifications.
|
static String |
REMOVE_BINDING_SPEC
Fake command name which may be used to specify to
merge(com.xmlmind.xmledit.control.BindingSpec[], com.xmlmind.xmledit.control.BindingSpec[])
that the corresponding BindingSpec, if any, is to be removed from
the merged list. |
appEventName, userInputs
Constructor and Description |
---|
BindingSpec(String appEventName,
CommandMenuSpec menuSpec)
Constructs a specification associating specified menu with
specified application event.
|
BindingSpec(String appEventName,
String commandName,
String commandParameter)
Constructs a specification associating specified command with
specified application event.
|
BindingSpec(UserInput[] userInputs,
String commandName,
String commandParameter)
Constructs a specification associating specified command with specified
user input sequence.
|
BindingSpec(UserInput userInput,
CommandMenuSpec menuSpec)
Constructs a specification associating specified menu with
specified user input.
|
BindingSpec(UserInput userInput,
String commandName,
String commandParameter)
Constructs a specification associating specified command with specified
user input.
|
BindingSpec(UserInput userInput1,
UserInput userInput2,
String commandName,
String commandParameter)
Constructs a specification associating specified command with specified
user input sequence.
|
BindingSpec(UserInput userInput1,
UserInput userInput2,
UserInput userInput3,
String commandName,
String commandParameter)
Constructs a specification associating specified command with specified
user input sequence.
|
Modifier and Type | Method and Description |
---|---|
protected void |
check() |
String |
getCommandName()
Returns the name of the command triggered by user input, if any.
|
String |
getCommandParameter()
Returns the parameter of the command triggered by user input, if any.
|
CommandMenuSpec |
getMenuSpec()
Returns the specification of the menu displayed in response to
user input, if any.
|
static BindingSpec[] |
merge(BindingSpec[] specs1,
BindingSpec[] specs2)
Returns an array of BindingSpec containing the union of specified
arrays, where BindingSpecs found in second array may replace
BindingSpecs with same UserInput sequence found in first array.
|
Binding |
toBinding(CommandRegistry commands)
Returns binding object corresponding to this specification.
|
static Binding[] |
toBindings(BindingSpec[] specs,
CommandRegistry commands)
Returns specified BindingSpecs converted to Bindings.
|
equals, equals, getAppEventName, getUserInputs, hashCode, hashCode, hasSameTrigger, isAppEventBinding, isKeyBinding, isMouseBinding, toString, triggerToString
public static final BindingSpec[] EMPTY_LIST
public static final String REMOVE_BINDING_SPEC
merge(com.xmlmind.xmledit.control.BindingSpec[], com.xmlmind.xmledit.control.BindingSpec[])
that the corresponding BindingSpec, if any, is to be removed from
the merged list.public BindingSpec(UserInput userInput, String commandName, String commandParameter)
userInput
- user inputcommandName
- name of command invoked by specified user inputcommandParameter
- parameter of the command; may be
null
public BindingSpec(UserInput userInput1, UserInput userInput2, String commandName, String commandParameter)
A user input sequence (that is, not a single user input event) cannot contain mouse inputs, just keyboard inputs.
userInput1
- first user input of the sequenceuserInput2
- second user input of the sequencecommandName
- name of command invoked by specified user inputcommandParameter
- parameter of the command; may be
null
public BindingSpec(UserInput userInput1, UserInput userInput2, UserInput userInput3, String commandName, String commandParameter)
A user input sequence (that is, not a single user input event) cannot contain mouse inputs, just keyboard inputs.
userInput1
- first user input of the sequenceuserInput2
- second user input of the sequenceuserInput3
- third user input of the sequencecommandName
- name of command command invoked by specified user
inputcommandParameter
- parameter of the command; may be
null
public BindingSpec(UserInput[] userInputs, String commandName, String commandParameter)
A user input sequence (that is, not a single user input event) cannot contain mouse inputs, just keyboard inputs.
userInputs
- user input sequencecommandName
- name of command invoked by specified user inputcommandParameter
- parameter of the command; may be
null
public BindingSpec(UserInput userInput, CommandMenuSpec menuSpec)
A keyboard input cannot be used to dislay a menu.
userInput
- user inputmenuSpec
- specifies a menupublic BindingSpec(String appEventName, String commandName, String commandParameter)
appEventName
- name of application eventcommandName
- name of command invoked by specified
application eventcommandParameter
- parameter of the command; may be
null
AppEvent
public BindingSpec(String appEventName, CommandMenuSpec menuSpec)
appEventName
- name of application eventmenuSpec
- specifies a menuAppEvent
protected void check() throws IllegalArgumentException
check
in class BindingBase
IllegalArgumentException
public String getCommandName()
null
otherwise.public String getCommandParameter()
null
otherwise.public CommandMenuSpec getMenuSpec()
null
otherwise.public Binding toBinding(CommandRegistry commands)
null
if any named command referenced in this specification
has not been registered using specified CommandRegistry
.public static BindingSpec[] merge(BindingSpec[] specs1, BindingSpec[] specs2)
If the command name used by a BindingSpec in second array is
REMOVE_BINDING_SPEC
, then the corresponding BindingSpec,
if any, is removed from first array.
public static Binding[] toBindings(BindingSpec[] specs, CommandRegistry commands) throws IllegalArgumentException
IllegalArgumentException
- if a named command referenced
in a BindingSpec has not been registered using specified
CommandRegistry