View Full Version : FormModel.isDirty() doesn't seem to work ...
afida
Sep 2nd, 2004, 05:38 AM
Ollie,
I have NestingFormModel and when I edit one of textfield on of the forms I do expect that my formModel.isDirty() would return true but it never returns true infact, no matter what i change.
Is it a bug or do I need to enable something.
Amad
Keith Donald
Sep 2nd, 2004, 03:41 PM
Amad,
Can you work with me on getting the dirty support up to par? I haven't yet integrated dirty support completely, mainly because I haven't had the requirement in my application. However, as you've found, there is some initial support there now, and the design seems right/to make sense.
Can you confirm you're using a Buffered form model? That is; bufferChangesDefault = true and all your form model value models are buffered? If so, they will maintain a dirty state, and the form model will iterate through all value models checking that state--if any buffered models are dirty, the form value model reports it is also dirty. This should work, if not, it is indeed a bug.
BTW; I should be available off and on; I am in Tampa -- we had to evacuate Melbourne -- and have internet here, but won't have access to it all the time.
afida
Sep 2nd, 2004, 05:10 PM
Sure Keith, I will look be working on this later today, and will keep you posted. Also good luck during "Frances", you guys had enough already this year.
Amad
oliverhutchison
Sep 2nd, 2004, 07:20 PM
Keith, Amad,
there is indeed a bug in the is dirty checking code.
This is the code from DefaultFormModel:
Iterator it = formValueModels.values().iterator();
while (it.hasNext()) {
ValueModel model = (ValueModel)it.next();
if (model instanceof BufferedValueModel) {
BufferedValueModel bufferable = (BufferedValueModel)model;
if (bufferable.isDirty()) { return true; }
}
}
But as SwingFormModel uses ValidatingFormModels by default and they wrap the BufferedValueModel in a ValidatingFormValueModel the instanceof check will always fail.
Ollie
afida
Sep 7th, 2004, 05:17 PM
Keith,
Would be looking at this problem? I understand that due to hurricane 'Frances' you are out in Tampa but I don't know if you are getting these messages are not...
Amad
Keith Donald
Sep 8th, 2004, 02:33 PM
Amad,
Yes I will be taking care of it - hopefully today. I am back in Melbourne working on rich client right now.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.