We're looking at incorporating something like Rob is talking about
into Tree2. One other possibility is to make TreeModel an interface
and allow the user to supply their own. I'm a little tied up with
things at work right now but I'd be interested in seeing a patch along
these lines.
Just to clarify Tree2 does support listeners but it does so in a
somewhat indirect manner. The user decides how the node will be
represented. Most times they will want a commandLink for the node but
not always so that is left up to the user. If the user wants to do
something when they click the normal JSF support for ActionListeneres
*is* available to you. You just have to do what's necessary as a
result of the click.
IMO you'd be hard pressed to find a scenario that tree2 can't do for
you right now. It also relies on standard JSF conventions (such as
action listeners and command links) without requiring that you have
them. In some cases (such as Rob's) you will need to subclass
HtmlTree to get the desired functionality. I'm interested in when and
why this is necessary (I know why in Rob's case) because it may signal
a shortcoming of tree2 that we could address for everyone.
sean
sean
On Apr 11, 2005 8:46 AM, Rob Decker <[EMAIL PROTECTED]> wrote:
> I had a lot of data (90,000+ objects) and option 1. won't work for that
> many. By default tree2 will load all the data. You have to create your own
> TreeNode implementation. In the implementation you lazy load the data
> objects when it's needed, which is when getChildren is called. But tree2
> walks all the nodes whether they are visible or not so you have to subclass
> HtmlTree and override processChildNodes to check whether or not the node is
> expanded:
>
> protected void processChildNodes(FacesContext context, TreeNode parentNode,
> int processAction) {
> if (isNodeExpanded() ||
> (getNodeId() == "0" && !getBoolean(this, JSFAttr.SHOW_ROOT_NODE,
> true)))
> super.processChildNodes(context, parentNode, processAction);
> }
>
> While this isn't the way 2. describes it works. Since tree2 doesn't support
> action/actionListener you have to handle the toggle yourself in order to use
> an actionListener.
>
> ----- Original Message -----
> From: Mihir Solanki
> To: 'MyFaces Discussion'
> Sent: Monday, April 11, 2005 6:32 AM
> Subject: Design approach for tree2 component
>
> Hi all,
>
> I am currently using x:tree2 component in my application. (SERVER SIDE TREE)
>
> I want to have an approach from you guys regarding what should be better
> way.
>
> 1. Populate complete tree nodes (with roots and leafs) when
> the page gets loaded.
> 2. Populate only those nodes which are initially visible
> and then handle action events on each node and add/remove children as per
> the action.
>
> Actually I have a large amount of data to be displayed, so I don't know how
> the tree2 handles the large data if I initially creates all the tree nodes.
>
> Now if I go with the second approach, what I am doing is (adding/removing
> nodes by handling action events) correct or not?
>
> Thanks
> Mihir Solanki
>
> Patni Computer Systems Ltd.
> Tel : 91 79 23240905 Ext : 413
>
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
>
> This e-mail message may contain proprietary, confidential or legally
> privileged information for the sole use of the person or entity to whom this
> message was originally addressed. Any review, e-transmission dissemination
> or other use of or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient is prohibited. If you
> have received this e-mail in error kindly delete this e-mail from your
> records. If it appears that this mail has been forwarded to you without
> proper authority, please notify us immediately at [EMAIL PROTECTED] and
> delete this mail.
> _____________________________________________________________________
>
>