Bug 238909 - [DataBinding] Correctly set the staleness state of the validation status observable of the MultiValidator
Summary: [DataBinding] Correctly set the staleness state of the validation status obse...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.5 M1   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-29 12:01 EDT by Ovidio Mallo CLA
Modified: 2008-09-16 14:22 EDT (History)
1 user (show)

See Also:


Attachments
proposed patch along with some unit tests for the MultiValidator part (13.44 KB, patch)
2008-07-13 13:26 EDT, Ovidio Mallo CLA
no flags Details | Diff
proposed patch along with some unit tests (13.27 KB, patch)
2008-07-14 14:34 EDT, Ovidio Mallo CLA
no flags Details | Diff
new patch with the just mentioned fix (14.76 KB, patch)
2008-07-26 08:33 EDT, Ovidio Mallo CLA
bokowski: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ovidio Mallo CLA 2008-06-29 12:01:51 EDT
For Bindings, the validation status observable should be stale whenever either the target or model observable is stale.

For the MultiValidator, the validation status observable should be stale whenever any of its dependencies accessed from within the MultiValidator#validate() is stale.
Comment 1 Ovidio Mallo CLA 2008-07-13 13:26:46 EDT
Created attachment 107270 [details]
proposed patch along with some unit tests for the MultiValidator part

This is a patch for the MultiValidator part only.
Comment 2 Matthew Hall CLA 2008-07-14 01:27:59 EDT
+1.  Good patch, good tests.

Ovidio, we have a set of classes in our testing plugins:  ChangeEventTracker, ValueChangeEventTracker, SetChangeEventTracker, etc.  They share the same testing purpose as the StaleCounter and ValueChangeCounter classes from your patch so I thought I would bring them to your attention.

Boris, if you have no objections I think we could commit this patch as is.
Comment 3 Ovidio Mallo CLA 2008-07-14 14:07:23 EDT
> Ovidio, we have a set of classes in our testing plugins:  ChangeEventTracker,
> ValueChangeEventTracker, SetChangeEventTracker, etc.  They share the same
> testing purpose as the StaleCounter and ValueChangeCounter classes from your
> patch so I thought I would bring them to your attention.
Thanks for the hint, Matthew. I hadn't seen those classes but I will happily use them in future :). I will also adapt this patch to use them as it is definitely cleaner.
Comment 4 Matthew Hall CLA 2008-07-14 14:27:01 EDT
Boris, Ovidio's patch can supersede the changes I made to MultiValidator as part of bug 240590.  So don't worry about clobbering my changes as long as the tests still pass.
Comment 5 Ovidio Mallo CLA 2008-07-14 14:34:35 EDT
Created attachment 107357 [details]
proposed patch along with some unit tests

It's the same patch as the original one which, however, uses the ValueChangeEventTracker class as suggested by Matthew.
Comment 6 Ovidio Mallo CLA 2008-07-26 08:28:54 EDT
I've just found a small bug in my patch for the MultiValidator part when the set of dependencies changes and the new set contains a stale observable while the old set didn't. In that case, a stale event should be fired which was not the case. Sorry for that. New patch to follow.
Comment 7 Ovidio Mallo CLA 2008-07-26 08:33:27 EDT
Created attachment 108485 [details]
new patch with the just mentioned fix

In the doSetValue(...) method of the ValidationStatusObservableValue it now reads

    if ((oldStale && !stale) || !Util.equals(oldValue, value)) {
        fireValueChange(Diffs.createValueDiff(oldValue, value));
    } else if (!oldStale && stale) {
        fireStale();
    }

where the second if-clause is the new one. I've included an additional unit test which covers that use case. Beside the fix and the new unit test, the patch is the same (but I have already merged it against Matthew's changes as of bug #240590).
Comment 8 Ovidio Mallo CLA 2008-07-30 02:07:11 EDT
I have filed a separate bug (bug #242495) for the Binding part in order to cleanly track the changes to the MultiValidator part only as part of this bug here.
Comment 9 Boris Bokowski CLA 2008-07-31 16:16:44 EDT
Patch released to HEAD. Thanks!
Comment 10 Ovidio Mallo CLA 2008-07-31 17:20:43 EDT
Matthew and Boris, thanks at this point for taking the time to look at my patches!
Comment 11 Boris Bokowski CLA 2008-09-16 14:22:24 EDT
Verified by checking the test results for I20080915-1800.