You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Eric Pias <er...@Tangoe.com> on 2005/10/05 15:07:25 UTC

Tree2 - on-demand load capable?

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


Re: Tree2 - on-demand load capable?

Posted by Anu Padki <AM...@lbl.gov>.
I had been reading yr wiki page and have some qs on it.
The facet used in yr code is projekt-folder, is that a renderer/facet you 
had to write in order to implement the lazy load?
The other question is how do I find all available facets for a myfaces 
renderer and is how do you write a component such as a renderer and 
integrate t witht the code, using only tomahawk.jar.
I am sorry to bother you with such dump questions.
Thanks fo rth ewiki page.
- Anu

At 12:02 PM 10/6/2005 +0200, you wrote:
>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



Re: Tree2 - on-demand load capable?

Posted by Marcel Ruff <mr...@marcelruff.info>.
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