-
Jul 26th, 2008, 09:01 AM
#1
Disable dirty tracking in a property of a value model
Hi all,
Does Anybody know how to disable dirty tracking in a single value model of a formModel?
Thank you very much!
-
Jul 28th, 2008, 11:08 AM
#2
Put the object that is being bound in a wrapper object. If you look at how a bound object is checked for dirty it either performs a .equals() or simply == to determine if the object had changed - see DefaultValueChangeDetector.hasValueChanged(). If you put the value in a wrapper, the == will be used and should always be the same.
- Brad
-
Jul 28th, 2008, 11:15 AM
#3
Hi, thanks, but I think this is not enough.
The DirtyIndicatorInterceptorFactory does not work in this way, so It uses each value model separately. Also, DefaultFormModel will track this valueModel as dirty internally once it is changed.
Do you agree with me? Any other suggestion?
-
Jul 28th, 2008, 12:39 PM
#4
DirtyIndicatorInterceptorFactory has nothing to do with my binding ValueModel's and I would doubt it does with yours.
I derive almost all of my bindings from CustomBinding. The bound UI control calls CustomBinding.controlValueChanged() to update the ValueModel. The ValueModel is a DefaultFormModel$ValidatingFormValueModel which then calls AbstractValueModelWrapper.setValueSilently() which then calls FormModelMediatingValueModel that maintains the "dirty" flag by calling updateDirtyState(). See FormModelMediatingValueModel.isDirty() for the call to getValueChangeDetector().hasValueChanged(originalV alue, getValue()). Also note that there is a "trackDirty" value to control whether dirty should be updated. Not sure how to set that, but seems worth looking in to.
The debugger is your friend 
- Brad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules