Author: tmjee
Date: Wed Jun 14 08:38:38 2006
New Revision: 414297

URL: http://svn.apache.org/viewvc?rev=414297&view=rev
Log:
WW-1293
 - improved javadoc / snippet by having more description and more
   example (static tree and dynamic tree)
 - corrected some mistake in javadoc
 - altered tree.ftl to avoid the possibility of id attribute to be printed twice


Modified:
    
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/Tree.java
    
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/TreeNode.java
    
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeNodeTag.java
    struts/action2/trunk/core/src/main/resources/template/ajax/tree.ftl

Modified: 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/Tree.java
URL: 
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/Tree.java?rev=414297&r1=414296&r2=414297&view=diff
==============================================================================
--- 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/Tree.java
 (original)
+++ 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/Tree.java
 Wed Jun 14 08:38:38 2006
@@ -27,6 +27,9 @@
  * <!-- START SNIPPET: javadoc -->
  *
  * Renders a tree widget with AJAX support.<p/>
+ * 
+ * The id attribute is normally specified, such that it could be looked up 
using
+ * javascript if necessary.<p/>
  *
  * <!-- END SNIPPET: javadoc -->
  *
@@ -34,12 +37,8 @@
  *
  * <pre>
  * <!-- START SNIPPET: example -->
- * &lt;-- statically --&lt;
- * &lt;saf:tree rootNode="..." /&gt;
- * 
- * or 
  * 
- * &lt-- dynamically --&gt;
+ * &lt-- statically --&gt;
  * &lt;saf:tree id="..." label="..."&gt;
  *    &lt;saf:treenode id="..." label="..." /&gt;
  *    &lt;saf:treenode id="..." label="..."&gt;
@@ -48,6 +47,14 @@
  *    &;lt;/saf:treenode&gt;
  *    &lt;saf:treenode id="..." label="..." /&gt;
  * &lt;/saf:tree&gt;
+ * 
+ * &lt;-- dynamically --&gt;
+ * &lt;saf:tree 
+ *                     id="..."
+ *          rootNode="..."
+ *          nodeIdProperty="..."
+ *          nodeTitleProperty="..."
+ *          childCollectionProperty="..." /&gt;
  * 
  * <!-- END SNIPPET: example -->
  * </pre>

Modified: 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/TreeNode.java
URL: 
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/TreeNode.java?rev=414297&r1=414296&r2=414297&view=diff
==============================================================================
--- 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/TreeNode.java
 (original)
+++ 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/components/TreeNode.java
 Wed Jun 14 08:38:38 2006
@@ -27,13 +27,48 @@
  *
  * Renders a tree node within a tree widget with AJAX support.<p/>
  *
+ * Either of the following combinations should be used depending on if the 
tree 
+ * is to be constrcted dynamically or statically. <p/>
+ * 
+ * <b>Dynamically</b>
+ * <ul>
+ *             <li>id - id of this tree node</li>
+ *             <li>title - label to be displayed for this tree node</li>
+ * </ul>
+ * 
+ * <b>Statically</b>
+ * <ul>
+ *             <li>rootNode - the parent node of which this tree is derived 
from</li>
+ *             <li>nodeIdProperty - property to obtained this current tree 
node's id</li>
+ *             <li>nodeTitleProperty - property to obtained this current tree 
node's title</li>
+ *             <li>childCollectionProperty - property that returnds this 
current tree node's children</li>
+ * </ul>
+ *
  * <!-- END SNIPPET: javadoc -->
  *
  * <p/> <b>Examples</b>
  *
  * <pre>
  * <!-- START SNIPPET: example -->
- * &lt;treenode .../&gt;
+ * 
+ * &lt-- statically --&gt;
+ * &lt;ww:tree id="..." label="..."&gt;
+ *    &lt;ww:treenode id="..." label="..." /&gt;
+ *    &lt;ww:treenode id="..." label="..."&gt;
+ *        &lt;ww:treenode id="..." label="..." /&gt;
+ *        &lt;ww:treenode id="..." label="..." /&gt;
+ *    &;lt;/ww:treenode&gt;
+ *    &lt;ww:treenode id="..." label="..." /&gt;
+ * &lt;/ww:tree&gt;
+ * 
+ * &lt;-- dynamically --&gt;
+ * &lt;ww:tree 
+ *          id="..."
+ *          rootNode="..."
+ *          nodeIdProperty="..."
+ *          nodeTitleProperty="..."
+ *          childCollectionProperty="..." /&gt;
+ * 
  * <!-- END SNIPPET: example -->
  * </pre>
  *

Modified: 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeNodeTag.java
URL: 
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeNodeTag.java?rev=414297&r1=414296&r2=414297&view=diff
==============================================================================
--- 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeNodeTag.java
 (original)
+++ 
struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeNodeTag.java
 Wed Jun 14 08:38:38 2006
@@ -40,6 +40,8 @@
         this.label = label;
     }
 
+    // NOTE: not necessary, label property is inherited, will be populated 
+    // by super-class
     /*protected void populateParams() {
         if (label != null) {
             TreeNode treeNode = (TreeNode)component;

Modified: struts/action2/trunk/core/src/main/resources/template/ajax/tree.ftl
URL: 
http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/resources/template/ajax/tree.ftl?rev=414297&r1=414296&r2=414297&view=diff
==============================================================================
--- struts/action2/trunk/core/src/main/resources/template/ajax/tree.ftl 
(original)
+++ struts/action2/trunk/core/src/main/resources/template/ajax/tree.ftl Wed Jun 
14 08:38:38 2006
@@ -72,9 +72,11 @@
     </#if>
     >
     <#if parameters.label?exists>
-    <div dojoType="TreeNode" id="${parameters.id}_root" 
title="${parameters.label?html}"
+    <div dojoType="TreeNode" title="${parameters.label?html}"
     <#if parameters.nodeIdProperty?exists>
     id="${stack.findValue(parameters.nodeIdProperty)}"
+    <#else>
+    id="${parameters.id}_root"
     </#if>
     >
     <#elseif parameters.rootNode?exists>


Reply via email to