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

Examples of eu.maydu.gwt.validation.client.validators.numeric.IntegerValidator


  private void setupValidation() {
    validator = new DefaultValidationProcessor(showcaseMessages);
    popupDesc = new PopupDescription(showcaseMessages, Location.TOP);
    FocusAction focusAction = new FocusAction();
   
    IntegerValidator val = new IntegerValidator(integerPositiveTextBox, 1, Integer.MAX_VALUE, "customNotInRange");
    //val.setRequired(false);
   
    validator.addValidators("positiveInteger",
        val
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
          //.addActionForFailure(new TextAction(errorLabel))
    );
   
   
    popupDesc.addDescription("positiveIntegerHelp", integerPositiveTextBox);
   
    validator.addValidators("integerInRangeMinus5000Plus5000",
      new IntegerValidator(integerMinus5000To5000TextBox, -5000, 5000)
        .addActionForFailure(focusAction)
        .addActionForFailure(new StyleAction("validationFailedBorder"))
    );
   
    popupDesc.addDescription("integerInRangeMinus5000Plus5000Help", integerMinus5000To5000TextBox);
   
    validator.addValidators("anyInteger",
        new IntegerValidator(integerTextBox3)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
      );
   
    popupDesc.addDescription("anyIntegerHelp", integerTextBox3);
   
   
    validator.addValidators("stringLengthSmaller5",
      new StringLengthValidator(stringLengthSmaller5TextBox, 0, 4)
        .addActionForFailure(focusAction)
        .addActionForFailure(new StyleAction("validationFailedBorder"))
    );
   
    popupDesc.addDescription("stringLengthSmaller5Help", stringLengthSmaller5TextBox);
   
   
   
    validator.addValidators("stringLengthBetween2And5",
        new StringLengthValidator(stringLengthBetween2And5TextBox, 2, 5)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
    );
   
    popupDesc.addDescription("stringLengthBetween2And5Help", stringLengthBetween2And5TextBox);
   
    validator.addValidators("notEmpty",
        new NotEmptyValidator(notEmptyTextBox)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
    );
   
    validator.addValidators("localizedDate",
        new LocalizedDateValidator(localizedDateTextBox, DateTimeFormat.getShortDateFormat(), false)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
      );
   
    popupDesc.addDescription("localizedDate.description", localizedDateTextBox);
   
    validator.addValidators("name",
        new NameValidator(nameValidatorTextBox)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
    );
   
    popupDesc.addDescription("name.description", nameValidatorTextBox);
   
    popupDesc.addDescription("notEmptyHelp", notEmptyTextBox);

    RegularExpressionValidator regex = new RegularExpressionValidator(regexValidateEntryTextBox, new ValidatorConfigurationSource<String>() {

      public String getConfigurationValue() {
        String regex = regexEntryTextBox.getText();
        if(regex.trim().equals("")) {
          regexEntryTextBox.setText("(a|b)*");
          return "(a|b)*";
        }
       
        return regex;
      }
     
    }, "regexNotMatched");
   
    validator.addValidators("enterRegExedText", regex
      .addActionForFailure(new StyleAction("validationFailedBorder"))
      .addActionForFailure(focusAction)
    );
   
    popupDesc.addDescription("regexText.description", regexValidateEntryTextBox);
   
    validator.addValidators("localizedDate",
        new LocalizedDateValidator(localizedDateTextBox, DateTimeFormat.getShortDateFormat(), false)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
      );
   
    popupDesc.addDescription("localizedDate.description", localizedDateTextBox);
   
   
    validator.addValidators("suggest1", new IntegerValidator(suggestBox1)
      .addActionForFailure(new StyleAction("validationFailedBorder"))
      //.addActionForFailure(focusAction)
    );
    popupDesc.addDescription("localizedDate.description", suggestBox1);
   
View Full Code Here


        GWT.log("Primary style: "+text1.getStylePrimaryName(), null);
      }
     
    });
   
    validator.addValidators("int", new IntegerValidator(text1, 0, 50000).addActionForFailure(new StyleAction("validationFailedBorder")));
   
    return panel;
  }
View Full Code Here

  private void setup(int min, int max) {
    if(this.text != null) {
      addValidators(
          new TrimTransformer(this.text),
          this.noMinMax?
              new IntegerValidator(this.text):
              new IntegerValidator(this.text, min, max)
          );
    }else {
      addValidators(
          new TrimTransformer(this.suggest),
          this.noMinMax?
              new IntegerValidator(this.suggest):
              new IntegerValidator(this.suggest, min, max)
          );
    }
  }
View Full Code Here

  private void setupValidation() {
    validator = new DefaultValidationProcessor(showcaseMessages);
    popupDesc = new PopupDescription(showcaseMessages);
    FocusAction focusAction = new FocusAction();
   
    IntegerValidator val = new IntegerValidator(integerPositiveTextBox, 1, Integer.MAX_VALUE, "customNotInRange");
    //val.setRequired(false);
   
    validator.addValidators("positiveInteger",
        val
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
          //.addActionForFailure(new TextAction(errorLabel))
    );
   
   
    popupDesc.addDescription("positiveIntegerHelp", integerPositiveTextBox);
   
    validator.addValidators("integerInRangeMinus5000Plus5000",
      new IntegerValidator(integerMinus5000To5000TextBox, -5000, 5000)
        .addActionForFailure(focusAction)
        .addActionForFailure(new StyleAction("validationFailedBorder"))
    );
   
    popupDesc.addDescription("integerInRangeMinus5000Plus5000Help", integerMinus5000To5000TextBox);
   
    validator.addValidators("anyInteger",
        new IntegerValidator(integerTextBox3)
          .addActionForFailure(focusAction)
          .addActionForFailure(new StyleAction("validationFailedBorder"))
      );
   
    popupDesc.addDescription("anyIntegerHelp", integerTextBox3);
View Full Code Here

TOP

Related Classes of eu.maydu.gwt.validation.client.validators.numeric.IntegerValidator

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.