myfaces tree2 determine when + nodeb on tree2 is clicked to load children

Hi,

I'm trying to create a lazy node tree but I'm having problem trying to call a method to load the child nodes when the + is selected on the tree.

I want to create a tree that will load the devices on demand so I've created a server side tree.

<t:tree2 id="serverTree" value="#{treeBacker.treeData}" var="node" varNodeToggler="t" clientSideToggle="false" showRootNode="false">

<f:facet name="omcs">

<h:panelGroup>

XX

<f:facet name="expand">

<t:graphicImage value="images/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>

</f:facet>

<f:facet name="collapse">

<t:graphicImage value="images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>

</f:facet>

<h:outputText value="#{node.description}" styleClass="nodeFolder"/>

</h:panelGroup>

</f:facet>

<f:facet name="foo-folder">

<h:panelGroup>

<f:facet name="expand">

<t:graphicImage value="images/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>

</f:facet>

<f:facet name="collapse">

<t:graphicImage value="images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>

</f:facet>

<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="bar-folder">

<h:panelGroup>

<f:facet name="expand">

<t:graphicImage value="images/blue-folder-open.gif" rendered="#{t.nodeExpanded}" border="0"/>

</f:facet>

<f:facet name="collapse">

<t:graphicImage value="images/blue-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>

</f:facet>

<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>

<h:commandLink immediate="true" styleClass="#{t.nodeSelected ? 'documentSelected':'document'}" actionListener="#{t.setNodeSelected}">

<t:graphicImage value="images/document.png" border="0"/>

<h:outputText value="#{node.description}"/>

<f:param name="docNum" value="#{node.identifier}"/>

</h:commandLink>

</h:panelGroup>

</f:facet>

</t:tree2>

</h:form>

was trying to add the text to above

<h:commandLink> action="#{t.toggleExpanded}" actionListener=="#{treeBacker.loadChildren}">

</h:commandLink>

to call the method to load

children nodes. Had it inserted at XX above.

Any ideas would be greatly appreciated.

Thanks

[3106 byte] By [Lou1223a] at [2007-10-3 6:11:13]
# 1

There is an easier way to lazy load tree. The following links has more information.

http://wiki.apache.org/myfaces/Tree2

http://andrewfacelets.blogspot.com/2006/06/myfaces-tree2-creating-lazy-loading.html

Basically it involves using getChildren method of TreeNodeBase to load the data.

Hope this helps

m~

manalara at 2007-7-15 0:54:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks m. I'm using the second method whereby lazy loading happens in the extended treeNode however I want to manipulate the getChildren() to get the context so that I can load certain children based on what is beside the + selected.Is this possible?Thanks for your
Lou1223a at 2007-7-15 0:54:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...