frank bengtsson wrote:

thx, i will have to get back on that, as i am going in to production tomorrow...

Ok. Well, I don't see any reason why it shouldn't work and I tested it, so I think we're fine. It'll be in 1.0.1 and 1.1b1.

It seems that AbstractTree.java has choosen a selectionmodel with single selection:
treeSelectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

that makes it hard for me to make a selection tree as only the latest selected path in tree is avialble....

I tried with another selection model:
treeSelectionModel.setSelectionMode(TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);

But i still only get the latest selected path when i run my debugger
selectedPath: javax.swing.tree.TreePath = [EMAIL PROTECTED]"[Kategorier, T%F8j%2Fsko%2Fpersonlig+pleje, Wagner]" selection: javax.swing.tree.TreePath[] = null ???????????? this should be set ???

And here is the code onsubmit:

TreePath[] selectedPaths = categoriesTree.getTreeState().getSelectionModel().getSelectionPaths();
                   if (selectedPaths != null) {
                       for (int i=0; i<selectedPaths.length; i++) {
log.info("selected path:" + selectedPaths[i].getLastPathComponent());

                       }
                   }

Any ideas ?


Nope, not at this time, sorry. The Tree component is pretty hard to get right, and one of the things I presumed was that you'd usually would only have one selection in a web application. I guess when you work with checkboxes etc, that could be different, but I'm not sure how that would work together. An alternative strategy would be to just use the tree for rendering, and put a form around your tree and do something usefull with the checkboxes or whatever you use in it. That's probably even clearer than forcing it in the tree model.

If you have ideas they are welcome ofcourse. Tree is pretty usefull for a lot of usecases right now, but it will take a few iterations before it is 'perfect'. Took a long time in Swing for sure.

Eelco



/Frank B.
On Sunday 17 July 2005 10:55, Eelco Hillenius wrote:
Ah, yes. I understand now. Sorry about that stupid bug.

I solved it a bit differently by providing a class that does nothing at
all (except being a panel) and a class that has the default components:
NodePanel and DefaultNodePanel. DefaultNodePanel is used by default, and
is the panel you can extend if you don't want to add your own component
structure, but just want to provide (slightly) different markup. If you
do want to provide your own components (like you do), you should extend
from NodePanel directly. As NodePanel itself just extends Panel, but
does not add any components, you can extend this and use it like any
other panel.

I have included the altered tree source file. Could you please confirm
that it solves your problem?

Eelco




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to