org.apache.struts2.dojo.components
Class Tree
java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.UIBean
org.apache.struts2.components.ClosingUIBean
org.apache.struts2.dojo.components.Tree
public class Tree
- extends ClosingUIBean
Renders a tree widget with AJAX support.
The "id "attribute is normally specified(recommended), such that it could be looked up using
javascript if necessary. The "id" attribute is required if the "selectedNotifyTopic" or the
"href" attributes are going to be used.
<s:tree id="..." label="...">
<s:treenode id="..." label="..." />
<s:treenode id="..." label="...">
<s:treenode id="..." label="..." />
<s:treenode id="..." label="..." />
</s:treenode>
<s:treenode id="..." label="..." />
</s:tree>
<s:tree
id="..."
rootNode="..."
nodeIdProperty="..."
nodeTitleProperty="..."
childCollectionProperty="..." />
<s:url id="nodesUrl" namespace="/nodecorate" action="getNodes" />
<div style="float:left; margin-right: 50px;">
<sx:tree id="tree" href="%{#nodesUrl}" />
</div>
On this example the url specified on the "href" attibute will be called to load
the elements on the root. The response is expected to be a JSON array of objects like:
[
{
label: "Node 1",
hasChildren: false,
id: "Node1"
},
{
label: "Node 2",
hasChildren: true,
id: "Node2"
},
]
"label" is the text that will be displayed for the node. "hasChildren" marks the node has
having children or not (if true, a plus icon will be assigned to the node so it can be
expanded). The "id" attribute will be used to load the children of the node, when the node
is expanded. When a node is expanded a request will be made to the url in the "href" attribute
and the node's "id" will be passed in the parameter "nodeId".
The children collection for a node will be loaded only once, to reload the children of a
node, use the "reload()" function of the treenode widget. To reload the children nodes of "Node1"
from the example above use the following javascript:
dojo.widget.byId("Node1").reload();
Fields inherited from class org.apache.struts2.components.UIBean |
accesskey, cssClass, cssErrorClass, cssErrorStyle, cssStyle, defaultTemplateDir, defaultUITheme, disabled, dynamicAttributes, errorPosition, id, javascriptTooltip, key, label, labelPosition, labelSeparator, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, requiredLabel, requiredPosition, response, tabindex, template, templateDir, templateEngineManager, templateSuffix, theme, title, tooltip, tooltipConfig, tooltipCssClass, tooltipDelay, tooltipIconPath, uiThemeExpansionToken, value |
Constructor Summary |
Tree(com.opensymphony.xwork2.util.ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
|
Methods inherited from class org.apache.struts2.components.UIBean |
addFormParameter, buildTemplateName, copyParams, enableAncestorFormCustomOnsubmit, end, ensureAttributeSafelyNotEscaped, escape, evaluateNameValue, evaluateParams, getId, getTemplate, getTemplateDir, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setClass, setCssErrorClass, setCssErrorStyle, setDefaultTemplateDir, setDefaultUITheme, setDisabled, setDynamicAttributes, setErrorPosition, setJavascriptTooltip, setKey, setLabel, setLabelposition, setLabelSeparator, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequiredLabel, setRequiredPosition, setStyle, setTabindex, setTemplate, setTemplateDir, setTemplateEngineManager, setTitle, setTooltip, setTooltipConfig, setTooltipCssClass, setTooltipDelay, setTooltipIconPath, setUIThemeExpansionToken, setValue |
Methods inherited from class org.apache.struts2.components.Component |
addAllParameters, addParameter, altSyntax, completeExpressionIfAltSyntax, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, getStandardAttributes, isValidTagAttribute, popComponentStack, setActionMapper, setThrowExceptionsOnELFailure, setUrlHelper, stripExpressionIfAltSyntax, toString, usesBody |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
toggle
protected String toggle
selectedNotifyTopics
protected String selectedNotifyTopics
expandedNotifyTopics
protected String expandedNotifyTopics
collapsedNotifyTopics
protected String collapsedNotifyTopics
rootNodeAttr
protected String rootNodeAttr
childCollectionProperty
protected String childCollectionProperty
nodeTitleProperty
protected String nodeTitleProperty
nodeIdProperty
protected String nodeIdProperty
showRootGrid
protected String showRootGrid
showGrid
protected String showGrid
blankIconSrc
protected String blankIconSrc
gridIconSrcL
protected String gridIconSrcL
gridIconSrcV
protected String gridIconSrcV
gridIconSrcP
protected String gridIconSrcP
gridIconSrcC
protected String gridIconSrcC
gridIconSrcX
protected String gridIconSrcX
gridIconSrcY
protected String gridIconSrcY
expandIconSrcPlus
protected String expandIconSrcPlus
expandIconSrcMinus
protected String expandIconSrcMinus
iconWidth
protected String iconWidth
iconHeight
protected String iconHeight
toggleDuration
protected String toggleDuration
templateCssPath
protected String templateCssPath
href
protected String href
errorNotifyTopics
protected String errorNotifyTopics
Tree
public Tree(com.opensymphony.xwork2.util.ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
start
public boolean start(Writer writer)
- Overrides:
start
in class ClosingUIBean
evaluateExtraParams
protected void evaluateExtraParams()
- Overrides:
evaluateExtraParams
in class UIBean
addChildrenId
public void addChildrenId(String id)
setTheme
public void setTheme(String theme)
- Overrides:
setTheme
in class UIBean
getTheme
public String getTheme()
- Overrides:
getTheme
in class UIBean
getDefaultOpenTemplate
public String getDefaultOpenTemplate()
- Specified by:
getDefaultOpenTemplate
in class ClosingUIBean
getDefaultTemplate
protected String getDefaultTemplate()
- Specified by:
getDefaultTemplate
in class UIBean
getToggle
public String getToggle()
setToggle
public void setToggle(String toggle)
setTreeSelectedTopic
public void setTreeSelectedTopic(String selectedNotifyTopic)
setTreeExpandedTopics
public void setTreeExpandedTopics(String expandedNotifyTopic)
setTreeCollapsedTopics
public void setTreeCollapsedTopics(String collapsedNotifyTopic)
getRootNode
public String getRootNode()
setRootNode
public void setRootNode(String rootNode)
getChildCollectionProperty
public String getChildCollectionProperty()
setChildCollectionProperty
public void setChildCollectionProperty(String childCollectionProperty)
getNodeTitleProperty
public String getNodeTitleProperty()
setNodeTitleProperty
public void setNodeTitleProperty(String nodeTitleProperty)
getNodeIdProperty
public String getNodeIdProperty()
setNodeIdProperty
public void setNodeIdProperty(String nodeIdProperty)
setShowRootGrid
public void setShowRootGrid(String showRootGrid)
getShowRootGrid
public String getShowRootGrid()
getBlankIconSrc
public String getBlankIconSrc()
setBlankIconSrc
public void setBlankIconSrc(String blankIconSrc)
getExpandIconSrcMinus
public String getExpandIconSrcMinus()
setExpandIconSrcMinus
public void setExpandIconSrcMinus(String expandIconSrcMinus)
getExpandIconSrcPlus
public String getExpandIconSrcPlus()
setExpandIconSrcPlus
public void setExpandIconSrcPlus(String expandIconSrcPlus)
getGridIconSrcC
public String getGridIconSrcC()
setGridIconSrcC
public void setGridIconSrcC(String gridIconSrcC)
getGridIconSrcL
public String getGridIconSrcL()
setGridIconSrcL
public void setGridIconSrcL(String gridIconSrcL)
getGridIconSrcP
public String getGridIconSrcP()
setGridIconSrcP
public void setGridIconSrcP(String gridIconSrcP)
getGridIconSrcV
public String getGridIconSrcV()
setGridIconSrcV
public void setGridIconSrcV(String gridIconSrcV)
getGridIconSrcX
public String getGridIconSrcX()
setGridIconSrcX
public void setGridIconSrcX(String gridIconSrcX)
getGridIconSrcY
public String getGridIconSrcY()
setGridIconSrcY
public void setGridIconSrcY(String gridIconSrcY)
getIconHeight
public String getIconHeight()
setIconHeight
public void setIconHeight(String iconHeight)
getIconWidth
public String getIconWidth()
setIconWidth
public void setIconWidth(String iconWidth)
getTemplateCssPath
public String getTemplateCssPath()
setTemplateCssPath
public void setTemplateCssPath(String templateCssPath)
getToggleDuration
public String getToggleDuration()
setToggleDuration
public void setToggleDuration(String toggleDuration)
getShowGrid
public String getShowGrid()
setShowGrid
public void setShowGrid(String showGrid)
setCssClass
public void setCssClass(String cssClass)
- Overrides:
setCssClass
in class UIBean
setCssStyle
public void setCssStyle(String cssStyle)
- Overrides:
setCssStyle
in class UIBean
setId
public void setId(String id)
- Overrides:
setId
in class UIBean
setName
public void setName(String name)
- Overrides:
setName
in class UIBean
setCollapsedNotifyTopics
public void setCollapsedNotifyTopics(String collapsedNotifyTopics)
setExpandedNotifyTopics
public void setExpandedNotifyTopics(String expandedNotifyTopics)
setSelectedNotifyTopics
public void setSelectedNotifyTopics(String selectedNotifyTopics)
setHref
public void setHref(String href)
setErrorNotifyTopics
public void setErrorNotifyTopics(String errorNotifyTopics)
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.