I'm building the chat application using JavaFX and MvvmFX and got into little system design challenge.
I want to avoid using FX Observable lists in my model due to my model can be updated in multithreading environment and I don't need my model be JavaFX dependent at all.
So the model will be simple jdk lists and view-model will be Observable JavaFX lists that is bound by view.
But what is a proper way to keep the model and view-model in sync?
For example, when the new contact is added to the model list, or the contact status changed the model changes -> so the view-model also needs to be changed.
There is a solution like glazed lists https://github.com/glazedlists/glazedlists, providing additional features like built-in change listeners for collections but it feels like not ideal solution as well. But even if I use it, every-time it triggers, I need to rebuild my view-model or write some logic how to figure out what item in model is changed to sync it in VM.
Anyone has solved that before? Please share your ideas! Thanks in advance!