myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Heinen" <...@recommind.com>
Subject RE: TreeNodeChecked and t:treeCheckbox sample ?
Date Fri, 26 May 2006 14:29:02 GMT
Hi Wolf,

yes, I have this facet and did not have any problems.
Post your code, maybe s.o. can help you.

If you have more hierarchical facets then you don't need to nest them.
Just specify them. The nesting is done internally by processing the
children of the nodes. Of course you can use other images in the facets
or other styles for sublevel items.

See below sample:
My node types are "root", "category" and "document" and they must match
the facet names. Category is a subfolder of root. Document is an element
which can be below category or directly below root. It depends on the
creation.

<t:tree2 id="catTree" value="#{MyBean.myTree.treeData}" 
	var="node"
	varNodeToggler="t"
	clientSideToggle="false"
	showRootNode="true">

  <f:facet name="root">
      <h:panelGroup>
          <h:outputText value="All" styleClass="nodeFolder"/>
      </h:panelGroup>
  </f:facet>

  <f:facet name="category">
      <h:panelGroup>
          <t:selectBooleanCheckbox value="#{node.checked}"
 
valueChangeListener="#{MyBean.myTree.nodeChanged}"
 
title="#{node.identifier}"/>
          <h:outputText value="#{node.description}"
styleClass="nodeFolder"/>
          <h:outputText value=" (#{node.childCount})"
styleClass="childCount" rendered="#{!empty node.children}"/>
      </h:panelGroup>
  </f:facet>

  <f:facet name="document">
      <h:panelGroup>
          <t:selectBooleanCheckbox value="#{node.checked}"
 
valueChangeListener="#{MyBean.myTree.nodeChanged}"
 
title="#{node.identifier}"/>
            <h:outputText value="#{node.description}"/>

      </h:panelGroup>
  </f:facet>
</t:tree2>


Michael



-----Original Message-----
From: Wolf Benz [mailto:eurojava@gmail.com] 
Sent: Freitag, 26. Mai 2006 15:46
To: MyFaces Discussion
Subject: Re: TreeNodeChecked and t:treeCheckbox sample ?

Hi Michael,

Thanks for this contribution!
I have a question with yr code:
Your setup is:

<t:tree2 id="serverTree" value="# 
{SearchControllerBean.treeController.treeData}"

...

<f:facet name="document">

</f:facet>

</t:tree2>

...(code:)

       treeData = new TreeNodeBase("root-folder", "All", false);

         TreeNodeBase catNode = new TreeNodeBase("categories",  
"folder1", false);

         catNode.getChildren().add(new TreeNodeChecked("document",  
"doc1, true, true));

...

         treeData.getChildren().add(catNode);



         catNode = new TreeNodeBase("categories", "folder2", false);

         catNode.getChildren().add(new TreeNodeChecked("document",  
"doc5", true));

...

         treeData.getChildren().add(catNode);

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

--> From this , I understand (correct me if I'm wrong)

- the most inner element (the leafs of the tree; "document" in yr  
case) have a name that must match the "facet"-name inside tree2 AND  
match the "type" parameter of TreenNodeChecked.

My question:

You also have a "in-between" level: the "categories"-type. Yet you do  
not declare a facet for this. When I do that, I get a "Unable to  
locate facet with the name: categories"-exception.

Did you have this too & if so, how did you avoid it?

Plus, (extrapollating the question) is there a way to specify  
attributes for levels in between?

Suppose e.g. I wanted to have folders of depth 2 to be a blue folder- 
icon, of depth 3 a yellow icon, ... (to improve visibility), is the  
way to do this just by nesting facets?

e.g.

<facet name="categories">

	<t:graphicImage value="blue-folder-closed.png" border="0"/>

	<facet name="subCategories">

		<t:graphicImage value="yellow-folder-closed.png"
border="0"/>

...

	</facet>

</facet>










Mime
View raw message