-
Bug
-
Resolution: Unresolved
-
P4
-
8u60
-
8u60b5, win7
title says it all ;-)
Below is a test that exposes the misbehaviour for the case of removing a selected CheckBoxTreeItem, Too lazy to write the tests for other list modifications, but pretty sure that it's the same for adding/replacing items
/**
* CheckBoxTreeItem must update parent state when modifying the
* children list.
*/
@Test
public void testCheckBoxTreeItemDataModification() {
CheckBoxTreeItem checkBoxRoot = createCheckBoxSubTree("checked-root");
checkBoxRoot.setExpanded(true);
tree.setRoot(checkBoxRoot);
CheckBoxTreeItem child = (CheckBoxTreeItem) checkBoxRoot.getChildren().get(2);
child.setSelected(true);
assertTrue(checkBoxRoot.isIndeterminate());
root.getChildren().remove(child);
assertFalse("root must update its check state on modifications to children list",
checkBoxRoot.isIndeterminate());
}
protected CheckBoxTreeItem createCheckBoxItem(Object item) {
return new CheckBoxTreeItem(item);
}
protected ObservableList<CheckBoxTreeItem> createCheckBoxItems(ObservableList other) {
ObservableList items = FXCollections.observableArrayList();
other.stream().forEach(item -> items.add(createCheckBoxItem(item)));
return items;
}
protected CheckBoxTreeItem createCheckBoxSubTree(Object item) {
CheckBoxTreeItem child = createCheckBoxItem(item);
child.getChildren().setAll(createCheckBoxItems(rawItems));
return child;
}
Below is a test that exposes the misbehaviour for the case of removing a selected CheckBoxTreeItem, Too lazy to write the tests for other list modifications, but pretty sure that it's the same for adding/replacing items
/**
* CheckBoxTreeItem must update parent state when modifying the
* children list.
*/
@Test
public void testCheckBoxTreeItemDataModification() {
CheckBoxTreeItem checkBoxRoot = createCheckBoxSubTree("checked-root");
checkBoxRoot.setExpanded(true);
tree.setRoot(checkBoxRoot);
CheckBoxTreeItem child = (CheckBoxTreeItem) checkBoxRoot.getChildren().get(2);
child.setSelected(true);
assertTrue(checkBoxRoot.isIndeterminate());
root.getChildren().remove(child);
assertFalse("root must update its check state on modifications to children list",
checkBoxRoot.isIndeterminate());
}
protected CheckBoxTreeItem createCheckBoxItem(Object item) {
return new CheckBoxTreeItem(item);
}
protected ObservableList<CheckBoxTreeItem> createCheckBoxItems(ObservableList other) {
ObservableList items = FXCollections.observableArrayList();
other.stream().forEach(item -> items.add(createCheckBoxItem(item)));
return items;
}
protected CheckBoxTreeItem createCheckBoxSubTree(Object item) {
CheckBoxTreeItem child = createCheckBoxItem(item);
child.getChildren().setAll(createCheckBoxItems(rawItems));
return child;
}
- relates to
-
JDK-8190752 TreeView with CheckBoxTreeItem: sub-node is not selected by selecting the parent: JDK-8177861 new Issue
- Open