> See my posts that followed for more info on what I'm trying to do. I've the
> plus/minus signs working as a commandLink with an actionListener for
> toggling (posted the code in another post).
I guess you have this working then?
> Currently I'm trying to create an adapter between my data and the TreeNode
> interface so I don't have to wrap all my objects 1 to 1 in TreeNodeBase
> objects. TreeNode returns a List for children but apparently using a
> TreeNode object that implements List cause an exception in the coercion code
> for 'value' (see earlier posts). That prevents me from going
> TreeNode.getChildren() { /*set state then */ return this; }.
See my earlier answer to your earlier posts. Yes you will need an
adapter. You are not constrained to use TreeNodeBase but you are
constrained to use TreeNode interface. As I said earlier, we can
explore using your own TreeModel if that is helpful.
> What I'd like in the end is to only load the object visible to the user
> (those in the root and open folders). In order to do that I need the
> sequence of events to be like this:
> On first view for a user I show the list of nodes in the root collapsed.
> The user clicks a plus next to a folder.
> My backing bean gets an event: identifier/expanded.
> I get the node using the identifier from my list of top level objects and
> set it's children as the current set of data (at this point I'm loading the
> children from the db).
Right. This is what the server-side toggle is for.
> I'm not sure how I'll do that last since a new backing bean gets created for
> each level and it seems to call getTreeData before I get the event (although
> maybe it's getting the parent level first, which would be ok).
What do you mean by a new backing bean for each level? Are you
talking about the objects that implement TreeNode? If so, then yes
you have them for each level. If you are talking about the object
that holds the tree data, then there is generally only one of those
(TreeBacker in the case of the simple example.)
You should be able to update the data in the component every time a
node expands. Take a look at using the binding attribute to get a
reference to the tree. Then you can update the data using setValue
whenever you need to. I believe that should work.
[snip]
> Rob
sean