[DataBinding] Validation [message #447582] |
Tue, 11 April 2006 03:36  |
Eclipse User |
|
|
|
With the "partially validation" the event prevent user from writing in
the field if the condition is invalid (Validator.isPartiallyValid()).
Sometimes i just want to ask the user that what is writing is not valid
and not refusing.
The ValidationError object have 2 state WARNING and ERROR, but i don't
fing where this difference is used.
I modify the code in the ValueBinding class to change the behave of the
targetChangingListener :
private final IValueChangingListener targetChangingListener = new
IValueChangingListener() {
public boolean handleValueChanging(IVetoableValue source, ValueDiff
diff) {
if (updating)
return true;
// we are notified of a pending change, do validation
// and veto the change if it is not valid
Object value = diff.getNewValue();
ValidationError partialValidationError = targetValidator
.isPartiallyValid(value);
partialValidationErrorObservable.setValue(partialValidationE rror);
return partialValidationError == null ||
partialValidationError.status == ValidationError.WARNING;
}
};
Then i the state is error the writing is refused, if the state is
warning the ValidationError is returned but the writing is accepted.
What is your opinion on this behave ?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03606 seconds