On Fri, 28 May 2021 14:31:14 GMT, Jeanette Winzenburg <faste...@openjdk.org> wrote:
>>> You mean `selectedIndices` not reporting truthfully? >> >> Yes, I meant `selectedIndices`. >> >> I'm not quite sure I understand what you're getting at. Are you suggesting >> to apply the changes reported by `selectedIndices` to our copy of the items >> (`itemsRefList`) while iterating the changeset? If so, I think that doesn't >> work because crucial `selectedIndices` notifications are missing. >> >> For example, `selectedIndices` sometimes doesn't report removed items. By >> simply iterating over the changeset, `itemsRefList` would soon be out of >> sync with `selectedIndices`. The only way to correctly sync `itemsRefList` >> with `selectedIndices` is to discard all items, and collect them again in a >> bulk operation (like it's done currently). >> >> That alone doesn't make `SelectedItemsReadOnlyObservableList` well-behaved: >> since its change notifications are generated while iterating over the >> `selectedIndices` changes, it will also miss some notifications. > >> I'm not quite sure I understand what you're getting at. Are you suggesting >> to apply the changes reported by `selectedIndices` to our copy of the items >> (`itemsRefList`) while iterating the changeset? If so, I think that doesn't >> work because crucial `selectedIndices` notifications are missing. >> > > exactly, that's what I meant right from the start (and obviously haven't been > clear enough ;) And now I understand what you tried to explain to me, > probably also right from the start .. thanks for spelling it out! > > hmm .. so we are stuck with a severely misbehaving selectedItems that's > trying to do its best to compensate for the misbehaviour in selectedIndices > (there are not only missing but also badly incorrect, notifications see f.i. > [JDK-8267781](https://bugs.openjdk.java.net/browse/JDK-8267781)). There > probably should be some documentation to explain that fact. Maybe open a > follow-up issue to make sure the selectedItems are revisited? Yes, this should be followed up on. [Here](https://bugs.openjdk.java.net/browse/JDK-8267951)'s the issue. ------------- PR: https://git.openjdk.java.net/jfx/pull/478