Change the node contents to a commandLink with an updateActionListener and
in the "actionListener" method, toggle the expanded state of the node in the
tree state. Something like:

<t:tree2 var="node" binding="#{bean.tree}" ... >
<f:facet name="node">
<t:commandLink actionListener="#{bean.toggleNodeExpansion}">
<t:updateActionListener property="#{bean.activeNodePath}" value="#{
bean.tree.nodeId}" />
</t:commandLink>
</f:facet>
</t:tree2>

public class Bean {
 private UITreeData tree;
 private String activeNodePath;
 private TreeModel treeModel;
 public UITreeData getTree() { return this.tree; }
 public void setTree(UITreeData tree) { this.tree = tree; }
 public TreeModel getTreeModel() { return this.treeModel; }
 public String getActiveNodePath() { return this.activeNodePath; }
 public void setActiveNodePath(String activeNodePath) {
this.activeNodePath= activeNodePath; }
 public void toggleNodeExpansion(ActionEvent evt) {
   if (activeNodePath == null) return;
   treeModel.getTreeState().toggleExpanded(treeModel.getPathInformation
(activeNodePath));
 }
}

If you can get the node path (ie "0:1:2") without using the getNodeId
property then you can avoid using binding.

-Andrew


On 1/11/07, Jorge Vásquez <[EMAIL PROTECTED]> wrote:

 Regards to all,

First of all happy new year!!!



I have been trying to add the option to parent nodes so that  the user can
open each tree branch either by clicking on the "plus" or by clicking on the
name of the node (see image below).





In this image the node should open both by clicking the "plus" and by
clicking the folder name.  So far in order to open a node the only way is
clicking on the "plus".



Is this possible?  Does anybody have some sample code where this works?



Thanks in advance,

JV

<<attachment: image001.jpg>>

Reply via email to