I'm using CheckTreeView to represent hierachical structure. The current checking behaviour is if I check/uncheck a parent, all of its children will automatically get check/unchecked. If I check/uncheck all the children the parent also gets automatically checked/unchecked. Is there any way to remove this behaviour? I want to be able to check all the children without changing the checked state of the parent to true. I also want to be able to check the parent and some or no children but not all of them. In short I want the check boxes to be totally independent from the others. I have attached an edited screenshot to demonstrate what I describe
Example code to build the tree:
@FXML
private void initialize() {
CheckBoxTreeItem<String> parent1 = new CheckBoxTreeItem<>("Parent 1");
addChildren(parent1);
CheckBoxTreeItem<String> parent2 = new CheckBoxTreeItem<>("Parent 2");
addChildren(parent2);
CheckBoxTreeItem<String> root = new CheckBoxTreeItem<>("Root");
root.getChildren().addAll(parent1, parent2);
ctv.setRoot(root);
}
private void addChildren(TreeItem<String> parent) {
parent.getChildren().add( new CheckBoxTreeItem<>("Child 1"));
parent.getChildren().add( new CheckBoxTreeItem<>("Child 2"));
}