Package com.iizigo.validator
Class ValidatorManager
java.lang.Object
com.iizigo.validator.ValidatorManager
Validator that manages several control validators on a wizard page.
- Author:
- Christopher Mindus
Constructor Summary
ConstructorDescriptionValidatorManager
(IValidationMessage messageHandler) Creates the validation manager without a default message.ValidatorManager
(IValidationMessage messageHandler, String defaultText) Creates the validation manager with a default message.Method Summary
Modifier and TypeMethodDescriptionvoid
add
(IValidator validator) Adds a validator.boolean
Checks if any input has been modified.boolean
Returns if the last validation is in error or not.newManualValidator
(Control control, int location) Creates a validator for any other control with manual verification.newValidator
(Button control) Creates a validator for a button in order to handle modified states.newValidator
(Combo control, String descr, boolean mustBeSpecified) Creates a validator for a combo.newValidator
(Spinner control, String descr, int min, int max, int value, int textLimit) Creates a validator for a spinner with a range and sets up the control.newValidator
(Text control, String descr, boolean mustBeSpecified) Creates a validator for a text field.newValidator
(Tree control, String descr, boolean mustBeSpecified) Creates a validator for a tree in order to handle modified states.void
Resets the modified state for all validators.boolean
validate()
Validates the entire dialog.
Constructor Details
ValidatorManager
Creates the validation manager without a default message.- Parameters:
messageHandler
- The message handler dialog, wizard or page.
ValidatorManager
Creates the validation manager with a default message.- Parameters:
messageHandler
- The message handler dialog, wizard or page.defaultText
- Default text, can be null.
Method Details
hasBeenModified
public boolean hasBeenModified()Checks if any input has been modified.resetModified
public void resetModified()Resets the modified state for all validators.isValidAndComplete
public boolean isValidAndComplete()Returns if the last validation is in error or not.- Returns:
- true if OK (or warning), false for error or missing parameters.
validate
public boolean validate()Validates the entire dialog.- Returns:
- true if all validates OK (with possible warnings), false otherwise.
add
Adds a validator.newValidator
Creates a validator for a button in order to handle modified states.newValidator
Creates a validator for a tree in order to handle modified states.newValidator
Creates a validator for a text field.newValidator
Creates a validator for a combo.newManualValidator
Creates a validator for any other control with manual verification.- Parameters:
control
- The control.location
- The location: combination of e.g. SWT.TOP|SWT.LEFT.
newValidator
public ControlValidator newValidator(Spinner control, String descr, int min, int max, int value, int textLimit) Creates a validator for a spinner with a range and sets up the control.- Parameters:
control
- The spinner.descr
- The field description.min
- Minimum value.max
- Maximum value.value
- The current value.textLimit
- The text limit.