I am trying to use CheckBoxTree along with QuickTreeFilterField and i am facing little annoying issues.
Say i have this tree :
- Child1
- - sChild11
- sChild12
- sChild13
- - sChild21
- sChild22
First issue is:
- check sChild22
- filter the tree by "sChild1"
- check sChild12
- clear the filter
After clearing the field, we can see that we lost the previous check
Second issue is:
- filter by "sChild2"
- check Child2
- clear the filter
Again, after clearing, we can see that all the tree got checked
It seems that i was able to fix the second problem by overwriting CheckBoxTreeSelectionModel#areSiblingsSelected(TreePath path).
But I dont know how to handle the first one. I tried to pass the original tree model to the constructor of CheckBoxTreeSelectionModel but it doesnt work.
You can see both of theses attempt in the code bellow:
- Code: Select all
CheckBoxTree tree = new CheckBoxTree((Hashtable) values) {
protected CheckBoxTreeSelectionModel createCheckBoxTreeSelectionModel(TreeModel model) {
return new CheckBoxTreeSelectionModel(rawTreeModel) {
@Override
protected boolean areSiblingsSelected(TreePath path) {
if (filterField.getDisplayTreeModel().isFiltersApplied())
return false;
return super.areSiblingsSelected(path);
}
};
}
};
rawTreeModel = tree.getModel();
Anyone could advise me ?
Thanks !