You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/03/21 13:06:38 UTC

Re: tree2 and expandAll question

Hi all,

 

I need also an expanded tree without navigation icons and I don't know how to achieve this.

Do you have a sample of how to use the (new) TreeWalker?  Is it part of 1.1.2 or 1.1.3 ?

 

Or does anybody know an alternative which can be used with stable 1.1.1 ?

 

Michael

 

 

> List:       myfaces-user

> Subject:    Re: show an expanded tree2 (MyFaces-1.1.1 on JDeveloper 10.1.3 EA)

> From:       Sean Schofield <sean.schofield () gmail ! com>

> Date:       2006-02-17 3:26:26

> Message-ID: 2387fbc50602161926g7f05aab9h677d5bf230fa5da4 () mail ! gmail ! com

> [Download message RAW]

> 

> Take a look at the stuff I just checked in.  I believe the new
> TreeWalker stuff now gives you the ability to set the expanded state
> of tree nodes *before* rendering.  I haven't tested that aspect though
> so let me know what you think.
> 
> Sean
 
 
> On 1/31/06, Cristofer Weber <cr...@gmail.com> wrote:
> Hans, thanks for the explanations. I think there's another thing in my code
> that is not working because I get a NullPointerException when I try to call
> expandAll after building the tree data. When debugging the code I see a
> empty instance of HtmlTree class even after some iterations with buttons
> that expand e collapse the nodes.
> 
> I will try to recreate the app in a simplified way to see what's wrong.
> 
> thanks!
> 
> 
> Cristofer
> 
> 2006/1/27, Hans Sowa <hanssowa@gmail.com >:
> > Hm
> >
> > I'm not sure wheter I understand you correctly. You don't need a action
> like commandlink, etc. For instance in the code where you provide the data
> for the tree you can call the function afterwards. This should work.
> >
> >
> >
> > 2006/1/27, Cristofer Weber < cris.weber@gmail.com>:
> > > Hi Hans! First, thanks.
> > >
> > > When I´ve created a page whith a commandLink this way works fine, but
> how can I call the expandAll method without an action like the commandLink?
> How can I load the page with the tree2 in the expanded state without start
> an event? I did'nt find examples or information.
> > >
> > > Thanks a lot.
> > >
> > > []'s
> > >
> > > Cristofer
> > >
> > >
> > > 2006/1/27, Hans Sowa < hanssowa@gmail.com>:
> > >
> > > > Hi Cristofer
> > > >
> > > > I know way which is also explain in the examples as I know (I think, I
> believe,..)
> > > >
> > > > First you have to to a binding to the tree2 component.
> > > >
> > > > <t:tree2 ... binding="#{ managed-been.tree}">
> > > >
> > > > Then you have to implement the following code in your managed bean:
> > > >
> > > > /** Reference to the tree. */
> > > >     private HtmlTree tree;
> > > >
> > > >  /**
> > > >      * @return Returns the tree.
> > > >      */
> > > >     public HtmlTree getTree() {
> > > >         return this.tree;
> > > >     }
> > > >
> > > >     /**
> > > >      * @param tree The tree to set.
> > > >      */
> > > >     public void setTree(final HtmlTree tree) {
> > > >         this.tree = tree;
> > > >     }
> > > >
> > > >     /**
> > > >      * Öffnet den gesamten Baum.
> > > >      *
> > > >      */
> > > >     public void expandAll() {
> > > >         this.getTree().expandAll();
> > > >     }
> > > >
> > > > So, with the expandAll fuction you can expand the whole tree.
> > > >
> > > > Hope this helps.
> > > >
> > > > best regards Hans
> > > >
> > > >
> > > > 2006/1/27, Cristofer Weber < cris.weber@gmail.com>:
> > > >
> > > > > Hi friends
> > > > >
> > > > > after some days using the examples, I'm trying to create a page with
> an expanded tree2 component, but I'm with some difficults to do so.
> > > > >
> > > > > My first try was a PhaseListener getting the ViewRoot and navigating
> to the tree2 component for send a expandAll message, but without success.
> > > > >
> > > > >
> > > > >
> > > > > Then, I create my TreeModel extending the TreeModelBase and after
> the load of my nodes I search for all leafNodes to send a expandPath using
> the getPathInformation for each node, also without success.
> > > > >
> > > > >
> > > > > In both tries the tree2 loads correctly, but in the collapsed state.
> > > > >
> > > > >
> > > > > I'm in the way or there's another way to do it?
> > > > >
> > > > >
> > > > > Thanks a lot!
> > > > >
> > > > >
> > > > > Cristofer
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > mfg Hans Sowa
> > > > mailto:hanssowa@gmail.com
> > >
> > >
> >
> >
> >
> > --
> > mfg Hans Sowa
> > mailto:hanssowa@gmail.com
> 
>