digin gets confused when checking nodes while building model

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.

digin gets confused when checking nodes while building model

Postby pfriend » Thu Jan 19, 2012 6:27 pm

Greetings,

This problem was found with the 3.3.3 jar. Single event mode and digin are enabled.

I have a new section of code which is building a tree in an iterative fashion. Based on some boolean value, the node may be checked after it is added. This can cause problems when digin is enabled. For example, say I start with this tree:

A>
---B>

Now I add a leaf node C, but it has a property that requires that it be checked.

A>
---B>
------C>

Now I add another leaf node D as a child of B, but that node must *not* be checked:

A>
---B>
------C>
------D>

Unfortunately, the result in this case is that both C and D are checked in the UI. If I verify the selections via a call to getSelectionPaths(), the returned path is for node B, which seem to imply some problem with digin mode where a state isn't cleared when a new node is added to the model.

As a workaround, I removed the code which checks nodes as they are built, and after the entire model is built I iterate over the nodes again to set the check boxes. The problem is that after the model is built, it will be modified over time, and the same problem could occur again, and I have found no workaround yet.

Any thoughts?

Thanks in advance.

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

Re: digin gets confused when checking nodes while building m

Postby pfriend » Thu Jan 19, 2012 6:32 pm

Just to clarify, in the example above B is not programatically checked, nor are any of its ancestors.
pfriend
 
Posts: 18
Joined: Sun Dec 04, 2011 3:47 pm

Re: digin gets confused when checking nodes while building m

Postby pfriend » Thu Jan 19, 2012 6:37 pm

I might have a workaround, but I haven't run it in enough tree configurations to know if it will be stable over time as the model changes. Instead of just checking a node via addSelectionPaths(), I now also call removeSelectionPaths() for the case where the newly added node should not be checked. Hoping this will be a no-op if the checkbox model already doesn't have the given node checked.

Cheers,

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

Re: digin gets confused when checking nodes while building m

Postby JIDE Support » Thu Jan 19, 2012 7:19 pm

Yes, that's a valid workaround from my point of view. Actually you have to manage the behavior of the selection status for the newly inserted node in digIn mode.

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

Re: digin gets confused when checking nodes while building m

Postby pfriend » Fri Jan 20, 2012 12:34 pm

Thanks, so based on that I am guessing that this is a feature and not a bug?

Cheers,

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

Re: digin gets confused when checking nodes while building m

Postby JIDE Support » Fri Jan 20, 2012 1:23 pm

No, I don't think it is a bug. Use your case, after the path A-->B is selected, if you now add a C as B's child, it's hard for CheckBoxTreeSeelctionModel to tell if C should be checked or not. By default, it's selected. You could manage the behavior by removing the selection path as you mentioned.

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


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

Who is online

Users browsing this forum: No registered users and 7 guests

cron