Hi Sean,

Thanks for the reply.  Yes, I could have used the actionListener
attribute as well; in my opinion, that's equivalent to specifying an
<f:actionListener> action inside body of the commandLink.  Both ways are
of specifying the listener are available through native JSF (although
only one actionListener attribute can be specified, whereas the number
of <f:attributeListeners> in the body is unbounded).  Also, my
commandLink line was getting pretty long, so, rather than including
everything on that line and then possibly have to break the line into
two lines any way, just for readability, I chose to include the
actionListener in its own action within the commandLink's body.

So, right now, I'm able to use the Tree2 component "out of the box" with
no modifications, which is pretty sweet.  There are only two things that
still may not be right, however:

1. As indicated in another thread I started, I believe it's more
appropriate to for the renderer to use node.isLeaf() to decide whether
to put the navigation icon out there, rather than using
node.getChildCount().  This would avoid having to require the
application developer to give a bogus child count if the application
knows that more children are out there, but doesn't know how many
children are there.

2. As mentioned earlier, I can't get Tree2 to work with the Sun RI.

Also, thanks for the info on the firefox plug-in.  I noticed that the
generated HTML has the following lines:

<script type="text/javascript"
src="/AaTreeTest1Web/faces/myFacesExtensionResource/tree2.HtmlTreeRender
er/1113412660000/javascript/tree.js"></script><script
type="text/javascript"
src="/AaTreeTest1Web/faces/myFacesExtensionResource/tree2.HtmlTreeRender
er/1113412660000/javascript/cookielib.js"></script><span
id="_id0:serverTree">

The path for these JavaScript files looks as though it was generated
(i.e., ".../1113412660000/...).  This question is lower priority than
the two items I mentioned above, but I was wondering what's going on
with this path.

Great job


-----Original Message-----
From: Sean Schofield [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 30, 2005 11:52 AM
To: MyFaces Discussion
Subject: Re: Handling the "node expanded" action in Tree2 to Get More
Data


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
> > >
> > >
> >
>

Reply via email to