-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MappedBackedList
handling of wasUpdated
changes
#87
base: main
Are you sure you want to change the base?
Conversation
Thanks, could you please also add a test verifying that this is indeed fixed (and will not be reintroduced in the future). |
Done in |
It would be great if you could merge this and release a new version (olly is currently on holidays and I don't have admin rights on the namespace at sonatype so we cannot publish it under jabref namespace) Edit// For releasing you can take a look at the afterburner gradle https://github.com/JabRef/afterburner.fx/blob/main/build.gradle |
In some cases, I don't want to create a new object on update because I already have bindings that reflect the updates in the mapped object. How about introducing a new method: The changes to
If you agree with this, should I do this in a separate PR? Edit: The method should be like this, assuming the
|
I thought a bit more about this, but don't really have time right now to deep-dive into it. So please excuse any mistakes in the following and please do point them out.
So this is actually a bug in Or is there any other use case for calling |
@LoayGhreeb You can now open this PR against https://github.com/JabRef/EasyBind I have setup the publishing |
Initially, I thought the issue was that The actual issue is that Also, if the list has a comparator and an update change is fired, it resorts the list without considering the new object. Therefore, it might be better to create a PR for JavaFX because, as you mentioned, using
In the case of JabRef, we don't need to create a new object on change, so I suggested adding a new method: #87 (comment). If we add this method, JabRef will work fine. The issue should be reported to JavaFX for cases where a new object is mapped on update. |
I see that I tried to fix the I think From the
|
This PR addresses an issue related to
EasyBind#mapBacked
. The problem arises when using aSortedList
with elements that are mapped usingEasyBind#mapBacked
. Specifically, updates to elements in the list do not propagate to theSortedList
.Minimal Example:
Output:
Expected Output:
The issue is due to the
SortedList#sourceChanged
method in JavaFX. If there is no custom comparator,SortedList#updateUnsorted
will handle the updates, but it does not handle thewasUpdated
change. This results in theSortedList
not updating when an element's change type iswasUpdated
.Reference to the code:
SortedList#sourceChanged
SortedList#updateUnsorted
The fix involves using
nextSet
, which is equivalent to callingnextRemove()
followed bynextAdd()
. This ensures that updates to elements are correctly propagated through to theSortedList
.