C.3 Using Relative DNames for Node Attribute Matching

When you have element structures that are reused in various hierarchies, it is possible to use relative child dname references when creating node styles; that can then be applied to any similar element hierarchy and will apply rendering rules without further customization.

Using this feature, the node style might contain a series of shapes, each filled with the condition of a different child element. Or, a series of text labels, each updated with an element property value for a different child element. What makes this feature unique is that each child dname reference is added as a relative reference. This means that the node syle can be applied to any hierarchy that has the same set of child elements.

For example, let’s say we have various server-related parent elements and each has the same three child elements to surface information about Backup, Capacity, and Performance; as shown in the figure below.

Figure C-1 Hierarchy Structure with Standard Set of Child Elements

And, we create a node style that displays the condition color of the three child elements: Backup, Capacity, and Performance.

Figure C-2 Node Style showing condition of Backup, Capacity and Performance Child Elements

In our source code, we bind each rectangle to each child element’s relative dName so that the node style can be reused for other server parent elements. Notice in the code sample below, the dname attribute for rectangle one is dname="org=Backup/.." which is a relative reference to look for any ORG child element named Backup.

<rect stroke="#000000" id="0" stroke-linecap="butt" dname="org=Backup/.." width="38" dname_relid="-1" fill="rgb(128,128,128)" bind:marks="missing" stroke-dasharray="none" filter="none" stroke-width="1" height="42" undofill="#c0c0c0" x="21" stroke-linejoin="miter" opacity="1" y="108"> <bind:fill property="condition" default="" set="" when=""/> </rect> <rect stroke="#000000" id="1" stroke-linecap="butt" dname="org=Capacity/.." width="38" dname_relid="-1" fill="rgb(128,128,128)" bind:marks="missing" stroke-dasharray="none" filter="none" stroke-width="1" height="42" undofill="#c0c0c0" x="78" stroke-linejoin="miter" opacity="1" y="108"> <bind:fill property="condition" default="" set="" when=""/> </rect> <rect stroke="#000000" id="2" stroke-linecap="butt" dname="org=Performance/.." width="38" dname_relid="-1" fill="rgb(128,128,128)" bind:marks="missing" stroke-dasharray="none" filter="none" stroke-width="1" height="42" undofill="#c0c0c0" x="135" stroke-linejoin="miter" opacity="1" y="108"> <bind:fill property="condition" default="" set="" when=""/> </rect>