Grouping of Nodes

From Apache OpenOffice Wiki
Jump to: navigation, search



Similar to Leafs, Nodes can be grouped as well. For example, an extension would like to add three nodes to the options dialog of the Writer. Then one may want that these nodes are displayed contiguously. This will also be achieved by defining a group with the property GroupId and an index with the property GroupIndex. The index only determines the position within the group.

Documentation caution.png Do not add to groups which you have not defined yourself. This may lead to clashing indices and is generally bad style.

Grouping Nodes is optional. But when one does it, then all Nodes should be part of a group.

  <node oor:name="Nodes">
    <node oor:name="org.openoffice.framework.desktop.test.deployment.options.nodes2.node 3"
oor:op="fuse">
      <!-- leaving out some properties for the sake of brevity --> 
      <prop oor:name="GroupId">
        <value>org.openoffice.framework.desktop.test.deployment.options.nodes2.group</value>
      </prop>
      <prop oor:name="GroupIndex">
        <value>2</value>
      </prop>
      <!-- Next Node -->
      <node oor:name="org.openoffice.framework.desktop.test.deployment.options.nodes2.node 1"
oor:op="fuse">
        <!-- leaving out some properties for the sake of brevity --> 
        <prop oor:name="GroupId">
          <value>org.openoffice.framework.desktop.test.deployment.options.nodes2.group</value>
        </prop>
        <prop oor:name="GroupIndex">
          <value>0</value>
        </prop>
        <node oor:name="org.openoffice.framework.desktop.test.deployment.options.nodes2.node 2"
oor:op="fuse">
          <!-- leaving out some properties for the sake of brevity --> 
          <prop oor:name="GroupId">
            <value>org.openoffice.framework.desktop.test.deployment.options.nodes2.group</value>
          </prop>
          <prop oor:name="GroupIndex">
            <value>1</value>
          </prop>
       </node>
    </node>

The ordering of Nodes within a group is basically the same as with Leafs. But there is a small difference. In contrast to Leafs, Nodes can be assigned to various Modules, whereas as Leaf can only be assigned to one Node. So actually one could define an order of Nodes per Module. The order could then differ depending on the Module. For example, we define Node A and B which are assigned to the “Writer” Module (actually the names for the modules are longer, for example, com.sun.star.text.TextDocument) and the “Calc” Module. We could define that in the options dialog of the Writer node A is before B and in the options dialog of Calc B is before A.

This would have added some more complexity to the data structures. With respect to the ease of use we decided for a compromise. One can only define one order independent of the Module. In the previous example the nodes A and B would have the same order in the Writer's and Calc's options dialog. But what if one Node is not assigned to a particular Module but the others are? For example, there are the Nodes A, B, C which have the indices 0, 1, 2. Only A and C are assigned to the “Writer” Module. Then in the options dialog of the Writer the node A would immediately followed by C.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages