RFR: 8165214: ListView.EditEvent.getIndex() does not return the correct index [v2]

Johan Vos jvos at openjdk.java.net
Tue Jun 22 16:28:56 UTC 2021


On Mon, 21 Jun 2021 13:22:07 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:

>> Issue was that the cancel event carried the listView's editingIndex at the time of firing the event - that's wrong nearly always (because the list's editing state/index might have changed between start and cancel, f.i. due to calling list.edit(someDifferentIndex)). 
>> 
>> Fixed by keeping the index at startEdit and using that in cancelEdit (similar approach as in TreeCell fix [TreeCell fix JDK-8265210](https://bugs.openjdk.java.net/browse/JDK-8265210). 
>> 
>> Added tests that are failing (and one that was accidentally passing) before, all passing after.
>
> Jeanette Winzenburg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   changed scope of field indexAtStartEdit to private

This looks the correct approach indeed. Tests fail before and succeed after.
That is, the first test succeeds before as well, but it makes sense as there is no action that would change the index. So I don't think it is accidentally passing?

-------------

PR: https://git.openjdk.java.net/jfx/pull/539


More information about the openjfx-dev mailing list