-
Bug
-
Resolution: Fixed
-
P4
-
8u66, 9
-
x86
-
windows_8
FULL PRODUCT VERSION :
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.10586]
A DESCRIPTION OF THE PROBLEM :
The ListIterator of the selectedIndices list of the SelectionModel of ListView returns a incorrect index, if nextIndex() is called.
This causes e.g. a FilteredList with null as Predicate to remain empty and even for multiple selection it remains empty, if the elements are selected one by one using the mouse.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
0 printed to System.out
ACTUAL -
1 printed to System.out
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
public class Test extends Application {
public void start(Stage s) {}
public static void main(String[] args) {
ListView<String> list = new ListView<>(FXCollections.observableArrayList("1"));
list.getSelectionModel().select(0);
int nextIndex = list.getSelectionModel().getSelectedIndices().listIterator().nextIndex();
System.out.println(nextIndex);
Platform.exit();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Reimplement classes/methods that require correct results. (E.g. FilteredList)
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.10586]
A DESCRIPTION OF THE PROBLEM :
The ListIterator of the selectedIndices list of the SelectionModel of ListView returns a incorrect index, if nextIndex() is called.
This causes e.g. a FilteredList with null as Predicate to remain empty and even for multiple selection it remains empty, if the elements are selected one by one using the mouse.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the source code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
0 printed to System.out
ACTUAL -
1 printed to System.out
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.scene.control.ListView;
import javafx.stage.Stage;
public class Test extends Application {
public void start(Stage s) {}
public static void main(String[] args) {
ListView<String> list = new ListView<>(FXCollections.observableArrayList("1"));
list.getSelectionModel().select(0);
int nextIndex = list.getSelectionModel().getSelectedIndices().listIterator().nextIndex();
System.out.println(nextIndex);
Platform.exit();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Reimplement classes/methods that require correct results. (E.g. FilteredList)