confused by checkboxtree selection model behavior

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.

confused by checkboxtree selection model behavior

Postby pfriend » Tue Dec 06, 2011 8:13 pm

I am using version 3.3.0 of the library and running into some odd behavior with checkbox selection events. I am running the tree with digin enabled. I am checking the selection status by calling isPathSelected() on the tree paths in the event. I initally was using single event mode, but the results I was getting appeared completely incorrect, so I disabled it. I am still seeing the following odd behaviors:

1. If all nodes in the tree are selected in the tree and I uncheck a leaf, I get checked events for all nodes at that level in the tree except the node I unchecked, plus an uncheck event for the root, which seems odd.

2. If all nodes in the tree are unchecked, and I check/uncheck leaves, I get single check/uncheck events for those nodes as expected.

3. However, I have another subtree with a single leaf, and if I check that leaf I get check/uncheck events on the parent. This seems to be correct based on use of digin, but is inconsistent with behavior in #2, where the events are on the nodes leaves, not their parents.

My tree structure looks like this:

Code: Select all
Root -
   Files -
       file1
       file2...
       Subdir -
           file10
       anotherfile1
       anotherfile2


Thanks in advance for any pointers.

Peter
pfriend
 
Posts: 18
Joined: Sun Dec 04, 2011 3:47 pm

Re: confused by checkboxtree selection model behavior

Postby JIDE Support » Tue Dec 06, 2011 8:56 pm

Looks to me, all the behaviors you described are as designed. When digin is true, if a node is checked and one of its siblings is not checked, only an event for that node will be fired. If a node is checked and all of its siblings are checked as well, an event for its parent node will be fired. Please let us know the odd behavior if you choose single event mode.

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

Re: confused by checkboxtree selection model behavior

Postby pfriend » Tue Dec 06, 2011 11:25 pm

Thanks, with that explanation it makes sense for non-single event mode. Why is the leaf that was checked absent from the event paths?

What I find odd with single event mode is:

1. If all nodes are checked and I uncheck a leaf, I get an event for the leaf and the model says it's unchecked. When I recheck that same leaf again I get an event for that leaf which the model still says is unchecked.
2. If at least one other sibling is unchecked, I do see the event for a leaf switching between checked/unchecked as I would expect.
3. Related to #1, checking or unchecking the single node under "Subdir" always generates an event for that node, but model always says it is unchecked.

Are those cases correct as well?

Thanks,

Peter
pfriend
 
Posts: 18
Joined: Sun Dec 04, 2011 3:47 pm

Re: confused by checkboxtree selection model behavior

Postby JIDE Support » Wed Dec 07, 2011 10:10 am

1, Will fix the issue on single event model in next regular release. Please invoke CheckBoxTreeSelectionModel#isPathSelected(path, true) to get the correct status in current release.
2, on the non-single event mode, it says the parent node is checked and the other sibling nodes are unchecked, the gap means that the leaf itself is checked. That's why the leaf itself does not appear in the event.

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

Re: confused by checkboxtree selection model behavior

Postby pfriend » Thu Dec 08, 2011 11:59 pm

That call in #1 fixed it for me. Thanks again for the quick help!

Peter
pfriend
 
Posts: 18
Joined: Sun Dec 04, 2011 3:47 pm


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

Who is online

Users browsing this forum: Bing [Bot] and 5 guests