Results 1 to 4 of 4

Thread: Disable dirty tracking in a property of a value model

  1. #1

    Default 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!

  2. #2
    Join Date
    May 2008
    Location
    Bremerton, WA
    Posts
    23

    Default

    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

  3. #3

    Default

    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?

  4. #4
    Join Date
    May 2008
    Location
    Bremerton, WA
    Posts
    23

    Default

    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
  •