-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Originally posted by Nathan Pruett:
The way I've done it before is to add "dirty" state to the model object that backs the form, or add a sort of proxy layer that keeps track of changes between the real model object and the form.
Originally posted by Paul Clapham:
Seems to me (putting words in Nathan's mouth here) that if you want to track changes to the model, you don't do anything with the GUI at all. You just add code to the model which reacts to changes being made.
Originally posted by Gil Estes:
In the case of a dialog (for instance) that contains say a few buttons, text input fields, etc..., you would need to implement your own model for that dialog to have one. The only way to know that something was entered in a text field, and if that data is now different than before (i.e. "dirty"), would be to have the appropriate listeners as needed. You could do this by implementing an Observable interface whereby you have an observer (maybe your model?) that registers as an "observer" for the controls/components you are concerning yourself with. The "observer" (model) would know the original state of each of the fields, and could determine at "go time" if the form is dirty or not...
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |