Contents
Index
Search

10. A specific tool bar

The toolBar element allows to specify a tool bar which is specific to a given document type.

Figure 2.1. The "Simple Section" tool bar
The "Simple Section" tool bar

Excerpts from rng_section_config/common.incl (same file for all variants):

<toolBar>
  <button toolTip="Toggle bold" 
          icon="xxe-config:common/icons/bold.png">
    <class>com.xmlmind.xmleditapp.desktop.toolbar.TextStyleToggle</class>

    <command name="pass"
      parameter="{http://www.xmlmind.com/ns/sect}bold" />
  </button>

  ...
  <separator />
  ...
  <button toolTip="Add table" icon="xxe-config:common/icons/table_menu.png">
    <menu>
      <item label="table" command="add"
        parameter="after[implicitElement] {http://www.xmlmind.com/ns/sect}table" />
      <item label="table(header)" command="add"
        parameter="after[implicitElement]
                   #template({http://www.xmlmind.com/ns/sect}table,header)" />
    </menu>
  </button>
  ...
</toolBar>

A toolBar element has button and separator child elements. A button can contain a command or a menu of items, each menu item itself invoking a command.

[Tip]

A button element is required to have an icon attribute. Notice in the above toolBar that all icon attributes have a value starting with "xxe-config:common/icons/".

  1. "xxe-config:" is the only reliable way to refer XXE_install_dir/addon/config/.

  2. XXE_install_dir/addon/config/common/icons/ contains an number of 16x16 icons commonly used for toolbars and menu items. If you are writing a configuration for XXE, you should really take a look at these icons.

So the question is now: what is a command? A command in XMLmind XML Editor - Commands is an action triggered by a user input (mouse, keyboard, drag, drop, etc) which has an effect on the active view of the document being edited. The behavior of a command is influenced by its string parameter, the current text or node selection and the schema to which the document being edited is conforming.

[Caution]

The parameter of a command is a plain string, having vastly different meanings depending on the command. That's why, unless documented otherwise for a given command, namespace prefixes are not supported in a command parameter.

For example, in the above toolBar, you'll find qualified name s:table expressed as {http://www.xmlmind.com/ns/sect}table using Clark's notation. That is:

<command name="add"
  parameter="after[implicitElement] {http://www.xmlmind.com/ns/sect}table" />

and not:

<command name="add"
  parameter="after[implicitElement] s:table" />

We'll see in this tutorial that there are 3 kinds of commands: native commands (written in the Java™ programming language), macro-commands and process commands (both specified in XML in the configuration file).

XXE has dozens of native commands in XMLmind XML Editor - Commands. The tool bar which is specific to the "Simple Section" document type just uses one of them: add in XMLmind XML Editor - Commands.