templates


Description

Defining templates

diputree can define default templates and regular templates.  

Referring to templates

Only the schortcut <t-> can be used to refer to a template. The full template reference composition was left out for performance reasons.

Diagram

diagram of <diputree> and templates


Set an animated line for all hovered leafs

<diputree>
 <hasdefaulttemplate>
  <l>
   <haslabel>
    <label>
     <when>
      <hovered/>
     </when>
     <hasbackground>
      <background>
       <hasimage>
        <uri>
         <s>../../images/underline16.gif</s>
        </uri>
       </hasimage>
      </background>
     </hasbackground>
    </label>
   </haslabel>
  </l>
 </hasdefaulttemplate>
 <has>
  <l>
   <lt>hover me!</lt>
  </l>
 </has>
</diputree>

Explanation

<diputree>

the hasdefaulttemplate relation between diputree and the default leaf

 <hasdefaulttemplate>
  <l>

the haslabel relation between the leaf and the label

   <haslabel>
    <label>

the when relation between the label and hovered

     <when>
      <hovered/>
     </when>

the hasbackground relation between the label and the background

     <hasbackground>
      <background>

the hasimage relation between the background and the image

       <hasimage>
        <uri>
         <s>../../images/underline16.gif</s>
        </uri>
       </hasimage>
      </background>
     </hasbackground>
    </label>
   </haslabel>
  </l>
 </hasdefaulttemplate>
 <has>
  <l>
   <lt>hover me!</lt>
  </l>
 </has>
</diputree>

A template for a shared icon

<diputree>
 <hastemplate>
  <l>
   <hasicon>
    <icon>
     <when>
      <closed/>
     </when>
     <hasimage>
      <uri>
       <s>../../images/excl.gif</s>
      </uri>
     </hasimage>
    </icon>
   </hasicon>
  </l>
 </hastemplate>
 <has>
  <l>
   <t->#/1/1/1</t->
   <lt>same icon</lt>
  </l>
  <l>
   <t->#xpointer(/diputree/hastemplate/l[1])</t->
   <lt>same icon</lt>
  </l>
 </has>
</diputree>

Explanation

<diputree>

the hastemplate relation between diputree and template leaf

 <hastemplate>
  <l>
   <hasicon>
    <icon>
     <when>
      <closed/>
     </when>
     <hasimage>
      <uri>
       <s>../../images/excl.gif</s>
      </uri>
     </hasimage>
    </icon>
   </hasicon>
  </l>
 </hastemplate>
 <has>
  <l>

the (shortcut) template reference relation between the leaf and the xpointer #/1/1/1 (child sequence)

   <t->#/1/1/1</t->
   <lt>same icon</lt>
  </l>
  <l>

the (shortcut) template reference relation between the leaf and the xpointer #xpointer(/diputree/hastemplate/l[1])

   <t->#xpointer(/diputree/hastemplate/l[1])</t->
   <lt>same icon</lt>
  </l>
 </has>
</diputree>


diputree documentation © 2000 dipu