Bug when combining ListView and SortedList?
Scott Palmer
swpalmer at gmail.com
Fri Oct 30 13:37:41 UTC 2015
That looks like a bug to me. Please report it.
On Fri, Oct 30, 2015 at 7:07 AM, Fisher, Robert <robert.fisher.ext at zeiss.com
> wrote:
> Hi,
>
> I am wondering if this behaviour of ListView's MultipleSelectionModel is
> correct:
>
>
> 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());
>
> This yields the following console output on JDK 8u66:
>
> 2
> [1]
>
> The "selected item" and "selected items" are out of sync. Interestingly if
> you attach a ListChangeListener to the selected items list, it only fires
> once (when selectFirst is called).
>
> Is this a bug?
>
> Cheers,
> Rob
>
More information about the openjfx-dev
mailing list