[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    RE: Bug when combining ListView and SortedList?
From:       "Fisher, Robert" <robert.fisher.ext () zeiss ! com>
Date:       2015-10-30 13:38:57
Message-ID: 025E25CA98F8AE46BE306AB33F6A38D501276A01 () ADEFUE01SMS003 ! cznet ! zeiss ! org
[Download RAW message or body]

Done.

From: Scott Palmer [mailto:swpalmer@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.ext@zeiss.com<mailto:robert.fisher.ext@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic