You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by tm...@apache.org on 2006/05/20 18:11:07 UTC

svn commit: r408016 - in /struts/action2/trunk/core/src: main/java/org/apache/struts/action2/components/ main/java/org/apache/struts/action2/views/jsp/ui/ main/resources/META-INF/ main/resources/org/apache/struts/action2/static/ main/resources/template...

Author: tmjee
Date: Sat May 20 09:11:06 2006
New Revision: 408016

URL: http://svn.apache.org/viewvc?rev=408016&view=rev
Log:
WW-1316


Added:
    struts/action2/trunk/core/src/main/resources/org/apache/struts/action2/static/tree.css   (with props)
    struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/Category.java   (with props)
    struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/TreeTest.java   (with props)
    struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-1.txt   (with props)
    struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-2.txt   (with props)
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/views/jsp/ui/TreeNodeTag.java
    struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeTag.java
    struts/action2/trunk/core/src/main/resources/META-INF/taglib.tld
    struts/action2/trunk/core/src/main/resources/template/ajax/tree.ftl
    struts/action2/trunk/core/src/main/resources/template/ajax/treenode.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=408016&r1=408015&r2=408016&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 Sat May 20 09:11:06 2006
@@ -25,17 +25,34 @@
  * description="Render a tree widget."
  */
 public class Tree extends ClosingUIBean {
-    private static final String TEMPLATE = "tree-close";
+    
+	private static final String TEMPLATE = "tree-close";
     private static final String OPEN_TEMPLATE = "tree";
+    
     private String toggle = "fade";
     private String treeSelectedTopic;
     private String treeExpandedTopic;
     private String treeCollapsedTopic;
-    private String openAll;
     protected String rootNodeAttr;
     protected String childCollectionProperty;
     protected String nodeTitleProperty;
     protected String nodeIdProperty;
+    private String showRootGrid;
+    
+    private String showGrid;
+    private String blankIconSrc;
+	private String gridIconSrcL;
+	private String gridIconSrcV;
+	private String gridIconSrcP;
+	private String gridIconSrcC;
+	private String gridIconSrcX;
+	private String gridIconSrcY;
+	private String expandIconSrcPlus;
+	private String expandIconSrcMinus;
+	private String iconWidth;
+	private String iconHeight;
+	private String toggleDuration;
+    private String templateCssPath;
 
     public Tree(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response) {
         super(stack, request, response);
@@ -75,8 +92,6 @@
             addParameter("treeCollapsedTopic", findString(treeCollapsedTopic));
         }
 
-        addParameter("openAll", Boolean.valueOf(openAll));
-
         if (rootNodeAttr != null) {
             addParameter("rootNode", findValue(rootNodeAttr));
         }
@@ -92,6 +107,64 @@
         if (nodeIdProperty != null) {
             addParameter("nodeIdProperty", findString(nodeIdProperty));
         }
+        
+        if (showRootGrid != null) {
+        	addParameter("showRootGrid", findValue(showRootGrid, Boolean.class));
+        }
+        
+        
+        if (showGrid != null) {
+        	addParameter("showGrid", findValue(showGrid, Boolean.class));
+        }
+        
+        if (blankIconSrc != null) {
+        	addParameter("blankIconSrc", findString(blankIconSrc));
+        }
+        
+    	if (gridIconSrcL != null) {
+    		addParameter("gridIconSrcL", findString(gridIconSrcL));
+    	}
+    	
+    	if (gridIconSrcV != null) {
+    		addParameter("gridIconSrcV", findString(gridIconSrcV));
+    	}
+    	
+    	if (gridIconSrcP != null)  {
+    		addParameter("gridIconSrcP", findString(gridIconSrcP));
+    	}
+    	
+    	if (gridIconSrcC != null) {
+    		addParameter("gridIconSrcC", findString(gridIconSrcC));
+    	}
+    	
+    	if (gridIconSrcX != null) {
+    		addParameter("gridIconSrcX", findString(gridIconSrcX));
+    	}
+    	
+    	if (gridIconSrcY != null) {
+    		addParameter("gridIconSrcY", findString(gridIconSrcY));
+    	}
+    	
+    	if (expandIconSrcPlus != null) {
+    		addParameter("expandIconSrcPlus", findString(expandIconSrcPlus));
+    	}
+    	
+    	if (expandIconSrcMinus != null) {
+    		addParameter("expandIconSrcMinus", findString(expandIconSrcMinus));
+    	}
+    	
+    	if (iconWidth != null) {
+    		addParameter("iconWidth", findValue(iconWidth, Integer.class));
+    	}
+    	if (iconHeight != null) {
+    		addParameter("iconHeight", findValue(iconHeight, Integer.class));
+    	}
+    	if (toggleDuration != null) {
+    		addParameter("toggleDuration", findValue(toggleDuration, Integer.class));
+    	}
+        if (templateCssPath != null) {
+        	addParameter("templateCssPath", findString(templateCssPath));
+        }
     }
 
     public String getDefaultOpenTemplate() {
@@ -107,7 +180,7 @@
     }
 
     /**
-     * The toggle property.
+     * The toggle property (either 'explode' or 'fade'). Default is 'fade'.
      * @a2.tagattribute required="false"
      */
     public void setToggle(String toggle) {
@@ -150,18 +223,6 @@
         this.treeCollapsedTopic = treeCollapsedTopic;
     }
 
-    public String getOpenAll() {
-        return openAll;
-    }
-
-    /**
-     * The openAll property.
-     * @a2.tagattribute required="false" type="boolean" default="false"
-     */
-    public void setOpenAll(String openAll) {
-        this.openAll = openAll;
-    }
-
     public String getRootNode() {
         return rootNodeAttr;
     }
@@ -209,7 +270,189 @@
     public void setNodeIdProperty(String nodeIdProperty) {
         this.nodeIdProperty = nodeIdProperty;
     }
-
-
+    
+    /**
+     * The showRootGrid property (default true).
+     * @a2.tagattribute required="false"
+     */
+    public void setShowRootGrid(String showRootGrid) {
+    	this.showRootGrid = showRootGrid;
+    }
+    
+    public String getShowRootGrid() {
+    	return showRootGrid;
+    }
+
+	public String getBlankIconSrc() {
+		return blankIconSrc;
+	}
+
+	/**
+	 * Blank icon image source.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setBlankIconSrc(String blankIconSrc) {
+		this.blankIconSrc = blankIconSrc;
+	}
+
+	public String getExpandIconSrcMinus() {
+		return expandIconSrcMinus;
+	}
+
+	/**
+	 * Expand icon (-) image source.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setExpandIconSrcMinus(String expandIconSrcMinus) {
+		this.expandIconSrcMinus = expandIconSrcMinus;
+	}
+
+	public String getExpandIconSrcPlus() {
+		return expandIconSrcPlus;
+	}
+
+	/**
+	 * Expand Icon (+) image source.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setExpandIconSrcPlus(String expandIconSrcPlus) {
+		this.expandIconSrcPlus = expandIconSrcPlus;
+	}
+
+	public String getGridIconSrcC() {
+		return gridIconSrcC;
+	}
+
+	/**
+	 * Image source for under child item child icons.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setGridIconSrcC(String gridIconSrcC) {
+		this.gridIconSrcC = gridIconSrcC;
+	}
+
+	public String getGridIconSrcL() {
+		return gridIconSrcL;
+	}
+
+	
+	/**
+	 * Image source for last child grid.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setGridIconSrcL(String gridIconSrcL) {
+		this.gridIconSrcL = gridIconSrcL;
+	}
+
+	public String getGridIconSrcP() {
+		return gridIconSrcP;
+	}
+
+	/**
+	 * Image source for under parent item child icons.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setGridIconSrcP(String gridIconSrcP) {
+		this.gridIconSrcP = gridIconSrcP;
+	}
+
+	public String getGridIconSrcV() {
+		return gridIconSrcV;
+	}
+
+	/**
+	 * Image source for vertical line.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setGridIconSrcV(String gridIconSrcV) {
+		this.gridIconSrcV = gridIconSrcV;
+	}
+
+	public String getGridIconSrcX() {
+		return gridIconSrcX;
+	}
+
+	/**
+	 * Image source for grid for sole root item.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setGridIconSrcX(String gridIconSrcX) {
+		this.gridIconSrcX = gridIconSrcX;
+	}
+
+	public String getGridIconSrcY() {
+		return gridIconSrcY;
+	}
+
+	/**
+	 * Image source for grid for last root item.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setGridIconSrcY(String gridIconSrcY) {
+		this.gridIconSrcY = gridIconSrcY;
+	}
+
+	public String getIconHeight() {
+		return iconHeight;
+	}
+
+	
+	/**
+	 * Icon height (default 18 pixels).
+	 * @a2.tagattribute required="false"
+	 */
+	public void setIconHeight(String iconHeight) {
+		this.iconHeight = iconHeight;
+	}
+
+	public String getIconWidth() {
+		return iconWidth;
+	}
+
+	/**
+	 * Icon width (default 19 pixels).
+	 * @a2.tagattribute required="false"
+	 */
+	public void setIconWidth(String iconWidth) {
+		this.iconWidth = iconWidth;
+	}
+
+	
+
+	public String getTemplateCssPath() {
+		return templateCssPath;
+	}
+
+	/**
+	 * Template css path (default {contextPath}/struts/tree.css.
+	 * @a2.tagattribute required="false"
+	 */
+	public void setTemplateCssPath(String templateCssPath) {
+		this.templateCssPath = templateCssPath;
+	}
+
+	public String getToggleDuration() {
+		return toggleDuration;
+	}
+
+	/**
+	 * Toggle duration (default 150 ms)
+	 * @a2.tagattribute required="false"
+	 */
+	public void setToggleDuration(String toggleDuration) {
+		this.toggleDuration = toggleDuration;
+	}
+
+	public String getShowGrid() {
+		return showGrid;
+	}
+
+	/**
+	 * Show grid (default true).
+	 * @a2.tagattribute required="false"
+	 */
+	public void setShowGrid(String showGrid) {
+		this.showGrid = showGrid;
+	}
 }
 

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=408016&r1=408015&r2=408016&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 Sat May 20 09:11:06 2006
@@ -31,7 +31,6 @@
 	
 	private static final long serialVersionUID = 7340746943017900803L;
 	
-	private String label;
 
     public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) {
         return new TreeNode(stack,req,res);
@@ -41,11 +40,11 @@
         this.label = label;
     }
 
-    protected void populateParams() {
+    /*protected void populateParams() {
         if (label != null) {
             TreeNode treeNode = (TreeNode)component;
             treeNode.setLabel(label);
         }
         super.populateParams();
-    }
+    }*/
 }

Modified: struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeTag.java
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeTag.java?rev=408016&r1=408015&r2=408016&view=diff
==============================================================================
--- struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeTag.java (original)
+++ struts/action2/trunk/core/src/main/java/org/apache/struts/action2/views/jsp/ui/TreeTag.java Sat May 20 09:11:06 2006
@@ -34,15 +34,30 @@
 	private String toggle;
     private String treeSelectedTopic;
     private String treeExpandedTopic;
-    private String treeCollapsedTopic;
-    private String openAll;
+    private String treeCollapsedTopic; 
     private String rootNode;
     private String childCollectionProperty;
     private String nodeTitleProperty;
     private String nodeIdProperty;
+    private String showRootGrid;
+    
+    private String showGrid;
+	private String blankIconSrc;
+	private String gridIconSrcL;
+	private String gridIconSrcV;
+	private String gridIconSrcP;
+	private String gridIconSrcC;
+	private String gridIconSrcX;
+	private String gridIconSrcY;
+	private String expandIconSrcPlus;
+	private String expandIconSrcMinus;
+	private String iconWidth;
+	private String iconHeight;
+	private String toggleDuration;
+    private String templateCssPath;
+     
 
-
-    public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) {
+	public Component getBean(OgnlValueStack stack, HttpServletRequest req, HttpServletResponse res) {
         return new Tree(stack,req,res);
     }
 
@@ -50,15 +65,53 @@
         super.populateParams();
 
         Tree tree = (Tree) component;
-        tree.setChildCollectionProperty(childCollectionProperty);
-        tree.setNodeIdProperty(nodeIdProperty);
-        tree.setNodeTitleProperty(nodeTitleProperty);
-        tree.setOpenAll(openAll);
-        tree.setRootNode(rootNode);
-        tree.setToggle(toggle);
-        tree.setTreeCollapsedTopic(treeCollapsedTopic);
-        tree.setTreeExpandedTopic(treeExpandedTopic);
-        tree.setTreeSelectedTopic(treeSelectedTopic);
+        if (childCollectionProperty != null)
+        	tree.setChildCollectionProperty(childCollectionProperty);
+        if (nodeIdProperty != null)
+        	tree.setNodeIdProperty(nodeIdProperty);
+        if (nodeTitleProperty != null)
+        	tree.setNodeTitleProperty(nodeTitleProperty);
+        if (rootNode != null)
+        	tree.setRootNode(rootNode);
+        if (toggle != null)
+        	tree.setToggle(toggle);
+        if (treeCollapsedTopic != null)
+        	tree.setTreeCollapsedTopic(treeCollapsedTopic);
+        if (treeExpandedTopic != null)
+        	tree.setTreeExpandedTopic(treeExpandedTopic);
+        if (treeSelectedTopic != null)
+        	tree.setTreeSelectedTopic(treeSelectedTopic);
+        if (showRootGrid != null)
+        	tree.setShowRootGrid(showRootGrid);
+        
+        if (showGrid != null)
+        	tree.setShowGrid(showGrid);
+        if (blankIconSrc != null)
+        	tree.setBlankIconSrc(blankIconSrc);
+        if (gridIconSrcL != null)
+        	tree.setGridIconSrcL(gridIconSrcC);
+        if (gridIconSrcV != null) 
+        	tree.setGridIconSrcV(gridIconSrcV);
+        if (gridIconSrcP != null)
+        	tree.setGridIconSrcP(gridIconSrcP);
+        if (gridIconSrcC != null)
+        	tree.setGridIconSrcC(gridIconSrcC);
+        if (gridIconSrcX != null)
+        	tree.setGridIconSrcX(gridIconSrcX);
+        if (gridIconSrcY != null)
+        	tree.setGridIconSrcY(gridIconSrcY);
+        if (expandIconSrcPlus != null) 
+        	tree.setExpandIconSrcPlus(expandIconSrcPlus);
+    	if (expandIconSrcMinus != null) 
+    		tree.setExpandIconSrcMinus(expandIconSrcMinus);
+    	if (iconWidth != null) 
+    		tree.setIconWidth(iconWidth);
+    	if (iconHeight != null)
+    		tree.setIconHeight(iconHeight);
+    	if (toggleDuration != null)
+    		tree.setToggleDuration(toggleDuration);
+    	if (templateCssPath != null)
+    		tree.setTemplateCssPath(templateCssPath);
     }
 
     public String getToggle() {
@@ -93,14 +146,6 @@
         this.treeCollapsedTopic = treeCollapsedTopic;
     }
 
-    public String getOpenAll() {
-        return openAll;
-    }
-
-    public void setOpenAll(String openAll) {
-        this.openAll = openAll;
-    }
-
     public String getRootNode() {
         return rootNode;
     }
@@ -132,5 +177,125 @@
     public void setNodeIdProperty(String nodeIdProperty) {
         this.nodeIdProperty = nodeIdProperty;
     }
+    
+    public String getShowRootGrid() {
+    	return showRootGrid;
+    }
+    
+    public void setShowRootGrid(String showRootGrid) {
+    	this.showRootGrid = showRootGrid;
+    }
+    
+    public String getBlankIconSrc() {
+		return blankIconSrc;
+	}
+
+	public void setBlankIconSrc(String blankIconSrc) {
+		this.blankIconSrc = blankIconSrc;
+	}
+
+	public String getExpandIconSrcMinus() {
+		return expandIconSrcMinus;
+	}
+
+	public void setExpandIconSrcMinus(String expandIconSrcMinus) {
+		this.expandIconSrcMinus = expandIconSrcMinus;
+	}
+
+	public String getExpandIconSrcPlus() {
+		return expandIconSrcPlus;
+	}
+
+	public void setExpandIconSrcPlus(String expandIconSrcPlus) {
+		this.expandIconSrcPlus = expandIconSrcPlus;
+	}
+
+	public String getGridIconSrcC() {
+		return gridIconSrcC;
+	}
+
+	public void setGridIconSrcC(String gridIconSrcC) {
+		this.gridIconSrcC = gridIconSrcC;
+	}
+
+	public String getGridIconSrcL() {
+		return gridIconSrcL;
+	}
+
+	public void setGridIconSrcL(String gridIconSrcL) {
+		this.gridIconSrcL = gridIconSrcL;
+	}
+
+	public String getGridIconSrcP() {
+		return gridIconSrcP;
+	}
+
+	public void setGridIconSrcP(String gridIconSrcP) {
+		this.gridIconSrcP = gridIconSrcP;
+	}
+
+	public String getGridIconSrcV() {
+		return gridIconSrcV;
+	}
+
+	public void setGridIconSrcV(String gridIconSrcV) {
+		this.gridIconSrcV = gridIconSrcV;
+	}
+
+	public String getGridIconSrcX() {
+		return gridIconSrcX;
+	}
+
+	public void setGridIconSrcX(String gridIconSrcX) {
+		this.gridIconSrcX = gridIconSrcX;
+	}
+
+	public String getGridIconSrcY() {
+		return gridIconSrcY;
+	}
+
+	public void setGridIconSrcY(String gridIconSrcY) {
+		this.gridIconSrcY = gridIconSrcY;
+	}
+
+	public String getIconHeight() {
+		return iconHeight;
+	}
+
+	public void setIconHeight(String iconHeight) {
+		this.iconHeight = iconHeight;
+	}
+
+	public String getIconWidth() {
+		return iconWidth;
+	}
+
+	public void setIconWidth(String iconWidth) {
+		this.iconWidth = iconWidth;
+	}
+
+	public String getTemplateCssPath() {
+		return templateCssPath;
+	}
+
+	public void setTemplateCssPath(String templateCssPath) {
+		this.templateCssPath = templateCssPath;
+	}
+
+	public String getToggleDuration() {
+		return toggleDuration;
+	}
+
+	public void setToggleDuration(String toggleDuration) {
+		this.toggleDuration = toggleDuration;
+	}
+
+	public String getShowGrid() {
+		return showGrid;
+	}
+
+	public void setShowGrid(String showGrid) {
+		this.showGrid = showGrid;
+	}
 }
 

Modified: struts/action2/trunk/core/src/main/resources/META-INF/taglib.tld
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/resources/META-INF/taglib.tld?rev=408016&r1=408015&r2=408016&view=diff
==============================================================================
--- struts/action2/trunk/core/src/main/resources/META-INF/taglib.tld (original)
+++ struts/action2/trunk/core/src/main/resources/META-INF/taglib.tld Sat May 20 09:11:06 2006
@@ -132,6 +132,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -477,6 +485,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -1007,6 +1023,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -1313,6 +1337,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -1648,7 +1680,7 @@
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
 
-           <description><![CDATA[The toggle property.]]></description>
+           <description><![CDATA[The toggle property (either 'explode' or 'fade'). Default is 'fade'.]]></description>
 
       </attribute>
       <attribute>
@@ -1676,14 +1708,6 @@
 
       </attribute>
       <attribute>
-         <name>openAll</name>
-         <required>false</required>
-         <rtexprvalue>true</rtexprvalue>
-
-           <description><![CDATA[The openAll property.]]></description>
-
-      </attribute>
-      <attribute>
          <name>rootNode</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -1716,6 +1740,126 @@
 
       </attribute>
       <attribute>
+         <name>showRootGrid</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The showRootGrid property (default true).]]></description>
+
+      </attribute>
+      <attribute>
+         <name>blankIconSrc</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Blank icon image source.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>expandIconSrcMinus</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Expand icon (-) image source.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>expandIconSrcPlus</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Expand Icon (+) image source.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>gridIconSrcC</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Image source for under child item child icons.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>gridIconSrcL</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Image source for last child grid.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>gridIconSrcP</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Image source for under parent item child icons.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>gridIconSrcV</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Image source for vertical line.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>gridIconSrcX</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Image source for grid for sole root item.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>gridIconSrcY</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Image source for grid for last root item.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>iconHeight</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Icon height (default 18 pixels).]]></description>
+
+      </attribute>
+      <attribute>
+         <name>iconWidth</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Icon width (default 19 pixels).]]></description>
+
+      </attribute>
+      <attribute>
+         <name>templateCssPath</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Template css path (default {contextPath}/struts/tree.css.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>toggleDuration</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Toggle duration (default 150 ms)]]></description>
+
+      </attribute>
+      <attribute>
+         <name>showGrid</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[Show grid (default true).]]></description>
+
+      </attribute>
+      <attribute>
          <name>openTemplate</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -1724,6 +1868,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -2285,6 +2437,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -3006,6 +3166,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -3376,6 +3544,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -3845,6 +4021,14 @@
       <description><![CDATA[Render a hidden input field]]></description>
 
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -4102,6 +4286,14 @@
       <description><![CDATA[Stop double-submission of forms]]></description>
 
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -4359,6 +4551,14 @@
       <description><![CDATA[Render field error (all or partial depending on param tag nested)if they exists]]></description>
 
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -4641,6 +4841,14 @@
       <description><![CDATA[Render action messages if they exists]]></description>
 
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -4995,6 +5203,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>template</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -5334,6 +5550,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -5631,6 +5855,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -6304,6 +6536,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -6569,6 +6809,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -6923,6 +7171,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -7245,6 +7501,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -7518,6 +7782,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -7807,6 +8079,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -8064,6 +8344,14 @@
       <description><![CDATA[Render action errors if they exists]]></description>
 
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -8337,6 +8625,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -8675,6 +8971,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -8948,6 +9252,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -9205,6 +9517,14 @@
       <description><![CDATA[Render debug tag]]></description>
 
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -9494,6 +9814,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -9775,6 +10103,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -10104,6 +10440,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>template</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -10377,6 +10721,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -10698,6 +11050,14 @@
 
       </attribute>
       <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
+
+      </attribute>
+      <attribute>
          <name>theme</name>
          <required>false</required>
          <rtexprvalue>true</rtexprvalue>
@@ -11081,6 +11441,14 @@
          <rtexprvalue>true</rtexprvalue>
 
            <description><![CDATA[Set template to use for opening the rendered html.]]></description>
+
+      </attribute>
+      <attribute>
+         <name>templateDir</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+
+           <description><![CDATA[The template directory.]]></description>
 
       </attribute>
       <attribute>

Added: struts/action2/trunk/core/src/main/resources/org/apache/struts/action2/static/tree.css
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/resources/org/apache/struts/action2/static/tree.css?rev=408016&view=auto
==============================================================================
--- struts/action2/trunk/core/src/main/resources/org/apache/struts/action2/static/tree.css (added)
+++ struts/action2/trunk/core/src/main/resources/org/apache/struts/action2/static/tree.css Sat May 20 09:11:06 2006
@@ -0,0 +1,29 @@
+.dojoTree {
+	font: caption;
+	font-size: 11px;
+	font-weight: normal;
+	overflow: auto;
+}
+
+.dojoTreeNodeLabel {
+	padding: 1px 2px;
+	color: WindowText;
+	cursor: default;
+}
+
+.dojoTreeNodeLabel:hover {
+	text-decoration: underline;
+}
+
+.dojoTreeNodeLabelSelected {
+	background-color: Highlight;
+	color: HighlightText;
+}
+
+.dojoTree div {
+	white-space: nowrap;
+}
+
+.dojoTree img {
+	vertical-align: middle;
+}

Propchange: struts/action2/trunk/core/src/main/resources/org/apache/struts/action2/static/tree.css
------------------------------------------------------------------------------
    svn:eol-style = native

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=408016&r1=408015&r2=408016&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 Sat May 20 09:11:06 2006
@@ -6,8 +6,58 @@
         // dojo.hostenv.writeIncludes();
         -->
  </script>
-<div dojoType="Tree" showRootGrid="false" templateCssPath="${base}/css/Tree.css"
-    <#if parameters.id?exists>id="${parameters.id?html}"</#if>
+<div dojoType="Tree"   
+	<#if parameters.blankIconSrc?exists>
+	gridIconSrcT="<@saf.url value='${parameters.blankIconSrc}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcL?exists>
+	gridIconSrcL="<@saf.url value='${parameters.gridIconSrcL}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcV?exists>
+	gridIconSrcV="<@saf.url value='${parameters.gridIconSrcV}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcP?exists>
+	gridIconSrcP="<@saf.url value='${parameters.gridIconSrcP}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcC?exists>
+	gridIconSrcC="<@saf.url value='${parameters.gridIconSrcC}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcX?exists>
+	gridIconSrcX="<@saf.url value='${parameters.gridIconSrcX}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcY?exists>
+	gridIconSrcY="<@saf.url value='${parameters.gridIconSrcY}' encode="false" />"
+	</#if>
+	<#if parameters.gridIconSrcZ?exists>
+	gridIconSrcZ="<@saf.url value='${parameters.gridIconSrcZ}' encode="false" />"
+	</#if>
+	<#if parameters.expandIconSrcPlus?exists>
+	expandIconSrcPlus="<@saf.url value='${parameters.expandIconSrcPlus}' />"
+	</#if>
+	<#if parameters.expandIconSrcMinus?exists>
+	expandIconSrcMinus="<@saf.url value='${parameters.expandIconSrcMinus?html}' />"
+	</#if>
+	<#if parameters.iconWidth?exists>
+	iconWidth="<@saf.url value='${parameters.iconWidth?html}' encode="false" />"
+	</#if>
+	<#if parameters.iconHeight?exists>
+	iconHeight="<@saf.url value='${parameters.iconHeight?html}' encode="false" />"
+	</#if>
+	<#if parameters.toggleDuration?exists>
+	toggleDuration=${parameters.toggleDuration?c}
+	</#if>
+	<#if parameters.templateCssPath?exists>
+	templateCssPath="<@saf.url value='${parameters.templateCssPath}' encode="false" />"
+	</#if>
+	<#if parameters.showGrid?exists>
+	showGrid="${parameters.showGrid?default(true)?string}"
+	</#if>
+	<#if parameters.showRootGrid?exists>
+	showRootGrid="${parameters.showRootGrid?default(true)?string}"
+	</#if>
+    <#if parameters.id?exists>
+    id="${parameters.id?html}"
+    </#if>
     <#if parameters.treeSelectedTopic?exists>
     publishSelectionTopic="${parameters.treeSelectedTopic?html}"
     </#if>
@@ -18,14 +68,11 @@
     publishCollapsedTopic="${parameters.treeCollapsedTopic?html}"
     </#if>
     <#if parameters.toggle?exists>
-    toggle="${parameters.toggle}"
-    </#if>
-    <#if parameters.openAll?exists>
-    openAll="${parameters.openAll?string}"
+    toggle="${parameters.toggle?html}"
     </#if>
     >
     <#if parameters.label?exists>
-    <div dojoType="TreeNode" title="${parameters.label?html}"
+    <div dojoType="TreeNode" id="${parameters.id}_root" title="${parameters.label?html}"
     <#if parameters.nodeIdProperty?exists>
     id="${stack.findValue(parameters.nodeIdProperty)}"
     </#if>

Modified: struts/action2/trunk/core/src/main/resources/template/ajax/treenode.ftl
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/main/resources/template/ajax/treenode.ftl?rev=408016&r1=408015&r2=408016&view=diff
==============================================================================
--- struts/action2/trunk/core/src/main/resources/template/ajax/treenode.ftl (original)
+++ struts/action2/trunk/core/src/main/resources/template/ajax/treenode.ftl Sat May 20 09:11:06 2006
@@ -1,3 +1,6 @@
-<div dojoType="TreeNode"
+<div dojoType="TreeNode" 
+	<#if parameters.childIconSrc?exists>
+	childIconSrc="<@saf.url value='${parameters.childIconSrc}' encode="false" />"
+	</#if>
     <#if parameters.id?exists>id="${parameters.id?html}"</#if>
-    title="${parameters.label?html}">
+    title="${parameters.label}">

Added: struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/Category.java
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/Category.java?rev=408016&view=auto
==============================================================================
--- struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/Category.java (added)
+++ struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/Category.java Sat May 20 09:11:06 2006
@@ -0,0 +1,104 @@
+/*
+ * $Id: AbstractUITagTest.java 394477 2006-04-16 12:50:53Z tmjee $
+ *
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.action2.views.jsp.ui;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Used by Tree Component Test. Copied from showcase.
+ */
+public class Category {
+	private static Map<Long, Category> catMap = new HashMap<Long, Category>();
+
+    static {
+        new Category(1, "Root",
+                new Category(2, "Java",
+                        new Category(3, "Web Frameworks",
+                                new Category(4, "WebWork"),
+                                new Category(5, "Struts Action"),
+                                new Category(6, "Struts Shale"),
+                                new Category(7, "Stripes"),
+                                new Category(8, "Rife")),
+                        new Category(9, "Persistence",
+                                new Category(10, "iBatis"),
+                                new Category(11, "Hibernate"),
+                                new Category(12, "JDO"),
+                                new Category(13, "JDBC"))),
+                new Category(14, "JavaScript",
+                        new Category(15, "Dojo"),
+                        new Category(16, "Prototype"),
+                        new Category(17, "Scriptaculous"),
+                        new Category(18, "OpenRico"),
+                        new Category(19, "DWR")));
+    }
+
+    public static Category getById(long id) {
+        return catMap.get(id);
+    }
+
+    private long id;
+    private String name;
+    private List<Category> children;
+    private boolean toggle;
+
+    public Category(long id, String name, Category... children) {
+        this.id = id;
+        this.name = name;
+        this.children = new ArrayList<Category>();
+        for (Category child : children) {
+            this.children.add(child);
+        }
+
+        catMap.put(id, this);
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<Category> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<Category> children) {
+        this.children = children;
+    }
+
+    public void toggle() {
+        toggle = !toggle;
+    }
+
+    public boolean isToggle() {
+        return toggle;
+    }
+}

Propchange: struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/Category.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/TreeTest.java
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/TreeTest.java?rev=408016&view=auto
==============================================================================
--- struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/TreeTest.java (added)
+++ struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/TreeTest.java Sat May 20 09:11:06 2006
@@ -0,0 +1,133 @@
+/*
+ * $Id: AbstractUITagTest.java 394477 2006-04-16 12:50:53Z tmjee $
+ *
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.struts.action2.views.jsp.ui;
+
+import org.apache.struts.action2.views.jsp.AbstractUITagTest;
+
+import com.opensymphony.xwork.Action;
+import com.opensymphony.xwork.ActionSupport;
+
+/**
+ * Test case for Tree component.
+ */
+public class TreeTest extends AbstractUITagTest{
+	
+	public void testStaticTree() throws Exception {
+		// Root
+		TreeTag tag = new TreeTag();
+		tag.setShowRootGrid("false");
+		tag.setShowGrid("false");
+		tag.setTemplateCssPath("/struts/tree.css");
+		tag.setTheme("ajax");
+		tag.setPageContext(pageContext);
+		tag.setId("rootId");
+		tag.setLabel("Root");
+		tag.doStartTag();
+		
+			// Child 1
+			TreeNodeTag nodeTag1 = new TreeNodeTag();
+			nodeTag1.setTheme("ajax");
+			nodeTag1.setPageContext(pageContext);
+			nodeTag1.setId("child1");
+			nodeTag1.setLabel("Child 1");
+			nodeTag1.doStartTag();
+			nodeTag1.doEndTag();
+			
+			// Child 2
+			TreeNodeTag nodeTag2 = new TreeNodeTag();
+			nodeTag2.setTheme("ajax");
+			nodeTag2.setPageContext(pageContext);
+			nodeTag2.setId("child2");
+			nodeTag2.setLabel("Child 2");
+			nodeTag2.doStartTag();
+			
+				// Grand Child 1
+				TreeNodeTag gNodeTag1 = new TreeNodeTag();
+				gNodeTag1.setTheme("ajax");
+				gNodeTag1.setPageContext(pageContext);
+				gNodeTag1.setId("gChild1");
+				gNodeTag1.setLabel("Grand Child 1");
+				gNodeTag1.doStartTag();
+				gNodeTag1.doEndTag();
+			
+				// Grand Child 2
+				TreeNodeTag gNodeTag2 = new TreeNodeTag();
+				gNodeTag2.setTheme("ajax");
+				gNodeTag2.setPageContext(pageContext);
+				gNodeTag2.setId("gChild2");
+				gNodeTag2.setLabel("Grand Child 2");
+				gNodeTag2.doStartTag();
+				gNodeTag2.doEndTag();
+			
+				// Grand Child 3
+				TreeNodeTag gNodeTag3= new TreeNodeTag();
+				gNodeTag3.setTheme("ajax");
+				gNodeTag3.setPageContext(pageContext);
+				gNodeTag3.setId("gChild3");
+				gNodeTag3.setLabel("Grand Child 3");
+				gNodeTag3.doStartTag();
+				gNodeTag3.doEndTag();
+				
+			nodeTag2.doEndTag();
+			
+			
+			// Child 3
+			TreeNodeTag nodeTag3 = new TreeNodeTag();
+			nodeTag3.setTheme("ajax");
+			nodeTag3.setPageContext(pageContext);
+			nodeTag3.setId("child3");
+			nodeTag3.setLabel("Child 4");
+			nodeTag3.doStartTag();
+			nodeTag3.doEndTag();
+			
+		tag.doEndTag();
+		
+		//System.out.println(writer.toString());
+		verify(TreeTest.class.getResource("tree-1.txt"));
+	}
+	
+	
+	
+	public void testDynamicTree() throws Exception {
+		
+		TreeTag tag = new TreeTag();
+		tag.setPageContext(pageContext);
+		tag.setTheme("ajax");
+		tag.setId("myTree");
+		tag.setRootNode("%{myTreeRoot}");
+		tag.setNodeIdProperty("id");
+		tag.setNodeTitleProperty("name");
+		tag.setChildCollectionProperty("children");
+		tag.doStartTag();
+		tag.doEndTag();
+		
+		//System.out.println(writer.toString());
+		verify(TreeTest.class.getResource("tree-2.txt"));
+	}
+	
+	
+	public Action getAction() {
+		return new InternalActionSupport();
+	}
+	
+	public static class InternalActionSupport extends ActionSupport {
+		public Category getMyTreeRoot() {
+			return Category.getById(1);
+		}
+	}
+}

Propchange: struts/action2/trunk/core/src/test/java/org/apache/struts/action2/views/jsp/ui/TreeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-1.txt
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-1.txt?rev=408016&view=auto
==============================================================================
--- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-1.txt (added)
+++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-1.txt Sat May 20 09:11:06 2006
@@ -0,0 +1,42 @@
+<script language="JavaScript" type="text/javascript">
+        <!--
+        dojo.require("dojo.lang.*");
+        dojo.require("dojo.widget.*");
+        dojo.require("dojo.widget.Tree");
+        // dojo.hostenv.writeIncludes();
+        -->
+ </script>
+<div dojoType="Tree"   
+		templateCssPath="/struts/tree.css"
+	showGrid="false"
+	showRootGrid="false"
+    id="rootId"
+    toggle="fade"
+    >
+    <div dojoType="TreeNode" id="rootId_root" title="Root"
+    >
+<div dojoType="TreeNode" 
+	    id="child1"
+    title="Child 1">
+</div>
+<div dojoType="TreeNode" 
+	    id="child2"
+    title="Child 2">
+<div dojoType="TreeNode" 
+	    id="gChild1"
+    title="Grand Child 1">
+</div>
+<div dojoType="TreeNode" 
+	    id="gChild2"
+    title="Grand Child 2">
+</div>
+<div dojoType="TreeNode" 
+	    id="gChild3"
+    title="Grand Child 3">
+</div>
+</div>
+<div dojoType="TreeNode" 
+	    id="child3"
+    title="Child 4">
+</div>
+</div></div>
\ No newline at end of file

Propchange: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-1.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-2.txt
URL: http://svn.apache.org/viewvc/struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-2.txt?rev=408016&view=auto
==============================================================================
--- struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-2.txt (added)
+++ struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-2.txt Sat May 20 09:11:06 2006
@@ -0,0 +1,70 @@
+<script language="JavaScript" type="text/javascript">
+        <!--
+        dojo.require("dojo.lang.*");
+        dojo.require("dojo.widget.*");
+        dojo.require("dojo.widget.Tree");
+        // dojo.hostenv.writeIncludes();
+        -->
+ </script>
+<div dojoType="Tree"   
+	    id="myTree"
+    toggle="fade"
+    >
+    
+<div dojoType="TreeNode" title="Root" id="1">
+    
+<div dojoType="TreeNode" title="Java" id="2">
+    
+<div dojoType="TreeNode" title="Web Frameworks" id="3">
+    
+<div dojoType="TreeNode" title="WebWork" id="4">
+</div>
+    
+<div dojoType="TreeNode" title="Struts Action" id="5">
+</div>
+    
+<div dojoType="TreeNode" title="Struts Shale" id="6">
+</div>
+    
+<div dojoType="TreeNode" title="Stripes" id="7">
+</div>
+    
+<div dojoType="TreeNode" title="Rife" id="8">
+</div>
+</div>
+    
+<div dojoType="TreeNode" title="Persistence" id="9">
+    
+<div dojoType="TreeNode" title="iBatis" id="10">
+</div>
+    
+<div dojoType="TreeNode" title="Hibernate" id="11">
+</div>
+    
+<div dojoType="TreeNode" title="JDO" id="12">
+</div>
+    
+<div dojoType="TreeNode" title="JDBC" id="13">
+</div>
+</div>
+</div>
+    
+<div dojoType="TreeNode" title="JavaScript" id="14">
+    
+<div dojoType="TreeNode" title="Dojo" id="15">
+</div>
+    
+<div dojoType="TreeNode" title="Prototype" id="16">
+</div>
+    
+<div dojoType="TreeNode" title="Scriptaculous" id="17">
+</div>
+    
+<div dojoType="TreeNode" title="OpenRico" id="18">
+</div>
+    
+<div dojoType="TreeNode" title="DWR" id="19">
+</div>
+</div>
+</div>
+</div>
\ No newline at end of file

Propchange: struts/action2/trunk/core/src/test/resources/org/apache/struts/action2/views/jsp/ui/tree-2.txt
------------------------------------------------------------------------------
    svn:eol-style = native