You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by wesleywj2 <we...@yahoo.co.uk> on 2012/05/11 12:45:15 UTC

T5.3.1 How to expand all the tree nodes?

hi,

i need advice on how to expand the tree node with eventlink, currently based
on the example from 

http://jumpstart.doublenegative.com.au/jumpstart/examples/component/treebrowse
http://jumpstart.doublenegative.com.au/jumpstart/examples/component/treebrowse 

it has only the collapse function.

please advice

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-1-How-to-expand-all-the-tree-nodes-tp5702736.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.3.1 How to expand all the tree nodes?

Posted by wesleywj2 <we...@yahoo.co.uk>.
Hi Lance,

Thanks for the pointer, works great, thank you very much

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-1-How-to-expand-all-the-tree-nodes-tp5702736p5708795.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.3.1 How to expand all the tree nodes?

Posted by Lance Java <la...@googlemail.com>.
public void onExpandAll() {
   TreeExpansionModel expansionModel = tree.getExpansionModel();
   List<TreeNode> roots = getTreeModel().getRootnodes();
   for (TreeNode root : roots) {
      expandAll(root);
   }
}

private void expandAll(TreeNode node) {
   if (node.getHasChildren()) {
      expansionModel.markExpanded(node);
      for (TreeNode child : node.getChildren()) {
         expandAll(child); // this is a recursive call
      }
   }
}


--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-1-How-to-expand-all-the-tree-nodes-tp5702736p5708713.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.3.1 How to expand all the tree nodes?

Posted by wesleywj2 <we...@yahoo.co.uk>.
hi Lance,

can you give me an idea on recursive calling on this tree's deeply nested
object recursive call?

i just can't think of the way to this recursively, please advice and easy
example would be helpful. thank you

--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-1-How-to-expand-all-the-tree-nodes-tp5702736p5708646.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.3.1 How to expand all the tree nodes?

Posted by Lance Java <la...@googlemail.com>.
Page.tml
--------
<t:tree t:id="tree" t:model="treeModel" />

Page.java
---------
@InjectComponent Tree tree;

@Cached // use cached because this method may be called twice in a single
request
public TreeModel getTreeModel() {
   ...
}

public void onExpandAll() {
   TreeExpansionModel expansionModel = tree.getExpansionModel();
   List<TreeNode> roots = getTreeModel().getRootnodes();

   // recursively iterate the TreeNodes starting at the roots and call
TreeExpansionModel.markExpanded(node);
}


  
    

          


--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-1-How-to-expand-all-the-tree-nodes-tp5702736p5702872.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org