Regression bug in TreeView.getSelectionModel().getSelectedItem()
Jeanette Winzenburg
fastegal at swingempire.de
Wed Apr 1 14:37:49 UTC 2020
my comment would have been the same as Dirk's :)
As your original description changed between your first and second
post, I would suggest you write a minimal, reproducible example that
demonstrates what's _really_ going on in which context. If you think
it's a bug, please file it (including the mcve)
-- Jeanette
Zitat von Abu Abdullah <falcon.sheep at gmail.com>:
> On Wed, Apr 1, 2020 at 2:05 PM Dirk Lemmermann <dlemmermann at gmail.com>
> wrote:
>
>> You are listening to the changes made to the “list" of selected items but
>> then you are using the “selectedItem” property. If the list gets updated
>> BEFORE the “selectedItem” value was set then your code will fail. Adding to
>> the list and setting the property is not an atomic operation.
>>
>> If this worked before then you were simply lucky. Newer versions of JavaFX
>> might have rearranged the sequence of updates which causes this
>> “regression”. But I think those were allowed changes. There is no contract
>> that says that the “selectedItem” needs to be set before the list gets
>> updated.
>>
>> Or am I missing something?
>>
>
> Thank you for your response, certainly the list is not updated between the
> 2 calls. it just works all the time in older version but not once in newer
> version.
>
> But I forgot very important condition. clicking normally on the tree just
> works fine (correct behavior) in all versions in the same way. the one that
> is not working is when programmatically select a tree node using:
> *************************
> tree.getSelectionModel().clearSelection();
> tree.getSelectionModel().select(node);
>
> final int row = tree.getRow(node);
> tree.scrollTo(row);
> *************************
More information about the openjfx-discuss
mailing list