A DESCRIPTION OF THE PROBLEM :
MultipleSelectionModel.getSelectedItems() does not fire the expected number of list change events in certain cases, and the contents of those list change events is also incorrect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Select all of the items in the TableView.
2. Select 8 from the items in the TableView.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect a single list change event to be fired for this containing the following numbers: [0, 1, 2, 3, 4, 5, 6, 7, 9].
ACTUAL -
Instead, two list change events are fired: [0, 1, 2, 3, 4, 5, 6, 7] and [1].
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ListChangeListener;
import javafx.scene.Scene;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Selection Model Bug");
var tableView = new TableView<Integer>();
var identityColumn = new TableColumn<Integer, String>();
identityColumn.setCellValueFactory(integer -> new SimpleStringProperty(integer.getValue().toString()));
tableView.getColumns().add(identityColumn);
tableView.getItems().addAll(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
tableView.getSelectionModel().getSelectedItems().addListener((ListChangeListener<Integer>) c -> {
while (c.next()) {
if (c.wasRemoved()) {
System.out.println(c.getRemoved());
}
}
});
primaryStage.setScene(new Scene(tableView, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : always
MultipleSelectionModel.getSelectedItems() does not fire the expected number of list change events in certain cases, and the contents of those list change events is also incorrect.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Select all of the items in the TableView.
2. Select 8 from the items in the TableView.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would expect a single list change event to be fired for this containing the following numbers: [0, 1, 2, 3, 4, 5, 6, 7, 9].
ACTUAL -
Instead, two list change events are fired: [0, 1, 2, 3, 4, 5, 6, 7] and [1].
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.ListChangeListener;
import javafx.scene.Scene;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Selection Model Bug");
var tableView = new TableView<Integer>();
var identityColumn = new TableColumn<Integer, String>();
identityColumn.setCellValueFactory(integer -> new SimpleStringProperty(integer.getValue().toString()));
tableView.getColumns().add(identityColumn);
tableView.getItems().addAll(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
tableView.getSelectionModel().getSelectedItems().addListener((ListChangeListener<Integer>) c -> {
while (c.next()) {
if (c.wasRemoved()) {
System.out.println(c.getRemoved());
}
}
});
primaryStage.setScene(new Scene(tableView, 300, 275));
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : always