Package com.google.gwt.libideas.validation.client

Examples of com.google.gwt.libideas.validation.client.Validator


    // /////////////////////////////////////////////
    // Validation Support.
    // ////////////////////////////////////////////

    // Cannot book anyone younger than 18 or older than 100.
    Validator crimeValidator = new DateRangeValidator(offsetDate(100),
        offsetDate(18));
    ValidatorController crimeValidation = ValidatorController.addAsFocusListener(
        birth, crimeValidator);

    // Crime codes must be correctly formatted.
    ValidatorController.addAsFocusListener(crimeCode, crimeCodeFormatValidator);

    // Phone numbers can be pushed into shape if they are almost correctly
    // formatted.
    ValidatorController.addAsFocusListener(phone, new USPhoneValidator());

    // Creates a custom validator.
    Validator statuteValidator = createStatuteValidator(crimeCode);

    // Can add the same validator to multiple subjects to do multi-field
    // validation.
    crimeValidation.addValidator(statuteValidator);
    ValidatorController.addAsFocusListener(dateOfCrime, statuteValidator);
View Full Code Here


   * against the date of the crime.
   */
  private Validator createStatuteValidator(final TextBox crimeCode) {
    // Now, to show a custom validator. Using BuiltInValidator because we want
    // to use the built-in error messages for Date conversion.
    Validator statuteValidator = new BuiltInValidator() {
      public void checkValid(Subject subject, ErrorHandler handler) {
        String code = crimeCode.getText();
        Date dateOfCrime = null;
        try {
          dateOfCrime = getDate(subject);
View Full Code Here

TOP

Related Classes of com.google.gwt.libideas.validation.client.Validator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.