Setting Selections on CheckBoxTree

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Setting Selections on CheckBoxTree

Postby djskiffington » Wed Jun 25, 2008 7:52 am

I've got a CheckBoxTree that is working and I am able to get the user selections without any problem. However, I have a situation where I need to set specific leaf nodes to selected after the tree has been constructed and I don't see an easy way to accomplish this. I tried to loop through the rows and get the path for each row, but that doesn't work for rows that are not currently visible. Any other suggestions on how to do this?
djskiffington
 
Posts: 3
Joined: Mon Apr 09, 2007 12:22 pm

Postby JIDE Support » Wed Jun 25, 2008 8:40 am

You have use get the TreePath and then use as getCheckBoxTreeSelectionModel to select it. Of course you can't use getPathForRow kind of methods if it is not visible. But it is still possible to construct a TreePath for it if you know exactly which node you are trying to select, even the node is not visible.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby djskiffington » Wed Jun 25, 2008 11:50 am

Do you have any examples of how this should work ?

I tried using new TreePath(treeModel.getPathToRoot(child)) to reconstruct the path to the node. I then pass this TreePath to the CheckBoxTree setSelectionPath, but my checkbox is never selected. I also tried reconstructing the path by using new TreePath(Object[]) where my object list is the list of nodes from root to child, but that didn't work either.
djskiffington
 
Posts: 3
Joined: Mon Apr 09, 2007 12:22 pm

Postby JIDE Support » Wed Jun 25, 2008 11:57 am

Not CheckBoxTree's setSelectionPath. That's for the blue highlight kind of selection, not for check boxes. As I mentioned in my previous post, you need to use getCheckBoxTreeSelectionModel to get the selection model for the checkboxes.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby djskiffington » Wed Jun 25, 2008 12:36 pm

Thanks. That corrected my problem.
djskiffington
 
Posts: 3
Joined: Mon Apr 09, 2007 12:22 pm


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 90 guests