Thx :)

Not quite done yet though, one problem remaining:

1) i have Inputfields above this selection tree..but..when you change 
something in the tree, well you loose youre values in the inputfields...so i 
have to find a way to remember the current values...the tree is on the same 
form as the inputfields..but i like to read the tree "onsubmit()"

2) I am having trouble making the checkbox image itself change visually , when 
i click the checkbox in the tree . But the image is put on the link ?
Somehow i have to move the image thing into the onClick() method ???
below fails with "nodeLink may not have been initialized"

            final Link nodeLink = new Link("nodeLink")
            {
                public void onClick()
                {
                    nodeLinkClicked(treenode);
                        getModel().setObject(nodeLink, getNodeImage(treenode)); 
// Is this the way 
to do it ?
                }
            };
            nodeLink.add(getNodeImage(treenode));
            add(nodeLink);


I could make an checkbox selection tree example, but i very busy rigth now..my 
vacation starts on Tuesday and lasts for 3 weeks..maybe i will find the time 
in my vacation..no promises :)

I also have to do an article on Wicket..so we must wait and see when i get a 
chance..but sure i would be happy to contribute !

I was thinking of calling it "Why Wicket Wins" or "Working With Wicket"
hope that is ok :)

I like this forum very much..kind of like the old days with IntellliJ's 
IDEA :) 

/Frank B.

On Sunday 17 July 2005 19:40, Eelco Hillenius wrote:
> Thanks, looks good! I committed it for 1.1. Actually, I don't think it
> is that quick and dirty... can't think of another, nicer way to do it.
>
> Are you interested in contributing to wicket-examples? Sounds like a
> nice example to have, a tree with checkboxes.
>
> Eelco
>
> frank bengtsson wrote:
> >ok, this is maybe quick and dirty, but it works for me
> >
> >I now have a tree checkboxes and able to keep state on serverside
> >and it actually works very well :)
> >
> >Not sure how this affects, if youre only interested in single-selection.
> > But i think this works also:
> >
> >TreeState.java
> >
> >     public void setSelectedPath(TreePath selection)
> >     {
> >             setExpandedState(selection, true);
> >             this.selectedPath = selection;
> >        if (treeSelectionModel.isPathSelected(selection)) {  // Hack
> >            treeSelectionModel.removeSelectionPath(selection);
> >        } else {
> >            treeSelectionModel.addSelectionPath(selection);
> >        }
> >    }
> >
> >
> >TreeState.java:
> >
> >protected final TreeState newTreeState(final TreeModel treeModel, final
> >boolean rootVisible)
> >     {
> >             final TreeState treeState = new TreeState();
> >             final TreeSelectionModel treeSelectionModel = new
> >DefaultTreeSelectionModel();
> >treeSelectionModel.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_
> >SELECTION); treeState.setModel(treeModel);
> >             treeState.setSelectionModel(treeSelectionModel);
> >             treeState.setRootVisible(rootVisible);
> >             treeModel.addTreeModelListener(treeState);
> >             return treeState;
> >     }
> >
> >
> >/Frank B
> >
> >On Sunday 17 July 2005 18:06, Eelco Hillenius wrote:
> >>You, sure we are interested! And if you're done quick enough, we could
> >>put it in 1.1 still (hopefully we'll make it tonight, but there's a lot
> >>of work still to be done and some discussions soak up a lot of time, so
> >>it might be later this week).
> >>
> >>Eelco
> >>
> >>frank bengtsson wrote:
> >>>i got it working with some addons TreeState.java, multiple selections
> >>>where not propergated to the model holding multiple selections...so far
> >>>it looks ok..i will let you know when i am done or other problems if you
> >>>are interested ;)
> >>>
> >>>/Frank B.
> >>>
> >>>On Sunday 17 July 2005 16:15, Eelco Hillenius wrote:
> >>>>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_SEL
> >>>>>EC TI ON);
> >>>>>
> >>>>>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
> >>>>>_S EL ECTION);
> >>>>>
> >>>>>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
> >>
> >>-------------------------------------------------------
> >>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
>
> -------------------------------------------------------
> 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

-- 
Frank Kastell Bengtsson
Kastell


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