|StringFieldEditor & conditional errorMessages [message #490147]
||Wed, 07 October 2009 14:23
| Johan Van Noten
Registered: July 2009
Suppose a preference page with simple content:|
* B: a BooleanFieldEditor
* S: a StringFieldEditor
* Page validation constraint: If B is checked, S should not be empty.
The page overrides its checkState() and does the required validation.
Make sure that checkState() is called in the propertyChange().
* Put a value in S
* Check B
* Make S empty
--> ErrorMessage appears as expected
* Enter and leave S
--> ErrorMessage gets cleared while state is still invalid.
S doesn't fire a propertyChange just for focus changes,
but it does refresh its validity at such focus change.
In this particular case, it discovers that it is not invalid,
since it has no validity constraints set.
That's why it calls clearErrorMessage(), erasing the form's error message.
The fact that the form remains invalid is not taken into consideration.
There are several work-arounds, but none gives me a good feeling.
Is there a common practice for this kind of problem?
Potentially I'm missing something in the normal PreferencePage behaviour...
Powered by FUDForum
. Page generated in 0.03233 seconds