File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

treenode with all sub-nodes automatically selected

 
Cedric Chaveriat
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm a beginner in jsf

I have scientific data with tree organization it could be ecosystems, species, keywords...

aquatic
> freshwater
> marine
terrestrial
> forest
> mountain
...

for searching in a database I want allow user to select nodes in a treenode
I'm using <rich:treeNode> and it works

<rich:treeNode icon="images/branch.gif" iconLeaf="images/blank.gif" reRender="listeEcosystemNodes" >
<h:selectBooleanCheckbox value="#{searchLabsBean.checkMapEcosystem[item]}">
<a4j:support event="onclick" action="#{searchLabsBean.getSelectedEcosystem}" reRender="listeEcosystemNodes"/>
</h:selectBooleanCheckbox> 
<hutputText value="#{item}" />
</rich:treeNode>

with :
private Map<String,Boolean> checkMapEcosystem = new HashMap<String,Boolean>();
in SearchLabsBean

( getSelectedEcosystem is a method for append selected ecosystems in a String, it's just a feedback for the user )

BUT I want that if a user select aquatic for example, then freshwater and marine will be automatically selected ant not only the direct child but all the nodes under aquatic
AND if a user unselected a node all this sub-nodes will be unselected too

I want a solution with the graphical component how can I get child nodes of the selected node from the <rich:treeNode> and (un)select them ?
If <rich:treeNode> couldn't work, are they other components that could do the job ?

thank you for your help
 
Cedric Chaveriat
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forget something

<rich:tree style="margin: 10px; width:700px" binding="#{searchLabosBean.ecosystemTreeBinding}" value="#{searchLabosBean.ecosystemTreeNode}" var="item" ajaxKeys="#{null}" >
<rich:treeNode icon="images/branch.gif" iconLeaf="images/blank.gif" reRender="listeEcosystemNodes" >
<h:selectBooleanCheckbox value="#{searchLabsBean.checkMapEcosystem[item]}">
<a4j:support event="onclick" action="#{searchLabsBean.getSelectedEcosystem}" reRender="listeEcosystemNodes"/>
</h:selectBooleanCheckbox> 
<hutputText value="#{item}" />
</rich:treeNode>
</rich:tree>

class SearchLabsBean
private org.richfaces.component.UITree ecosystemTreeBinding ;
private static org.richfaces.model.TreeNode ecosystemTreeNode ;
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic