Package com.smartgwt.client.widgets.form.validator

Examples of com.smartgwt.client.widgets.form.validator.FloatRangeValidator


    validator.setErrorMessage(info.getValidator().getErrorMessage());
    validators.add(validator);
  }

  private static Validator createFromDecimalMin(DecimalMinConstraintInfo decimalMin) {
    FloatRangeValidator floatMin = new FloatRangeValidator();
    floatMin.setMin(Float.parseFloat(decimalMin.getValue()));
    return floatMin;
  }
View Full Code Here


    floatMin.setMin(Float.parseFloat(decimalMin.getValue()));
    return floatMin;
  }

  private static Validator createFromDecimalMax(DecimalMaxConstraintInfo decimalMax) {
    FloatRangeValidator floatMax = new FloatRangeValidator();
    floatMax.setMax(Float.parseFloat(decimalMax.getValue()));
    return floatMax;
  }
View Full Code Here

  private static Validator[] createFromDigits(DigitsConstraintInfo digits, PrimitiveType type) {
    FloatPrecisionValidator floatPrecision = new FloatPrecisionValidator();
    floatPrecision.setPrecision(digits.getFractional());
    floatPrecision.setRoundToPrecision(digits.getFractional());
    IntegerRangeValidator integerDigit = null;
    FloatRangeValidator floatDigit = null;
    Validator[] validators;
    switch (type) {
      case SHORT:
      case INTEGER:
      case LONG:
        integerDigit = new IntegerRangeValidator();
        integerDigit.setMax((int) Math.pow(10.0, digits.getInteger()) - 1);
        validators = new Validator[] { floatPrecision, integerDigit };
        break;
      case FLOAT:
      case DOUBLE:
        floatDigit = new FloatRangeValidator();
        floatDigit.setMax((int) Math.pow(10.0, digits.getInteger()) - Float.MIN_VALUE);
        validators = new Validator[] { floatPrecision, floatDigit };
        break;
      default:
        validators = new Validator[] { floatPrecision };
    }
View Full Code Here

                    }

                    validators.add(validator);
                } else if (constraint instanceof FloatRangeConstraint) {
                    FloatRangeConstraint floatConstraint = ((FloatRangeConstraint) constraint);
                    FloatRangeValidator validator = new FloatRangeValidator();
                    if (floatConstraint.getMinimum() != null) {
                        validator.setMin(floatConstraint.getMinimum().floatValue());
                    }
                    if (floatConstraint.getMaximum() != null) {
                        validator.setMax(floatConstraint.getMaximum().floatValue());
                    }
                    validators.add(validator);
                } else if (constraint instanceof RegexConstraint) {
                    RegExpValidator validator = new RegExpValidator("^" + constraint.getDetails() + "$");
                    validators.add(validator);
View Full Code Here

        DataSourceEnumField unitsField = new DataSourceEnumField("units", "Units", 5);
        unitsField.setValueMap("Roll", "Ea", "Pkt", "Set", "Tube", "Pad", "Ream", "Tin", "Bag", "Ctn", "Box");

        DataSourceFloatField unitCostField = new DataSourceFloatField("unitCost", "Unit Cost", 5);
        FloatRangeValidator rangeValidator = new FloatRangeValidator();
        rangeValidator.setMin(0);
        rangeValidator.setErrorMessage("Please enter a valid (positive) cost");

        FloatPrecisionValidator precisionValidator = new FloatPrecisionValidator();
        precisionValidator.setPrecision(2);
        precisionValidator.setErrorMessage("The maximum allowed precision is 2");
View Full Code Here

        DataSourceEnumField unitsField = new DataSourceEnumField("units", "Units", 5);
        unitsField.setValueMap("Roll", "Ea", "Pkt", "Set", "Tube", "Pad", "Ream", "Tin", "Bag", "Ctn", "Box");

        DataSourceFloatField unitCostField = new DataSourceFloatField("unitCost", "Unit Cost", 5);
        FloatRangeValidator rangeValidator = new FloatRangeValidator();
        rangeValidator.setMin(0);
        rangeValidator.setErrorMessage("Please enter a valid (positive) cost");

        FloatPrecisionValidator precisionValidator = new FloatPrecisionValidator();
        precisionValidator.setPrecision(2);
        precisionValidator.setErrorMessage("The maximum allowed precision is 2");
View Full Code Here

TOP

Related Classes of com.smartgwt.client.widgets.form.validator.FloatRangeValidator

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.