Class Tree
- java.lang.Object
-
- org.apache.tapestry5.corelib.components.Tree
-
@Events({"nodeSelected","nodeUnselected"}) @Import(module="t5/core/tree") public class Tree extends Object
A component used to render a recursive tree structure, with expandable/collapsable/selectable nodes. The data that is displayed by the component is provided as aTreeModel
. A secondary model, theTreeExpansionModel
, is used to track which nodes have been expanded. The optionalTreeSelectionModel
is used to track node selections (as currently implemented, only leaf nodes may be selected). Tree is not a form control component; all changes made to the tree on the client (expansions, collapsing, and selections) are propagated immediately back to the server. The Tree component uses special tricks to support recursive rendering of the Tree as necessary.- Since:
- 5.3
Component Parameters Name Type Flags Default Default Prefix class String literal Allows the container to specify additional CSS class names for the outer DIV element. The outer DIV always has the class name "tree-container"; the additional class names are typically used to apply a specific size and width to the component. expansionModel org. apache. tapestry5. tree. TreeExpansionModel Not Null defaultTreeExpansionModel prop Used to control the Tree's expansion model. By default, a persistent field inside the Tree component stores a DefaultTreeExpansionModel. This parameter may be bound when more control over the implementation of the expansion model, or how it is stored, is required. label org. apache. tapestry5. runtime. RenderCommand block: defaultRenderTreeNodeLabel prop A renderable (usually a Block) that can render the label for a tree node. This will be invoked after the #value parameter has been updated. model org. apache. tapestry5. tree. TreeModel Required prop The model that drives the tree, determining top level nodes and making revealing the overall structure of the tree. node org. apache. tapestry5. tree. TreeNode prop Optional parameter used to inform the container about what TreeNode is currently rendering; this is primarily used when the label parameter is bound. selectionModel org. apache. tapestry5. tree. TreeSelectionModel prop Used to control the Tree's selections. When this parameter is bound, then the client-side Tree will track what is selected or not selected, and communicate this (via Ajax requests) up to the server, where it will be recorded into the model. On the client-side, the Tree component will add or remove the selected-leaf-node-label
CSS class fromspan.tree-label
for the node.value Object prop Optional parameter used to inform the container about the value of the currently rendering TreeNode; this is often preferable to the TreeNode, and like the node parameter, is primarily used when the label parameter is bound. Component Events Name Description nodeSelected nodeUnselected
-
-
Constructor Summary
Constructors Constructor Description Tree()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearExpansions()
Clears the tree'sTreeExpansionModel
.String
getContainerClass()
TreeExpansionModel
getDefaultTreeExpansionModel()
TreeExpansionModel
getExpansionModel()
Returns the actualTreeExpansionModel
in use for this Tree component, as per the expansionModel parameter.Object
getRenderRootNodes()
Boolean
getSelectionEnabled()
TreeSelectionModel
getSelectionModel()
Returns the actualTreeSelectionModel
in use for this Tree component, as per theselectionModel
parameter.Link
getTreeActionLink()
-
-
-
Constructor Detail
-
Tree
public Tree()
-
-
Method Detail
-
getContainerClass
public String getContainerClass()
-
getTreeActionLink
public Link getTreeActionLink()
-
getDefaultTreeExpansionModel
public TreeExpansionModel getDefaultTreeExpansionModel()
-
getExpansionModel
public TreeExpansionModel getExpansionModel()
Returns the actualTreeExpansionModel
in use for this Tree component, as per the expansionModel parameter. This is often, but not always, the same asgetDefaultTreeExpansionModel()
.
-
getSelectionModel
public TreeSelectionModel getSelectionModel()
Returns the actualTreeSelectionModel
in use for this Tree component, as per theselectionModel
parameter.
-
getRenderRootNodes
public Object getRenderRootNodes()
-
clearExpansions
public void clearExpansions()
Clears the tree'sTreeExpansionModel
.
-
getSelectionEnabled
public Boolean getSelectionEnabled()
-
-