5. Adding a document type specific tool bar

tutorial/tutorial5.xxe_gui:

  <ribbon name="ribbon" replace="configSpecificRibbonItems" />1
  
  <toolBarItems name="configSpecificToolBarItems">2
    <class>com.xmlmind.xmleditapp.kit.part.ConfigSpecificToolBarItems</class>
  </toolBarItems>

  <toolBar name="configSpecificToolBar">3
    <toolBarItems name="configSpecificToolBarItems" />4
  </toolBar>

  <layout label="Document Editor" icon="docedit.png">
    <topToolBars>5
      <ribbon name="ribbon" />
      <toolBar name="configSpecificToolBar" />
      <group name="nodePathToolBar">
        <tool name="nodePathTool" stretch="1" />
        <toolBar name="selectToolBar" />
      </group>
    </topToolBars>

    <insert />6
  </layout>

1

This removes the configuration specific buttons (element ribbonItems called "configSpecificRibbonItems" found in DesktopApp.xxe_gui) from the main tool bar (element ribbon called "ribbon" found in DesktopApp.xxe_gui).

Attribute replace in an empty element means replace by nothing, which itself means remove. It's also possible to remove or replace a range of items using attributes replace and replaceEnd. More information about attributes replace and replaceEnd in Customizing a composite part without redefining it from scratch.

2

Declare a part allowing to add the configuration specific buttons to a tool bar by the means of a toolBarItems element called "configSpecificToolBarItems". This part is not declared in DesktopApp.xxe_gui[3], so we need to declare it here.

3

Declare a new tool bar called "configSpecificToolBar" by using a toolBar element.

4

This new toolBar is to contain just the set of configuration specific buttons.

5

Replace the stock topToolBars child in the layout element by a custom one. This child element can contain one or more horizontal ribbons or toolBars.

6

Without the use of insert, the above layout would have been understood as a redefinition from scratch of the standard layout of the XML editor. Such XML editor would contain just a few tool bars.



[3] This is a copy of toolBarItems element called "configSpecificToolBarItems" found in SingleDocApp.xxe_gui.