<docbook><section><title>OATDOCtree</title><para> </para>
<title> tree.js</title> tree.js
<para>Converts Unordered List (<computeroutput>&lt;ul&gt;</computeroutput> element) into interactive tree.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Objects</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Tree(options)</bridgehead>
<para>Options may contain any of the following:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput> <emphasis>imagePath</emphasis></computeroutput> - path to all images used in tree </listitem>
<listitem><computeroutput> <emphasis>imagePrefix</emphasis></computeroutput> - prefix to all images </listitem>
<listitem><computeroutput> <emphasis>ext</emphasis></computeroutput> - image name extension </listitem>
<listitem><computeroutput> <emphasis>onlyOneOpened</emphasis></computeroutput> - boolean; can only one branch can be opened at a time? </listitem>
<listitem><computeroutput> <emphasis>allowDrag</emphasis></computeroutput> - boolean; can user re-drag Tree nodes? </listitem>
<listitem><computeroutput> <emphasis>useDots</emphasis></computeroutput> - boolean; draw dotted connectors? </listitem>
<listitem><computeroutput> <emphasis>onClick</emphasis></computeroutput> - &quot;select|toggle|false&quot;; what to do when user clicks label/icon </listitem>
<listitem><computeroutput> <emphasis>onDblClick</emphasis></computeroutput> - &quot;select|toggle|false&quot;; what to do when user double-clicks label/icon </listitem>
<listitem><computeroutput> <emphasis>poorMode</emphasis></computeroutput> - boolean; switch to &quot;memory_saving_increased_performance / lower_visual_features&quot; mode? </listitem>
<listitem><computeroutput> <emphasis>checkboxMode</emphasis></computeroutput> - boolean; use checkbox mode? </listitem>
<listitem><computeroutput> <emphasis>allowDrag</emphasis></computeroutput> - boolean; can user re-drag Tree nodes? </listitem>
<listitem><computeroutput> <emphasis>defaultCheck</emphasis></computeroutput> - boolean (only in <computeroutput>checkbox</computeroutput> mode) ; <emphasis>(<ulink url="ToBeDone">ToBeDone</ulink>: are checkboxes checked by default?)</emphasis> </listitem>
<listitem><computeroutput> <emphasis>checkNOI</emphasis></computeroutput> - boolean (only in <computeroutput>checkbox</computeroutput> mode); if true, then checked nodes are contained in <computeroutput>OAT.Tree::checkedNOI</computeroutput>.
 Otherwise, this array contains unchecked nodes.
</listitem>
<listitem><computeroutput> <emphasis>checkCallback</emphasis></computeroutput> - function (only in checkbox mode); will be executed (with nodeSet argument) when user changes state of a checkbox.</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Methods</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Tree.assign(listElement, collapse)</bridgehead>
<para>This converts a list into an interactive tree.<computeroutput>listElement</computeroutput> specifies an <computeroutput>&lt;ul&gt;</computeroutput> element in which your list lives.
 Argument <computeroutput>collapse</computeroutput> toggles initial collapsing of whole tree.</para>
<para>Tree data structure can be accessed and modified.
 See Example for usage.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> HTML Enhancement</bridgehead>
<para>Add attributes <computeroutput>branchImg</computeroutput>, <computeroutput>toggleOpenImg</computeroutput>, and <computeroutput>toggleClosedImg</computeroutput>, which would be appended to the <computeroutput>&lt;li&gt;</computeroutput> tag.
 This way we can have any desired name AND file format for the tree decoration.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Example</bridgehead>
<programlisting>var t1 = new OAT.Tree({imagePath:&quot;images&quot;,    // will take images from
         imagePrefix:&quot;&quot;, ext:&quot;gif&quot;});         // images/Tree_*.gif
var t2 = new OAT.Tree({imagePath:&quot;images&quot;,    // will take images from
         imagePrefix:&quot;prefix&quot;, ext:&quot;png&quot;});   // images/Tree_prefix_*.png
t1.assign(&quot;myUL1&quot;, true);   // collapsed
t2.assign(&quot;myUL2&quot;, false);  // expanded

var node1 = t1.tree.children[0];
var node2 = t2.tree.children[1];

node2.appendChild(node1);
node1.setLabel(&quot;newLabel&quot;);
node2.expand();
node1.createChild(&quot;newLabel&quot;, true);  // second argument means that new 
                                      // child is a node rather than leaf
node2.deleteChild(node1);
</programlisting><para> <ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink> <ulink url="CategoryToBeDone">CategoryToBeDone</ulink></para>
</section></docbook>