You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Rogerio Pereira <ro...@gmail.com> on 2006/11/29 12:00:40 UTC

How to use TreeNodeChecked?

Hi guys!

I need use Tree2 with TreeNodeChecked but when i try read the checked
property i'm getting a propertynotfoundexception.

Any ideas about how to fix this?

-- 
Yours truly (Atenciosamente),

Rogério (_rogerio_)
http://faces.eti.br

"Faça a diferença! Ajude o seu país a crescer, não retenha conhecimento,
distribua e aprenda mais." (http://faces.eti.br/?p=45)

Re: How to use TreeNodeChecked?

Posted by Matthias Wessendorf <ma...@apache.org>.
I used it this way:

JSP:
...
<t:tree2 id="tree" value="#{tree.tree}" clientSideToggle="true"
varNodeToggler="t" var="node">
 <f:facet name="analysisFolder">
 <h:panelGroup>
  <h:selectBooleanCheckbox value="#{node.checked}" />
   <t:graphicImage value="images/yellow-folder-closed.png" border="0"/>
   <h:outputText value="#{node.description}" styleClass="nodeFolder"/>
 </h:panelGroup>
 </f:facet>
 ...
</t:tree2>
<h:commandLink value="GO" action="#{tree.processNodes}"/>
</h:form>
...


Backing Bean (constructor or init() in case of Shale's ViewControler)
(btw. AnalysisFolder is an business object of me...)

-------------------------

tree = new TreeNodeBase("root","Analyses",false);

for (Iterator iter = listOfAnalysisFolders.iterator(); iter.hasNext();) {
 AnalysisFolder element = (AnalysisFolder) iter.next();
 tree.getChildren().add(
    new TreeNodeChecked("analysisFolder", element.getName(),
element.getId(), false, true));
 selectedIds.add(new SelectItem(element.getId()));
}


-------------------------


action method:

-------------------------

public String processNodes(){
 List childs = tree.getChildren();
 for (Iterator iter = childs.iterator(); iter.hasNext();) {
   TreeNodeChecked element = (TreeNodeChecked) iter.next();
   if(element.isChecked()==true) {
     //do...
   }
 }
 ...
}

On 11/29/06, Rogerio Pereira <ro...@gmail.com> wrote:
> Hi guys!
>
> I need use Tree2 with TreeNodeChecked but when i try read the checked
> property i'm getting a propertynotfoundexception.
>
> Any ideas about how to fix this?
>
> --
> Yours truly (Atenciosamente),
>
> Rogério (_rogerio_)
> http://faces.eti.br
>
> "Faça a diferença! Ajude o seu país a crescer, não retenha conhecimento,
> distribua e aprenda mais." ( http://faces.eti.br/?p=45)


-- 
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com