Brendan,
Sorry I haven't been able to respond in detail to your tree2 issues.
I'm glad that you and other users are finding it useful and I'm
willing to work with everyone to make some more improvements. There
are a few know issues (like RI compatability) that are on the top of
the list. There are other issues (like being able to supply your own
data model, specfify which nodes are open by default) that I also hope
to get to. There seems to be enough interest so I'll try and get us
started once the reorg is done.
Regarding your actionListener request. I can see how
<f:actionListener> would work but it should be even simpler then that.
You can just add an "actionListener" attribute to the commandLink.
The beauty of how tree2 works is that it really takes advantage of all
of what JSF has to offer. You really start to realize how sweet JSF
is when you look at tree2 and see its power and how easy it is to
customize. A lot of customization is possible using standard JSF
mechanisms (like adding an actionListener). Often times, you can do
what you need to do without extending the source code.
In the case of the folders, they are entirely under your control. You
provide the folders and you inform the tree when its time to expand.
That's why its easy for you to add an action listener in the way you
did (and also the way I'm suggesting.) Do me a favor and try it my
way and see if that also works. I'd be interested to know if it
didn't (that would be a bug.)
As for the HTML source. First I suggest a very excellent plugin for
firefox. Its called "View formatted source 0.9.2." It formats the
HTML nicely and I *really* wish I had it when Chris and I were working
on the HTML for tree2!
Which javascript would you like me to comment on? It sounds like you
are describing the client-side javascript but your original problem
was related to the server-side tree. Just let me know which you are
talking about.
Regards,
sean
On 6/30/05, CONNER, BRENDAN (SBCSI) <[EMAIL PROTECTED]> wrote:
> Never mind about this question; I figured out how to do it without
> having to change the model; I just add the following inside each
> <h:commandLink action="#{t.toggleExpanded}">...</h:commandLink> group:
>
> <f:actionListener type="..."/>
>
> The class I specify inside the "type" attribute then successfully
> intercepts each expand/collapse event.
>
> So I successfully got the Tree2 control to work using the IBM RAD/RSA
> IDE, although it still depends upon the MyFaces JSF implementation; I
> can't get it to work using Sun's RI.
>
> - Brendan
>
> P.S. I *would* be interested, however, if Sean could elaborate on some
> of the HTML that's produced by the tree2 control, however.
> Specifically, when doing a "view source" on what's produced, the HTML
> appears to be referring to dynamically generated JavaScript. (At least
> the path that's specified for the JavaScript appears to have a generated
> ID embedded in it.) Any explanation of this would be much appreciated.
>
> -----Original Message-----
> From: Sean Schofield [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 28, 2005 5:58 PM
> To: MyFaces Discussion
> Subject: Re: Handling the "node expanded" action in Tree2 to Get More
> Data
>
>
> Sorry, haven't had a chance to look into this proposal in detail.
> Remind me sometime next week if I still haven't responded. I am
> anxious to improve tree2 but the reorg is taking all of my spare time
> at the moment.
>
> sean
>
> On 6/28/05, Martin Marinschek <[EMAIL PROTECTED]> wrote:
> > I think that sounds quite nice as functionality goes, I am no expert
> > on the tree2, though.
> >
> > Sean having any thoughts on that?
> >
> > regards,
> >
> > Martin
> >
> > On 6/28/05, CONNER, BRENDAN (SBCSI) <[EMAIL PROTECTED]> wrote:
> > > I'm assuming that, since no one has answered this, that there isn't
> an
> > > easy way to do it as written. Therefore, I'm looking into extending
> the
> > > Tree2 component so its action takes another parameter:
> > > toggleActionListener="#{myListener}"
> > >
> > > Behind the scenes, if this parameter is specified, the tree
> component
> > > would execute addAction() on the expandControl, thus allowing the
> > > application developer the ability to intercept the expand or
> collapse
> > > events and do other things, such as read the database for more data
> > > beneath that node.
> > >
> > > Does this sound like a reasonable approach, or is the equivalent
> > > functionality already there, and I'm just missing it?
> > >
> > > - Brendan
> > >
> > > -------------------
> > >
> > > When a use clicks the "expand" icon in a serverside Tree2 component,
> I
> > > would like my application to go out and grab more data from the
> database
> > > to fill in the details of that node's children. What's the hook in
> > > Tree2 that I can use to do that? Should I override one of the
> methods?
> > > Should I intercept some sort of action?
> > >
> > > At first, I tried subclassing TreeNodeBase and overriding the
> > > getChildren method so it calls a routine in my application to get
> more
> > > data. However, this results in having all the data in the entire
> tree
> > > retrieved after just clicking on the root, which is not what I want.
> I
> > > want just the data for the immediate children retrieved from the
> > > database when a parent node's "expand" icon is clicked.
> > >
> > > Any usage help would be much appreciated!
> > >
> > > - Brendan
> > >
> > >
> >
>