Another related scenario I ran into was this: I'm using your Pivot hashmap with change listeners (great idea). And as I'm adding/removing/clearing the hashmap, the listeners reload a tree. Now when I click on the treenode, it would be nice to "go back" to the hashmap to grab more properties that the treenode is representing. Since the regular treenodes are really hollow, I have to fall back to using the dictionaries my custom treenodes to tie them back to the hashmap keys.
I think it's less of a problem with tables, because you can have extra "data columns/attributes" in the arraylist that are not visible in the view, to store properties. If you had treenodes that were arraylists instead of lists, you can have extra attributes, and then just tell the renderer via a style setting(.., etc.) which attribute to use for the "Text" and "Icon" values. Just an idea. I haven't wrapped my head around the renderers yet. I could be misinformed in this area. Bob On Thu, Feb 18, 2010 at 8:42 AM, Greg Brown <[email protected]> wrote: > I think you make a valid point. Any non-trivial application would probably > end up using a custom renderer that is capable of presenting an > application-specific data structure. The approach you have taken is one > solution - another is using the org.apache.pivot.xml.Element class as I > described here: > > > http://mail-archives.apache.org/mod_mbox/pivot-user/201002.mbox/%[email protected]%3e > > It does seem like we might be able to do something to make this process > easier for developers. Table data is also generally application specific, > and the stock table cell renderers do a pretty good job covering the common > use cases there. Maybe we could do something similar for tree data. > > > On Feb 18, 2010, at 8:36 AM, Robert Piotrowski wrote: > > > Hi, > > > > I've got my own TreeNodes now that have a UserDataDictionary capability > (and working great), but I was wondering, how would you normally work with > trees if the only things on a node are its Text and Icon values? So let say > you click on a node that says "authors (3)" how would you normally interact > with a click on that node so that a value that is not part of the TreeNode > Text is used? > > > > > > > > Bob > >
