J
Jason Cavett
Here's my problem...
I have one Model.
I can have multiple views to that model (depending on how the user
wants to see the information).
Problem: The user can have multiple views to the same model open at
the same time. If the user changes data in one view (which will
update the model), I want it to reflect in the other view(s). I
originally tried this by notifying all observers of the model (which
includes the original view that was just edited) and repopulating the
fields of the views. But, when I fire off the notification, I get
this exception:
Exception in thread "AWT-EventQueue-0 java.lang.IllegalStateException:
Attempt to mutate in notification
....whenever I edit a TextField or anything else with a
DocumentListener.
I sorta understand why this is happening (writeLock() and not being
able to modify while I'm notifying) but I am very confused on how to
fix it. Can anybody give any suggestions?
I have one Model.
I can have multiple views to that model (depending on how the user
wants to see the information).
Problem: The user can have multiple views to the same model open at
the same time. If the user changes data in one view (which will
update the model), I want it to reflect in the other view(s). I
originally tried this by notifying all observers of the model (which
includes the original view that was just edited) and repopulating the
fields of the views. But, when I fire off the notification, I get
this exception:
Exception in thread "AWT-EventQueue-0 java.lang.IllegalStateException:
Attempt to mutate in notification
....whenever I edit a TextField or anything else with a
DocumentListener.
I sorta understand why this is happening (writeLock() and not being
able to modify while I'm notifying) but I am very confused on how to
fix it. Can anybody give any suggestions?