Yes, we did the same thing, although we supply our own +/- GIFs so we
still get kind of the same effect as using the ones supplied with the
component.

I haven't looked at the component much lately, though, so I don't know
if it has been re-architected to allow the programmer to intercept the
expand event that is triggered if we have showNav="true".  Sean, can you
comment on this?

- Brendan

-----Original Message-----
From: Marcel Ruff [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 06, 2005 5:02 AM
To: MyFaces Discussion
Subject: Re: Tree2 - on-demand load capable?


Eric Pias wrote:

> Hello,
>
>  
>
> I would like to implement a Tree2 that loads child nodes on demand.  
> What I would like to do is sub-class TreeNode or something else and 
> when the user clicks the + on a node, at that point my code would go 
> out and get just the first level children under that node.  I have 
> tried implementing TreeNode and doing this type on functionality in 
> getChildren() without success so far.  Before I spend a lot more time 
> debugging, I want to make sure that Tree2 allows for what I want to 
> do.  Does anyone know for sure?
>
>  
>
> Thanks,
>
> Eric
>
Hi Eric,

i have the same task and after searching the mailing list i ended up
with a workaround i found in an old mail (i can't remember who posted
it).

The problem with this workaround is that i needed to remove the '+' icon

with
   <t:tree2 ... showNav="false" ...>

and make the folder icon clickable with

  <h:commandLink action="#{t.toggleExpanded}" 
actionListener="#{navigationBacker.processAction}">

In my NavigationBacker.java:processAction(ActionEvent e)
i load the children nodes with data from EJB3-persistency.

The bad thing is that the '+' icon is now invisible, but i couldn't
find a way to get the event when somebody clicks on the '+' icon.
The org.apache.myfaces.custom.tree2.HtmlTree.java seems to register
_expandControl = new HtmlCommandLink();
to get internally the '+' clicks, but i haven't found a way to
receive the clicks in my code.

I have added this with some code snippets to the Wiki page at

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

Please edit the page if you have a better solution,

rgds
Marcel

Reply via email to