-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
9-ea-107
To reproduce, run example below: it creates a bunch of checkBoxTreeItems with one selected. Note that parent state is indeterminate as expected. Press button to remove the selected treeItem.
- expected: parent state changed to unselected
- actual: parent state still indeterminate
public class CheckBoxTreeCellOnRemove extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
stage.setTitle(VersionInfo.getRuntimeVersion());
stage.setScene(getScene());
stage.show();
}
private Scene getScene() {
List<TreeItem<String>> ls = new ArrayList<TreeItem<String>>(10);
for (int i = 0; i < 10; i++) {
ls.add(new CheckBoxTreeItem<String>("Test " + i));
}
TreeView<String> tv = new TreeView<String>();
tv.setRoot(new CheckBoxTreeItem<String>("Root"));
tv.getRoot().getChildren().addAll(ls);
tv.getRoot().setExpanded(true);
tv.setCellFactory(CheckBoxTreeCell.forTreeView());
BorderPane root = new BorderPane();
root.setCenter(tv);
Button removeSelected = new Button("removeSelected");
removeSelected.setOnAction(e -> {
TreeItem item = tv.getSelectionModel().getSelectedItem();
if (item == null || item == tv.getRoot()) return;
tv.getRoot().getChildren().remove(item);
});
HBox buttonPane = new HBox(removeSelected);
root.setBottom(buttonPane);
return new Scene(root, 600, 400);
}
}
- expected: parent state changed to unselected
- actual: parent state still indeterminate
public class CheckBoxTreeCellOnRemove extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
stage.setTitle(VersionInfo.getRuntimeVersion());
stage.setScene(getScene());
stage.show();
}
private Scene getScene() {
List<TreeItem<String>> ls = new ArrayList<TreeItem<String>>(10);
for (int i = 0; i < 10; i++) {
ls.add(new CheckBoxTreeItem<String>("Test " + i));
}
TreeView<String> tv = new TreeView<String>();
tv.setRoot(new CheckBoxTreeItem<String>("Root"));
tv.getRoot().getChildren().addAll(ls);
tv.getRoot().setExpanded(true);
tv.setCellFactory(CheckBoxTreeCell.forTreeView());
BorderPane root = new BorderPane();
root.setCenter(tv);
Button removeSelected = new Button("removeSelected");
removeSelected.setOnAction(e -> {
TreeItem item = tv.getSelectionModel().getSelectedItem();
if (item == null || item == tv.getRoot()) return;
tv.getRoot().getChildren().remove(item);
});
HBox buttonPane = new HBox(removeSelected);
root.setBottom(buttonPane);
return new Scene(root, 600, 400);
}
}