1. action

<action
  name = NMTOKEN
  label = non empty token
  icon = anyURI
  selectedIcon = anyURI
  toolTip = non empty token
  accelerator = non empty token
  acceleratorOnMac = token
>
  Content: (class [ property ]* | command)
</action>

<class>
  Content: Java class name
</class>

<property
  name = NMTOKEN matching [_a-zA-Z][_a-zA-Z0-9]*
  type = (boolean|byte|char|short|int|long|float|double|
          String|Color|Font)
  value = string
/>

<command
  name = NMTOKEN
  parameter = string
  selectedParameter = string
  selectedValue = string : "true"
  editingContextSensitive = boolean : true
/>

Specifies an action, that is, an instance of class com.xmlmind.xmleditapp.desktop.AppAction.

The class derived from com.xmlmind.xmleditapp.desktop.AppAction is specified by the class child element.

The action element also allows to specify different kinds of AppActions without having to write Java™ code for that:

Child element command

Specifies an action which delegates its job to a command (see Chapter 6, Commands written in the Java™ programming language in XMLmind XML Editor - Commands). See example in the tutorial part of this document. Explanations below.

Attributes:

name

Required. Unique name identifying the action in this GUI specification.

label

One of label and icon is required. Label of the action (an action is used to create buttons, menu items and tool bar items).

icon

One of label and icon is required. Icon of the action (an action is used to create buttons, menu items and tool bar items).

This URI may be resolved using XML catalogs.

selectedIcon

Attributes icon and selectedIcon are both required for an action which acts as a toggle. The icon specified by attribute selectedIcon is used when the toggle is turned on. The icon specified by attribute icon is used when the toggle is turned off.

Class com.xmlmind.xmleditapp.desktop.ToggleOptionAction may be used implement an action which acts as a toggle. See example below. This is also the case when the command child element has a selectedParameter attribute. See Section 1.1, “Action which is a wrapper around a command”.

This URI may be resolved using XML catalogs.

toolTip

The tool tip of the action (an action is used to create buttons, menu items and tool bar items).

If this attribute is not specified, and if a tool tip is absolutely needed by the representation of the action (button, menu item and tool bar item), the value of attribute label will be used.

accelerator

The hot key used to trigger the action.

Hot keys are specified using the following syntax:

[ ctrl|shift|alt|meta|mod ]* key_code

key_code = (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
            9 | A | ACCEPT | ADD | AGAIN | 
            ALL_CANDIDATES | ALPHANUMERIC | AMPERSAND | 
            ASTERISK | AT | B | BACK_QUOTE | BACK_SLASH | 
            BACK_SPACE | BRACELEFT | BRACERIGHT | C | 
            CANCEL | CAPS_LOCK | CIRCUMFLEX | CLEAR | 
            CLOSE_BRACKET | CODE_INPUT | COLON | COMMA | 
            COMPOSE | CONVERT | COPY | CUT | D | DEAD_ABOVEDOT | 
            DEAD_ABOVERING | DEAD_ACUTE | DEAD_BREVE | 
            DEAD_CARON | DEAD_CEDILLA | DEAD_CIRCUMFLEX | 
            DEAD_DIAERESIS | DEAD_DOUBLEACUTE | DEAD_GRAVE | 
            DEAD_IOTA | DEAD_MACRON | DEAD_OGONEK | 
            DEAD_SEMIVOICED_SOUND | DEAD_TILDE | 
            DEAD_VOICED_SOUND | DECIMAL | DELETE | 
            DIVIDE | DOLLAR | DOWN | E | END | ENTER | 
            EQUALS | ESCAPE | EURO_SIGN | EXCLAMATION_MARK | 
            F | F1 | F10 | F11 | F12 | F13 | F14 | F15 | F16 | F17 | 
            F18 | F19 | F2 | F20 | F21 | F22 | F23 | F24 | F3 | F4 | 
            F5 | F6 | F7 | F8 | F9 | FINAL | FIND | FULL_WIDTH | 
            G | GREATER | H | HALF_WIDTH | HELP | HIRAGANA | 
            HOME | I | INPUT_METHOD_ON_OFF | INSERT | 
            INVERTED_EXCLAMATION_MARK | J | JAPANESE_HIRAGANA | 
            JAPANESE_KATAKANA | JAPANESE_ROMAN | K | KANA | 
            KANA_LOCK | KANJI | KATAKANA | KP_DOWN | KP_LEFT | 
            KP_RIGHT | KP_UP | L | LEFT | LEFT_PARENTHESIS | 
            LESS | M | MINUS | MODECHANGE | MULTIPLY | N | 
            NONCONVERT | NUMBER_SIGN | NUMPAD0 | NUMPAD1 | 
            NUMPAD2 | NUMPAD3 | NUMPAD4 | NUMPAD5 | NUMPAD6 | 
            NUMPAD7 | NUMPAD8 | NUMPAD9 | NUM_LOCK | O | 
            OPEN_BRACKET | P | PAGE_DOWN | PAGE_UP | PASTE | 
            PAUSE | PERIOD | PLUS | PREVIOUS_CANDIDATE | 
            PRINTSCREEN | PROPS | Q | QUOTE | QUOTEDBL | R | 
            RIGHT | RIGHT_PARENTHESIS | ROMAN_CHARACTERS | 
            S | SCROLL_LOCK | SEMICOLON | SEPARATOR | SLASH | 
            SPACE | STOP | SUBTRACT | T | TAB | U | UNDERSCORE | 
            UNDO | UP | V | W | X | Y | Z)

Note that mod is the Command key on Mac and the Control key on other platforms.

[Important]

Such hot key cannot override a binding (factory binding or a binding defined in customize.xxe — see Chapter 4, Customizing mouse and key bindings used by XXE in XMLmind XML Editor - Configuration and Deployment).

acceleratorOnMac

The hot key used to trigger the action on the Mac. This is needed because on the Mac, so many hot keys are reserved for the desktop.

If this attribute is not specified, and if attribute accelerator is specified, the hot key specified by accelerator will also be used on Macs.

If this attribute is specified as the empty string, the hot key normally specified by accelerator is suppressed on the Mac.

Example, a simple action:

<action name="printSelectionAction" label="Print Selected _Element...">
  <class>com.xmlmind.xmleditapp.desktop.file.PrintSelectionAction</class>
</action>

Example, a more elaborate action:

<action name="openAction" label="_Open..."
        icon="icons/openAction.png"
        accelerator="mod O">
  <class>com.xmlmind.xmleditapp.desktop.file.OpenAction</class>
</action>

Example, a action which acts as a toggle:

<action name="toggleUseURLChooserAction" label="_Use the URL Chooser">
        icon="icons/toggleUseURLChooserAction.png"
        selectedIcon="icons/toggleUseURLChooserAction_selected.png"
  <class>com.xmlmind.xmleditapp.desktop.ToggleOptionAction</class>
  <property name="option" type="String" value="useURLChooser" />1
  <property name="defaultValue" type="boolean" value="false" />
</action>

1

These are bean properties parameterizing com.xmlmind.xmleditapp.desktop.ToggleOptionAction. More information in Section 10.1, “Bean properties”.