-
Bug
-
Resolution: Fixed
-
P3
-
8u60
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
1.8.0_60, 1.8.0_66
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When binding ListView items to a sorted list, changes in the sorted list lead to incorrect values in the ListView's list of selected items.
REGRESSION. Last worked in version 8u45
ADDITIONAL REGRESSION INFORMATION:
1.8.0_40
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the code in the example below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The console output should be:
2
[2]
ACTUAL -
The console output is instead:
2
[1]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
ListView<String> listView = new ListView<>();
ObservableList<String> items = FXCollections.observableArrayList();
SortedList<String> sortedItems = new SortedList<>(items);
sortedItems.setComparator(String::compareTo);
listView.setItems(sortedItems);
items.add("2");
listView.getSelectionModel().selectFirst();
items.addAll("1", "3");
System.out.println(listView.getSelectionModel().getSelectedItem());
System.out.println(listView.getSelectionModel().getSelectedItems());
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Dont use items.addAll, use items.add repeatedly in a loop.
1.8.0_60, 1.8.0_66
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
A DESCRIPTION OF THE PROBLEM :
When binding ListView items to a sorted list, changes in the sorted list lead to incorrect values in the ListView's list of selected items.
REGRESSION. Last worked in version 8u45
ADDITIONAL REGRESSION INFORMATION:
1.8.0_40
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the code in the example below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The console output should be:
2
[2]
ACTUAL -
The console output is instead:
2
[1]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
ListView<String> listView = new ListView<>();
ObservableList<String> items = FXCollections.observableArrayList();
SortedList<String> sortedItems = new SortedList<>(items);
sortedItems.setComparator(String::compareTo);
listView.setItems(sortedItems);
items.add("2");
listView.getSelectionModel().selectFirst();
items.addAll("1", "3");
System.out.println(listView.getSelectionModel().getSelectedItem());
System.out.println(listView.getSelectionModel().getSelectedItems());
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Dont use items.addAll, use items.add repeatedly in a loop.