Class ValidatorManager


  • public class ValidatorManager
    extends java.lang.Object
    Validator that manages several control validators on a wizard page.
    Author:
    Christopher Mindus
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidadd​(IValidator validator)
      Adds a validator.
      booleanhasBeenModified()
      Checks if any input has been modified.
      booleanisValidAndComplete()
      Returns if the last validation is in error or not.
      ControlValidatornewManualValidator​(org.eclipse.swt.widgets.Control control, int location)
      Creates a validator for any other control with manual verification.
      ControlValidatornewValidator​(org.eclipse.swt.widgets.Button control)
      Creates a validator for a button in order to handle modified states.
      ControlValidatornewValidator​(org.eclipse.swt.widgets.Combo control, java.lang.String descr, boolean mustBeSpecified)
      Creates a validator for a combo.
      ControlValidatornewValidator​(org.eclipse.swt.widgets.Spinner control, java.lang.String descr, int min, int max, int value, int textLimit)
      Creates a validator for a spinner with a range and sets up the control.
      ControlValidatornewValidator​(org.eclipse.swt.widgets.Text control, java.lang.String descr, boolean mustBeSpecified)
      Creates a validator for a text field.
      ControlValidatornewValidator​(org.eclipse.swt.widgets.Tree control, java.lang.String descr, boolean mustBeSpecified)
      Creates a validator for a tree in order to handle modified states.
      voidresetModified()
      Resets the modified state for all validators.
      booleanvalidate()
      Validates the entire dialog.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValidatorManager

        public ValidatorManager​(IValidationMessage messageHandler)
        Creates the validation manager without a default message.
        Parameters:
        messageHandler - The message handler dialog, wizard or page.
      • ValidatorManager

        public ValidatorManager​(IValidationMessage messageHandler,
                                java.lang.String defaultText)
        Creates the validation manager with a default message.
        Parameters:
        messageHandler - The message handler dialog, wizard or page.
        defaultText - Default text, can be null.
    • Method Detail

      • 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

        public void add​(IValidator validator)
        Adds a validator.
      • newValidator

        public ControlValidator newValidator​(org.eclipse.swt.widgets.Button control)
        Creates a validator for a button in order to handle modified states.
      • newValidator

        public ControlValidator newValidator​(org.eclipse.swt.widgets.Tree control,
                                             java.lang.String descr,
                                             boolean mustBeSpecified)
        Creates a validator for a tree in order to handle modified states.
      • newValidator

        public ControlValidator newValidator​(org.eclipse.swt.widgets.Text control,
                                             java.lang.String descr,
                                             boolean mustBeSpecified)
        Creates a validator for a text field.
      • newValidator

        public ControlValidator newValidator​(org.eclipse.swt.widgets.Combo control,
                                             java.lang.String descr,
                                             boolean mustBeSpecified)
        Creates a validator for a combo.
      • newManualValidator

        public ControlValidator newManualValidator​(org.eclipse.swt.widgets.Control control,
                                                   int location)
        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​(org.eclipse.swt.widgets.Spinner control,
                                             java.lang.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.