label compositions


Description

A label is the textual representation of the node.

Shortcuts

There is a shortcut for the text of the label.

Diagram

diagram of <label>


A label with a text

<diputree>
 <has>
  <l>
   <haslabel>
    <label>
     <when>
      <closed/>
     </when>
     <hastext>
      <text>
       <s>Hi, I'm the text!</s>
      </text>
     </hastext>
    </label>
   </haslabel>
  </l>
 </has>
</diputree>

Explanation

<diputree>
 <has>

the leaf

  <l>

the haslabel relation between the leaf and the label

   <haslabel>

the label

    <label>

the when relation between the label and closed

     <when>

this label will only be shown when the state is closed. 

a leaf can be in 3 states: closed, selected and hovered. 
a branch can be in 4 states: closed, opened, selected and hovered.

the default catch-all state is closed. It must be defined.

      <closed/>
     </when>

the hastext relation between the leaf and the text.

     <hastext>

the text

      <text>

the string relation between the text and "Hi, I'm the text!".

       <s>Hi, I'm the text!</s>
      </text>
     </hastext>
    </label>
   </haslabel>
  </l>
 </has>
</diputree>


A label with a font

<diputree>
 <has>
  <l>
   <haslabel>
    <label>
     <when>
      <closed/>
     </when>
     <hastext>
      <text>
       <s>Serif,bold and italic</s>
      </text>
     </hastext>
     <hasfont>
      <font>
       <hasname>
        <name>
         <s>Serif</s>
        </name>
       </hasname>
       <hasweight>
        <bold/>
       </hasweight>
       <hasstyle>
        <italic/>
       </hasstyle>
      </font>
     </hasfont>
    </label>
   </haslabel>
  </l>
 </has>
</diputree>

Explanation

 <diputree>
 <has>
  <l>
   <haslabel>
    <label>
     <when>
      <closed/>
     </when>
     <hastext>
      <text>
       <s>Serif,bold and italic</s>
      </text>
     </hastext>

the hasfont relation between the label and the font

     <hasfont>

the font

      <font>

the hasname relation between font and name

       <hasname>

the name (of the font)

        <name>

the string relation between the name and "Serif"

         <s>Serif</s>
        </name>
       </hasname>

the hasweight relation between the font and bold

       <hasweight>

the bold weight

        <bold/>
       </hasweight>

the hasstyle relation between the font and italic

       <hasstyle>

the italic style

        <italic/>
       </hasstyle>
      </font>
     </hasfont>
    </label>
   </haslabel>
  </l>
 </has>
</diputree>


A label with a color

<diputree>
 <has>
  <l>
   <haslabel>
    <label>
     <when>
      <closed/>
     </when>
     <hastext>
      <text>
       <s>Hi, I'm red!</s>
      </text>
     </hastext>
     <hascolor>
      <rgb>
       <i>0xCC0000</i>
      </rgb>
     </hascolor>
    </label>
   </haslabel>
  </l>
 </has>
</diputree>

Explanation

 <diputree>
 <has>
  <l>
   <haslabel>
    <label>
     <when>
      <closed/>
     </when>
     <hastext>
      <text>
       <s>Hi, I'm red!</s>
      </text>
     </hastext>

the hascolor relation between the label and the color

     <hascolor>

the rgb encoded color

      <rgb>

the integer relation between rgb and the hexadecimal number 0xCC0000

       <i>0xCC0000</i>
      </rgb>
     </hascolor>
    </label>
   </haslabel>
  </l>
 </has>
</diputree>


A label with a shortcut label text

<diputree>
 <has>
  <l>
   <lt>Shortcut text!</lt>
  </l>
 </has>
</diputree>

Explanation

 <diputree>
 <has>
  <l>

the shortcut label text relation with "Shortcut text!"

   <lt>Shortcut text!</lt>
  </l>
 </has>
</diputree>


diputree documentation © 2000 dipu