Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b18) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [Version 6.1.7601] A DESCRIPTION OF THE PROBLEM : TreeTableView's selectedItems reports include null items if deselect one item with "Ctrl". STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Steps to reproduce: 1. Run the below example. 2. Press "Ctrl" 3. Click on "Item 2" EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Method javafx.collections.ListChangeListener.Change.getList() must return selected items. ACTUAL - Method javafx.collections.ListChangeListener.Change.getList() returned list with null item: Console: 1 > [null] 2 > [TreeItem [ value: Item 3 ]] REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception { TreeTableView<String> treeTable = new TreeTableView<>(new TreeItem<String>("Root")); treeTable.getRoot().setExpanded(true); treeTable.getRoot().getChildren().add(new TreeItem<String>("Item 1")); treeTable.getRoot().getChildren().add(new TreeItem<String>("Item 2")); treeTable.getRoot().getChildren().add(new TreeItem<String>("Item 3")); treeTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); treeTable.getSelectionModel().select(2); treeTable.getSelectionModel().select(3); TreeTableColumn<String, String> column = new TreeTableColumn<>("Text"); column.setPrefWidth(150); column.setCellValueFactory( (CellDataFeatures<String, String> p) -> new ReadOnlyStringWrapper(p.getValue().getValue())); treeTable.getColumns().add(column); treeTable.getSelectionModel().getSelectedItems().addListener(new ListChangeListener<TreeItem<String>>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends TreeItem<String>> change) { System.out.println("1 > " + change.getList()); System.out.println("2 > " + change.getList()); } }); primaryStage.setScene(new Scene(new VBox(treeTable))); primaryStage.show(); } public static void main(String[] args) { launch(args); } } ---------- END SOURCE ----------
|