Author: artdaw
Date: 2009-02-13 10:39:12 -0500 (Fri, 13 Feb 2009)
New Revision: 12659
Added:
trunk/docs/userguide/en/src/main/resources/images/treeModel.png
Modified:
trunk/docs/userguide/en/src/main/docbook/included/tree.xml
trunk/docs/userguide/en/src/main/resources/images/treeXML.png
Log:
https://jira.jboss.org/jira/browse/RF-5083 - The component section was updated according
to info from Forum
Modified: trunk/docs/userguide/en/src/main/docbook/included/tree.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2009-02-13 15:28:05 UTC
(rev 12658)
+++ trunk/docs/userguide/en/src/main/docbook/included/tree.xml 2009-02-13 15:39:12 UTC
(rev 12659)
@@ -115,7 +115,7 @@
(<ulink
url="http://labs.jboss.com/file-access/default/members/jbossrichface...
org.richfaces.model.TreeNodeImpl
</ulink>).
- </para>
+ </para>
<para>
The
<emphasis><property>"value"</property></emphasis>
attribute
of the <emphasis
role="bold"><property><rich:tree></property></emphasis>
component
@@ -128,7 +128,51 @@
Data property of the current model <code>TreeNode</code> is
exposed using
<emphasis><property>"var"</property></emphasis>
attribute,
so if <code>var="itemData"</code> you can
refer to that data using <code>#{itemData}</code> syntax.
- </para>
+ </para>
+ <para>
+ In the following example the <emphasis
role="bold"><property><rich:tree></property></emphasis>
is
+ built from a simple <code>org.richfaces.model.TreeNode</code>
model:
+ </para>
+ <programlisting role="JAVA"><![CDATA[...
+private TreeNodeImpl<String> stationRoot = new TreeNodeImpl<String>();
+private TreeNodeImpl<String> stationNodes = new TreeNodeImpl<String>();
+private String[] kickRadioFeed = { "Hall & Oates - Kiss On My List",
+ "David Bowie - Let's Dance", "Lyn Collins - Think (About It)",
+ "Kim Carnes - Bette Davis Eyes",
+ "KC & the Sunshine Band - Give It Up" };
+ ...
+stationRoot.setData("KickRadio");
+stationNodes.addChild(0, stationRoot);
+for (int i = 0; i < kickRadioFeed.length; i++){
+ TreeNodeImpl<String> child = new TreeNodeImpl<String>();
+ child.setData(kickRadioFeed[i]);
+ stationRoot.addChild(i, child);
+}
+...]]></programlisting>
+<para>
+As it is mentioned before you need to pass
<code>#{stations.stationNodes}</code> property to the
+<emphasis><property>"value"</property></emphasis>
attribute
+and define the
<emphasis><property>"var"</property></emphasis>
attribute in order to refer to the data:
+</para>
+<programlisting role="XML"><![CDATA[...
+<rich:tree value="#{stations.stationNodes}" var="station">
+ <rich:treeNode>
+ <h:outputText value="#{station}" />
+ </rich:treeNode>
+</rich:tree>
+...]]></programlisting>
+<para>
+ This is a result:
+</para>
+<figure>
+ <title>A simple <emphasis
role="bold"><property><rich:tree></property></emphasis>
from a <code>org.richfaces.model.TreeNode</code></title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/treeModel.png"/>
+ </imageobject>
+ </mediaobject>
+</figure>
+
<para>There is a <code>"XmlTreeDataBuilder"</code>
class
(<ulink
url="http://labs.jboss.com/file-access/default/members/jbossrichface...
org.richfaces.component.xml.XmlTreeDataBuilder
Added: trunk/docs/userguide/en/src/main/resources/images/treeModel.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/treeModel.png
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/docs/userguide/en/src/main/resources/images/treeXML.png
===================================================================
(Binary files differ)