I want objects listening to changes in my ObservableList to be notified of changes in one of its elements without needing to remove the element and add a new one in its place. I hope I make myself clear. Right now, to trigger change event, I need to write the code as follows (create a tempItem):
Use an extractor to register for update notifications on the properties of the item that you want to listen to updates on.
Here is a sample:
Note that the update notification is received, when the description of the apple changed from Green Skin to Red Skin as the apple ripened. Without an extractor definition, this update notification would not be received.
posted 4 years ago
Thank you kindly for your reply. I already solved the problem using exactly this solution (extractor.) It worked perfectly. I added the extractor() method to my Item class so now it looks as follows:
I used ListProperty<Item> to store items. Hopefully it will help someone else in the future.