The setup: Using a paintable canvas and having a dataset update based on coordinates. These are rounded to a grid.
The dataset is being evaluated and saved, but the actual values aren't changing. That being said, the propertyChange trigger is still going off. The trigger is appropriately filtered and I sent the dataset to the console. Nothing is actually changing, but it is still being triggered.
I've found a way around it for this instance, but I am wondering... is a propertyChange supposed to trigger when a property is updated (for any reason) or when the property value is actually changed? Is this a bug?
In Java Swing, propertyChange events generally fire for any assignment to a property, even if the value is the same. Note that constructing a dataset with the same content as another yields a new, different dataset (different object ID), even though the content is the same. To avoid an unwanted change event, condition whatever assignment you make to only happen when your definition of "inequality" fits.
Ah, thank you! I just looked at the dataset type in the Java docs, it's a doozy. I didn't realize it contained way more data than the contents. Seems almost like if you want something to fire on a change in a dataset, you need to build a multidim list from the old data and new data then compare those to see if a change occurred. A bit of a pain, but live and learn.
Compare to the old data as you construct the new data, maintaining a "difference found" flag as you loop. If true at the end, perform the final build and assignment.