git-svn-id: https://svn.apache.org/repos/asf/struts/action2/trunk@408016 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Toby Jee
2006-05-20 16:11:06 +00:00
parent 3d363a9213
commit 9cf677072d
11 changed files with 1262 additions and 59 deletions
@@ -25,17 +25,34 @@ import java.io.Writer;
* 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 @@ public class Tree extends ClosingUIBean {
addParameter("treeCollapsedTopic", findString(treeCollapsedTopic));
}
addParameter("openAll", Boolean.valueOf(openAll));
if (rootNodeAttr != null) {
addParameter("rootNode", findValue(rootNodeAttr));
}
@@ -92,6 +107,64 @@ public class Tree extends ClosingUIBean {
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 @@ public class Tree extends ClosingUIBean {
}
/**
* 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 @@ public class Tree extends ClosingUIBean {
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 class Tree extends ClosingUIBean {
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;
}
}
@@ -31,7 +31,6 @@ public class TreeNodeTag extends AbstractClosingTag {
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 @@ public class TreeNodeTag extends AbstractClosingTag {
this.label = label;
}
protected void populateParams() {
/*protected void populateParams() {
if (label != null) {
TreeNode treeNode = (TreeNode)component;
treeNode.setLabel(label);
}
super.populateParams();
}
}*/
}
@@ -34,15 +34,30 @@ public class TreeTag extends AbstractClosingTag {
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 @@ public class TreeTag extends AbstractClosingTag {
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 @@ public class TreeTag extends AbstractClosingTag {
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 class TreeTag extends AbstractClosingTag {
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;
}
}
+377 -9
View File
@@ -130,6 +130,14 @@
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -475,6 +483,14 @@
<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>
<name>theme</name>
@@ -1005,6 +1021,14 @@
<description><![CDATA[The actual HTML value attribute of the checkbox.]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -1311,6 +1335,14 @@
<description><![CDATA[HTML size attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -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>
@@ -1674,14 +1706,6 @@
<description><![CDATA[The treeCollapsedTopic property.]]></description>
</attribute>
<attribute>
<name>openAll</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The openAll property.]]></description>
</attribute>
<attribute>
<name>rootNode</name>
@@ -1714,6 +1738,126 @@
<description><![CDATA[The nodeIdProperty property.]]></description>
</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>
@@ -1722,6 +1866,14 @@
<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>
<name>theme</name>
@@ -2283,6 +2435,14 @@
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -3004,6 +3164,14 @@
<description><![CDATA[path where smilies are located]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -3374,6 +3542,14 @@
<description><![CDATA[The type of submit to use. Valid values are <i>input</i>, <i>button</i> and <i>image</i>.]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -3844,6 +4020,14 @@
<body-content>JSP</body-content>
<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>
@@ -4101,6 +4285,14 @@
<body-content>JSP</body-content>
<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>
@@ -4358,6 +4550,14 @@
<body-content>JSP</body-content>
<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>
@@ -4640,6 +4840,14 @@
<body-content>empty</body-content>
<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>
@@ -4993,6 +5201,14 @@
<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>
<name>template</name>
@@ -5332,6 +5548,14 @@
<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>
<name>theme</name>
@@ -5629,6 +5853,14 @@
<description><![CDATA[HTML size attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -6302,6 +6534,14 @@
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -6567,6 +6807,14 @@
<description><![CDATA[HTML for attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -6921,6 +7169,14 @@
<description><![CDATA[HTML size attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -7243,6 +7499,14 @@
<description><![CDATA[The type of submit to use. Valid values are <i>input</i>, <i>button</i> and <i>image</i>.]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -7516,6 +7780,14 @@
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -7805,6 +8077,14 @@
<description><![CDATA[HTML size attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -8063,6 +8343,14 @@
<body-content>empty</body-content>
<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>
@@ -8335,6 +8623,14 @@
<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>
<name>theme</name>
@@ -8673,6 +8969,14 @@
<description><![CDATA[HTML size attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -8946,6 +9250,14 @@
<description><![CDATA[Set to true to enable debugging mode for AJAX themes]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -9204,6 +9516,14 @@
<body-content>JSP</body-content>
<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>
@@ -9492,6 +9812,14 @@
<description><![CDATA[HTML wrap attribute]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -9773,6 +10101,14 @@
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -10102,6 +10438,14 @@
<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>
<name>template</name>
@@ -10375,6 +10719,14 @@
<description><![CDATA[Whether the table should be sortable. Requires that model implements org.apache.struts.action2.components.table.SortableTableModel if set to true.]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -10696,6 +11048,14 @@
<description><![CDATA[Property of list objects to get field content from]]></description>
</attribute>
<attribute>
<name>templateDir</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
<description><![CDATA[The template directory.]]></description>
</attribute>
<attribute>
<name>theme</name>
@@ -11082,6 +11442,14 @@
<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>
<name>template</name>
@@ -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;
}
+54 -7
View File
@@ -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>
@@ -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}">
@@ -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;
}
}
@@ -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);
}
}
}
@@ -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>
@@ -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>