1.1. Action which is a wrapper around a command

Action which delegates its job to a command (see Chapter 6, Commands written in the Java™ programming language in XMLmind XML Editor - Commands). This command delegate is specified using the command child element.

Attributes of the command child element:

name

Specifies the name under which the command has been registered.

This cannot be a configuration specific command. For example, this cannot be xhtml.convertToPS, which converts XHTML documents to PostScript™ and PDF.

If the command delegate is not a built-in command, but instead, is a custom generic command specially written to be wrapped in an action, this command:

  • must be declared in this GUI specification using a command element;

  • must be referenced in the hidden child element of the layout element.

parameter

Specifies the parameter of the command delegate, if any.

selectedParameter

Used to implement an action which acts as toggle. The command delegate is invoked with this special parameter in order to query it about its “selected” state. The command delegate is expected to return an object. The command result is converted to a string. This string is compared to the value of attribute selectedValue (by default, this value is "true"). If these strings are equal, then the command delegate is in the “selected” state. Otherwise, the command delegate is in the “unselected” state. See example below.

selectedValue

Used to implement an action which acts as toggle. See attribute selectedParameter for more explanations.

editingContextSensitive

Specifies whether the command delegate is editing context sensitive, that is, is enabled or disabled depending on the editing context (Which node is selected? Is some text selected? etc).

The majority of commands are editing context sensitive. That's why the default value of this attribute is true.

Example:

<action name="insertAfterAction" label="Insert _After..." 
        icon="icons/insertAfterAction.png">
  <command name="insert" parameter="after[implicitElement]" />
</action>

Example: a action which acts as a toggle:

<action name="toggleAutoSpellCheckAction" label="_Automatic Spell Checker"
        icon="icons/toggleAutoSpellCheckAction.png"
        selectedIcon="icons/toggleAutoSpellCheckAction_selected.png">
  <command name="autoSpellChecker" parameter="toggle"
            selectedParameter="isOn" selectedValue="true"
            editingContextSensitive="false" />
</action>