Done.

From: Scott Palmer [mailto:swpal...@gmail.com]
Sent: Freitag, 30. Oktober 2015 14:38
To: Fisher, Robert
Cc: openjfx-dev@openjdk.java.net
Subject: Re: Bug when combining ListView and SortedList?

That looks like a bug to me.  Please report it.

On Fri, Oct 30, 2015 at 7:07 AM, Fisher, Robert 
<robert.fisher....@zeiss.com<mailto:robert.fisher....@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

Reply via email to