Class ControlValidator

java.lang.Object
com.iizigo.validator.ValidationAdapter
com.iizigo.validator.ControlValidator
All Implemented Interfaces:
IValidator, EventListener, FocusListener, ModifyListener, SelectionListener, VerifyListener, SWTEventListener

public class ControlValidator extends ValidationAdapter implements ModifyListener, VerifyListener, SelectionListener, FocusListener
Control validator class for dialog boxes.
Author:
Christopher Mindus
  • Field Details

  • Method Details

    • getImage

      public static Image getImage(int type)
      Gets the required image.
      Parameters:
      type - Image type: NONE, INFORMATION, WARNING or ERROR.
    • setDecoratedControl

      public void setDecoratedControl(Control control)
      Place the control decorator on this component instead of the control.
      Parameters:
      control - The control, if e.g. a composite is wrapping an entry field.
    • setValidatorCallback

      public void setValidatorCallback(ValidatorCallback callback)
      Sets the callback validator.
    • setType

      public void setType(String descr, int flags)
      Sets the description and flags.
    • setType

      public void setType(int flags)
      Sets the type.
    • getMessage

      public String getMessage()
      Gets the message.
      Specified by:
      getMessage in interface IValidator
    • setRequiredMessage

      public String setRequiredMessage(String message)
      Sets a required message.
    • setInformationMessage

      public String setInformationMessage(String message)
      Sets a warning message.
    • setWarningMessage

      public String setWarningMessage(String message)
      Sets a warning message.
    • setErrorMessage

      public String setErrorMessage(String message)
      Sets an error message.
    • getMessageType

      public int getMessageType()
      Gets the type of message (ERROR, WARNING, INFORMATION or NONE).
      Specified by:
      getMessageType in interface IValidator
    • modifyText

      public void modifyText(ModifyEvent e)
      Handles modifications.
      Specified by:
      modifyText in interface ModifyListener
    • verifyText

      public void verifyText(VerifyEvent e)
      Verifies input for for upper case and numeric only.
      Specified by:
      verifyText in interface VerifyListener
    • widgetSelected

      public void widgetSelected(SelectionEvent e)
      Selection changes (spinner).
      Specified by:
      widgetSelected in interface SelectionListener
    • widgetDefaultSelected

      public void widgetDefaultSelected(SelectionEvent e)
      Not processed.
      Specified by:
      widgetDefaultSelected in interface SelectionListener
    • reset

      public void reset()
      Resets the validator before performing all validations in the manager.
      Specified by:
      reset in interface IValidator
    • validate

      public boolean validate()
      Performs validation.
      Specified by:
      validate in interface IValidator
      Returns:
      true for success, false for failure.
    • setAtomNameValidator

      public void setAtomNameValidator(PropCnr container, GProp<?> property, boolean allowLeadingDollar)
      Assigns the callback to be an Atom Name Validator.
      Parameters:
      container - Property container where the name must not exist, null for no check.
      property - The property (name) being edited, null for none.
      allowLeadingDollar - Flag indicating leading dollar is allowed or not.
    • focusGained

      public void focusGained(FocusEvent e)
      Sent when a control gets focus.
      Specified by:
      focusGained in interface FocusListener
      Parameters:
      e - An event containing information about the focus change.
    • focusLost

      public void focusLost(FocusEvent e)
      Sent when a control loses focus.
      Specified by:
      focusLost in interface FocusListener
      Parameters:
      e - An event containing information about the focus change.