You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Cristofer Weber <cr...@gmail.com> on 2006/01/27 09:50:09 UTC

show an expanded tree2 (MyFaces-1.1.1 on JDeveloper 10.1.3 EA)

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

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

Posted by Sean Schofield <se...@gmail.com>.
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
>
>

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

Posted by Cristofer Weber <cr...@gmail.com>.
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 <ha...@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 <cr...@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
>

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

Posted by Hans Sowa <ha...@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 <cr...@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 <ha...@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

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

Posted by Cristofer Weber <cr...@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 <ha...@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 <cr...@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

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

Posted by Hans Sowa <ha...@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 <cr...@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