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

Examples of eu.maydu.gwt.validation.client.validators.datetime.algorithms.TimeValidatorAlgorithm


   * @param secondsAllowed Should seconds be optional
   * @param secondsRequired Are seconds required (overwrites the secondsAllowed field)
   */
  public TimeValidator(TextBox text, boolean secondsAllowed, boolean secondsRequired) {
    this.text = text;
    algorithm = new TimeValidatorAlgorithm(secondsAllowed, secondsRequired);
  }
View Full Code Here


  }
 
  public TimeValidator(TextBox text, boolean secondsAllowed, boolean secondsRequired, String customMessageKey) {
    this.text = text;
    this.setCustomMsgKey(customMessageKey);
    algorithm = new TimeValidatorAlgorithm(secondsAllowed, secondsRequired);
  }
View Full Code Here

   
  }
 
  public TimeValidator(SuggestBox suggest, boolean secondsAllowed, boolean secondsRequired) {
    this.suggest = suggest;
    algorithm = new TimeValidatorAlgorithm(secondsAllowed, secondsRequired);
  }
View Full Code Here

  }
 
  public TimeValidator(SuggestBox suggest, boolean secondsAllowed, boolean secondsRequired, String customMessageKey) {
    this.suggest = suggest;
    this.setCustomMsgKey(customMessageKey);
    algorithm = new TimeValidatorAlgorithm(secondsAllowed, secondsRequired);
  }
View Full Code Here

public class TimeAlgorithmTest extends TestCase {

  public void testTimeAlgorithmSecondsNotAllowed() {
   
    TimeValidatorAlgorithm algorithm = new TimeValidatorAlgorithm();
   
    ValidatorAlgorithmResult result = algorithm.validate("12:30");
    assertNull("12:30 is a correct time", result);
   
    result = algorithm.validate("00:0");
    assertNotNull("00:0 is an incorrect time", result);
   
    result = algorithm.validate("0:00");
    assertNull("0:00 is a correct time", result);
   
    result = algorithm.validate("0:01");
    assertNull("0:01 is a correct time", result);
   
    result = algorithm.validate("23:57");
    assertNull("23:57 is a correct time", result);
   
    result = algorithm.validate("1a:30");
    assertNotNull("1a:30 is a correct time", result);
   
    result = algorithm.validate("12:30:20");
    assertNotNull("12:30:20 is a correct time, but seconds are not allowed", result);
    assertEquals("Error code must be NOT_A_VALID_TIME_WITHOUT_SECONDS", TimeValidatorAlgorithm.NOT_A_VALID_TIME_WITHOUT_SECONDS, result.getErrorCode());
   
   
    result = algorithm.validate("24:57");
    assertNotNull("24:57 is not a correct time", result);
   
    result = algorithm.validate("100:57");
    assertNotNull("100:57 is not a correct time", result);
   
    result = algorithm.validate("-1:57");
    assertNotNull("-1:57 is not a correct time", result);
   
  }
View Full Code Here

    assertNotNull("-1:57 is not a correct time", result);
   
  }
 
  public void testTimeAlgorithmSecondsAllowed() {
    TimeValidatorAlgorithm algorithm = new TimeValidatorAlgorithm(true, false);
   
    ValidatorAlgorithmResult result = algorithm.validate("12:30");
    assertNull("12:30 is a correct time", result);
   
    result = algorithm.validate("00:0");
    assertNotNull("00:0 is an incorrect time", result);
   
    result = algorithm.validate("0:00");
    assertNull("0:00 is a correct time", result);
   
    result = algorithm.validate("0:01");
    assertNull("0:01 is a correct time", result);
   
    result = algorithm.validate("23:57");
    assertNull("23:57 is a correct time", result);
   
    result = algorithm.validate("1a:30");
    assertNotNull("1a:30 is a correct time", result);
   
    result = algorithm.validate("12:30:20");
    assertNull("12:30:20 is a correct time, seconds are allowed", result);
   
    result = algorithm.validate("12:30:59");
    assertNull("12:30:59 is a correct time, seconds are allowed", result);
   
    result = algorithm.validate("12:30:60");
    assertNotNull("12:30:60 is not a correct time, seconds are allowed", result);
   
    result = algorithm.validate("12:30:0");
    assertNotNull("12:30:0 is not a correct time, seconds are allowed", result);
   
    result = algorithm.validate("12:30:1000");
    assertNotNull("12:30:1000 is a correct time, seconds are allowed", result);
   
    result = algorithm.validate("12:30:2,0");
    assertNotNull("12:30:2,0 is a correct time, seconds are allowed", result);
   
    result = algorithm.validate("24:57");
    assertNotNull("24:57 is not a correct time", result);
   
    result = algorithm.validate("100:57");
    assertNotNull("100:57 is not a correct time", result);
   
    result = algorithm.validate("-1:57");
    assertNotNull("-1:57 is not a correct time", result);
  }
View Full Code Here

    assertNotNull("-1:57 is not a correct time", result);
  }
 
 
  public void testTimeAlgorithmSecondsRequired() {
    TimeValidatorAlgorithm algorithm = new TimeValidatorAlgorithm(false, true);
   
    ValidatorAlgorithmResult result = algorithm.validate("12:30");
    assertNotNull("12:30 is not a correct time, seconds required", result);
   
    result = algorithm.validate("00:0");
    assertNotNull("00:0 is an incorrect time", result);
   
    result = algorithm.validate("0:00");
    assertNotNull("0:00 is a correct time, seconds required", result);
   
    result = algorithm.validate("0:01");
    assertNotNull("0:01 is a correct time, seconds required", result);
   
    result = algorithm.validate("23:57");
    assertNotNull("23:57 is a correct time, seconds required", result);
   
    result = algorithm.validate("1a:30");
    assertNotNull("1a:30 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:20");
    assertNull("12:30:20 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:59");
    assertNull("12:30:59 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:60");
    assertNotNull("12:30:60 is not a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:0");
    assertNotNull("12:30:0 is not a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:1000");
    assertNotNull("12:30:1000 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:2,0");
    assertNotNull("12:30:2,0 is a correct time, seconds required", result);
   
    result = algorithm.validate("24:57");
    assertNotNull("24:57 is not a correct time, seconds required", result);
   
    result = algorithm.validate("100:57");
    assertNotNull("100:57 is not a correct time, seconds required", result);
   
    result = algorithm.validate("-1:57");
    assertNotNull("-1:57 is not a correct time, seconds required", result);
  }
View Full Code Here

    assertNotNull("-1:57 is not a correct time, seconds required", result);
  }
 
 
  public void testTimeAlgorithmSecondsRequiredAndAllowed() {
    TimeValidatorAlgorithm algorithm = new TimeValidatorAlgorithm(true, true);
   
    ValidatorAlgorithmResult result = algorithm.validate("12:30");
    assertNotNull("12:30 is not a correct time, seconds required", result);
   
    result = algorithm.validate("00:0");
    assertNotNull("00:0 is an incorrect time", result);
   
    result = algorithm.validate("0:00");
    assertNotNull("0:00 is a correct time, seconds required", result);
   
    result = algorithm.validate("0:01");
    assertNotNull("0:01 is a correct time, seconds required", result);
   
    result = algorithm.validate("23:57");
    assertNotNull("23:57 is a correct time, seconds required", result);
   
    result = algorithm.validate("1a:30");
    assertNotNull("1a:30 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:20");
    assertNull("12:30:20 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:59");
    assertNull("12:30:59 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:60");
    assertNotNull("12:30:60 is not a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:0");
    assertNotNull("12:30:0 is not a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:1000");
    assertNotNull("12:30:1000 is a correct time, seconds required", result);
   
    result = algorithm.validate("12:30:2,0");
    assertNotNull("12:30:2,0 is a correct time, seconds required", result);
   
    result = algorithm.validate("24:57");
    assertNotNull("24:57 is not a correct time, seconds required", result);
   
    result = algorithm.validate("100:57");
    assertNotNull("100:57 is not a correct time, seconds required", result);
   
    result = algorithm.validate("-1:57");
    assertNotNull("-1:57 is not a correct time, seconds required", result);
  }
View Full Code Here

TOP

Related Classes of eu.maydu.gwt.validation.client.validators.datetime.algorithms.TimeValidatorAlgorithm

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.