Package eu.maydu.gwt.validation.client.validators

Examples of eu.maydu.gwt.validation.client.validators.ValidatorAlgorithmResult


  @Override
  public <V extends ValidationMessages> ValidationResult validate(V messages) {
    String input = getInput();
    if(!isRequired() && input.equals(""))
      return null;
    ValidatorAlgorithmResult result = algorithm.validate(input);
    if (result == null)
      return null;

    return result(result, messages);
View Full Code Here


  public <V extends ValidationMessages> ValidationResult validate(V messages) {
    String input = getInput();
    if(!isRequired() && input.equals(""))
      return null;
   
    ValidatorAlgorithmResult result = algorithm.validate(input);
   
    if(result == null)
      return null;
   
    return new ValidationResult(getErrorMessage(messages, messages.getStandardMessages().notAValidEmail((String)result.getParameters()[0]), result.getParameters()));
  }
View Full Code Here

      return new ValidationResult(getErrorMessage(allMessages, messages.notNull()));
   
    List<String> strings = new LinkedList<String>();
    strings.add(str1);
    strings.add(str2);
    ValidatorAlgorithmResult result = algorithm.validate(strings);
    if(result == null)
      return null;
    else
      return new ValidationResult(getErrorMessage(allMessages, messages.stringsNotEqual()));
   
View Full Code Here

      input = suggest.getText();
   
    if(!this.isRequired() && input.equals(""))
      return null;
   
    ValidatorAlgorithmResult result = algorithm.validate(input);
   
    if(result == null)
      return null;
   
    String stdMessage = getStdMessage(messages.getStandardMessages(), result.getErrorCode(), result.getParameters()[0].toString());
   
    return new ValidationResult(this.getErrorMessage(messages, stdMessage, result.getParameters()));
   
  }
View Full Code Here

      boolean matches = input.matches(withoutSecondsPattern);
      if(!matches) {
        if(secondsAllowed) {
          matches = input.matches(withSecondsPattern);
          if(!matches)
            return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITH_SECONDS_OPTIONALLY, input);
          else
            return null;
        }
        return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITHOUT_SECONDS, input);
       
      }
      return boundsCheck(input);
    }

    if(secondsRequired) {
      boolean matches = input.matches(withSecondsPattern);
      if(!matches) {
        return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITH_SECONDS_REQUIRED, input);
      }
    }
   
    return boundsCheck(input);
   
View Full Code Here

    for(int i=0; i<values.length; i++) {
      int max = i==0?23:59;
      int value = Integer.valueOf(values[i]);
      if(value > max) {
        if(secondsRequired)
          return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITH_SECONDS_REQUIRED, input);
        else if(secondsAllowed)
          return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITH_SECONDS_OPTIONALLY, input);
        else return new ValidatorAlgorithmResult(NOT_A_VALID_TIME_WITHOUT_SECONDS, input);
      }
    }
    return null;
  }
View Full Code Here

    return null;
  }

  private ValidatorAlgorithmResult result(char c) {
    return new ValidatorAlgorithmResult(NOT_A_VALID_CHARACTER, c);
  }
View Full Code Here

   
    */
  }

  private ValidatorAlgorithmResult result(String input) {
    return new ValidatorAlgorithmResult(NOT_A_VALID_EMAIL_ADDRESS, input);
  }
View Full Code Here

   
    return null;
  }

  private ValidatorAlgorithmResult notEqual() {
    return new ValidatorAlgorithmResult(NOT_EQUAL);
  }
View Full Code Here

 
  public void testValidEmails() {
   
    EmailValidatorAlgorithm algorithm = new EmailValidatorAlgorithm();
   
    ValidatorAlgorithmResult result = algorithm.validate("test@test.com");
    assertNull("test@test.com is a valid email address", result);
   
    result = algorithm.validate("Test.Test@test.com");
    assertNull("Test.Test@test.com is a valid email address", result);
   
View Full Code Here

TOP

Related Classes of eu.maydu.gwt.validation.client.validators.ValidatorAlgorithmResult

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.