FileDocCategorySizeDatePackage
Tree.javaAPI DocExample13523Mon Jul 23 13:26:36 BST 2007org.apache.struts2.components

Tree

public class Tree extends ClosingUIBean
Renders a tree widget with AJAX support.

The id attribute is normally specified, such that it could be looked up using javascript if necessary.

Examples



<-- statically -->
<s:tree id="..." label="...">
<s:treenode id="..." label="..." />
<s:treenode id="..." label="...">
<s:treenode id="..." label="..." />
<s:treenode id="..." label="..." />
&;lt;/s:treenode>
<s:treenode id="..." label="..." />
</s:tree>

<-- dynamically -->
<s:tree
id="..."
rootNode="..."
nodeIdProperty="..."
nodeTitleProperty="..."
childCollectionProperty="..." />


Fields Summary
private static final String
TEMPLATE
private static final String
OPEN_TEMPLATE
private String
toggle
private String
treeSelectedTopic
private String
treeExpandedTopic
private String
treeCollapsedTopic
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
Constructors Summary
public Tree(com.opensymphony.xwork2.util.ValueStack stack, HttpServletRequest request, HttpServletResponse response)


           
        super(stack, request, response);
    
Methods Summary
protected voidevaluateExtraParams()

        super.evaluateExtraParams();

        if (toggle != null) {
            addParameter("toggle", findString(toggle));
        }

        if (treeSelectedTopic != null) {
            addParameter("treeSelectedTopic", findString(treeSelectedTopic));
        }

        if (treeExpandedTopic != null) {
            addParameter("treeExpandedTopic", findString(treeExpandedTopic));
        }

        if (treeCollapsedTopic != null) {
            addParameter("treeCollapsedTopic", findString(treeCollapsedTopic));
        }

        if (rootNodeAttr != null) {
            addParameter("rootNode", findValue(rootNodeAttr));
        }

        if (childCollectionProperty != null) {
            addParameter("childCollectionProperty", findString(childCollectionProperty));
        }

        if (nodeTitleProperty != null) {
            addParameter("nodeTitleProperty", findString(nodeTitleProperty));
        }

        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 java.lang.StringgetBlankIconSrc()

        return blankIconSrc;
    
public java.lang.StringgetChildCollectionProperty()

        return childCollectionProperty;
    
public java.lang.StringgetDefaultOpenTemplate()

        return OPEN_TEMPLATE;
    
protected java.lang.StringgetDefaultTemplate()

        return TEMPLATE;
    
public java.lang.StringgetExpandIconSrcMinus()

        return expandIconSrcMinus;
    
public java.lang.StringgetExpandIconSrcPlus()

        return expandIconSrcPlus;
    
public java.lang.StringgetGridIconSrcC()

        return gridIconSrcC;
    
public java.lang.StringgetGridIconSrcL()

        return gridIconSrcL;
    
public java.lang.StringgetGridIconSrcP()

        return gridIconSrcP;
    
public java.lang.StringgetGridIconSrcV()

        return gridIconSrcV;
    
public java.lang.StringgetGridIconSrcX()

        return gridIconSrcX;
    
public java.lang.StringgetGridIconSrcY()

        return gridIconSrcY;
    
public java.lang.StringgetIconHeight()

        return iconHeight;
    
public java.lang.StringgetIconWidth()

        return iconWidth;
    
public java.lang.StringgetNodeIdProperty()

        return nodeIdProperty;
    
public java.lang.StringgetNodeTitleProperty()

        return nodeTitleProperty;
    
public java.lang.StringgetRootNode()

        return rootNodeAttr;
    
public java.lang.StringgetShowGrid()

        return showGrid;
    
public java.lang.StringgetShowRootGrid()

        return showRootGrid;
    
public java.lang.StringgetTemplateCssPath()

        return templateCssPath;
    
public java.lang.StringgetToggle()

        return toggle;
    
public java.lang.StringgetToggleDuration()

        return toggleDuration;
    
public java.lang.StringgetTreeCollapsedTopic()

        return treeCollapsedTopic;
    
public java.lang.StringgetTreeExpandedTopic()

        return treeExpandedTopic;
    
public java.lang.StringgetTreeSelectedTopic()

        return treeSelectedTopic;
    
public voidsetBlankIconSrc(java.lang.String blankIconSrc)

        this.blankIconSrc = blankIconSrc;
    
public voidsetChildCollectionProperty(java.lang.String childCollectionProperty)

        this.childCollectionProperty = childCollectionProperty;
    
public voidsetExpandIconSrcMinus(java.lang.String expandIconSrcMinus)

        this.expandIconSrcMinus = expandIconSrcMinus;
    
public voidsetExpandIconSrcPlus(java.lang.String expandIconSrcPlus)

        this.expandIconSrcPlus = expandIconSrcPlus;
    
public voidsetGridIconSrcC(java.lang.String gridIconSrcC)

        this.gridIconSrcC = gridIconSrcC;
    
public voidsetGridIconSrcL(java.lang.String gridIconSrcL)

        this.gridIconSrcL = gridIconSrcL;
    
public voidsetGridIconSrcP(java.lang.String gridIconSrcP)

        this.gridIconSrcP = gridIconSrcP;
    
public voidsetGridIconSrcV(java.lang.String gridIconSrcV)

        this.gridIconSrcV = gridIconSrcV;
    
public voidsetGridIconSrcX(java.lang.String gridIconSrcX)

        this.gridIconSrcX = gridIconSrcX;
    
public voidsetGridIconSrcY(java.lang.String gridIconSrcY)

        this.gridIconSrcY = gridIconSrcY;
    
public voidsetIconHeight(java.lang.String iconHeight)

        this.iconHeight = iconHeight;
    
public voidsetIconWidth(java.lang.String iconWidth)

        this.iconWidth = iconWidth;
    
public voidsetNodeIdProperty(java.lang.String nodeIdProperty)

        this.nodeIdProperty = nodeIdProperty;
    
public voidsetNodeTitleProperty(java.lang.String nodeTitleProperty)

        this.nodeTitleProperty = nodeTitleProperty;
    
public voidsetRootNode(java.lang.String rootNode)

        this.rootNodeAttr = rootNode;
    
public voidsetShowGrid(java.lang.String showGrid)

        this.showGrid = showGrid;
    
public voidsetShowRootGrid(java.lang.String showRootGrid)

        this.showRootGrid = showRootGrid;
    
public voidsetTemplateCssPath(java.lang.String templateCssPath)

        this.templateCssPath = templateCssPath;
    
public voidsetToggle(java.lang.String toggle)

        this.toggle = toggle;
    
public voidsetToggleDuration(java.lang.String toggleDuration)

        this.toggleDuration = toggleDuration;
    
public voidsetTreeCollapsedTopic(java.lang.String treeCollapsedTopic)

        this.treeCollapsedTopic = treeCollapsedTopic;
    
public voidsetTreeExpandedTopic(java.lang.String treeExpandedTopic)

        this.treeExpandedTopic = treeExpandedTopic;
    
public voidsetTreeSelectedTopic(java.lang.String treeSelectedTopic)

        this.treeSelectedTopic = treeSelectedTopic;
    
public booleanstart(java.io.Writer writer)

        boolean result = super.start(writer);

        if (this.label == null) {
            if ((rootNodeAttr == null)
                    || (childCollectionProperty == null)
                    || (nodeTitleProperty == null)
                    || (nodeIdProperty == null)) {
                fieldError("label","The TreeTag requires either a value for 'label' or ALL of 'rootNode', " +
                        "'childCollectionProperty', 'nodeTitleProperty', and 'nodeIdProperty'", null);
            }
        }
        return result;