A validation event handler around a {@link ServerValidator} that acts both asa listener for incoming validation requests as well as a notifier of validation completion.
As a listener, the validation handler will get notified when there are changes to account values (e.g. username changed or different cloud space selected), or when a user has explicitly requested a server authorisation (e.g., a user has pressed a "Validate" UI control), and if necessary, perform an account validation. Validations may be both local or can be server authorisations, depending on the type of event received by this wrapper.
As a notifier, once a validation is completed, the handler will notify registered listeners that validation has been performed.
The handler also keeps tracks of errors based on event types. This allows multiple notifiers, like different UI parts or other components, that fire events, to log errors.
IMPORTANT NOTE: errors are tracked by event type. Therefore in order to CLEAR an error, an {@link IStatus#OK} event with the SAME event type must be fired,whether by the same notifier that fired the initial error, or any other notifier.
For example, a credentials UI part fires an event type VALUE_FILLED, with an {@link IStatus#ERROR}, due to a missing value like a password in a UI control. Once this error has been corrected (password filled), the same VALUE_FILLED event must be fired with an {@link IStatus#OK} in order to clearthat error. This event need not be fired by the same UI part that generated the initial error, it can be fired by some other component (maybe one that reads a stored password value), as long as the event type REMAINS the same.
Otherwise if an OK status is fired with a different event type, or example, PASSWORD_FILLED, the error will NOT be cleared.
Therefore event types in {@link PartChangeEvent} should NOT represent anerror condition (e.g missing values). Rather they should indicate:
1. An action that was performed, like values being entered.
2. A validation request (e.g. validate locally or validate against a server).
To indicate an error status associated with an event type, use the {@link IStatus} value in the {@link PartChangeEvent}