Examples of FloatRangeValidator


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

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

    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

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

  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

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

                    }

                    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

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

        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

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

        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

Examples of org.apache.pivot.wtk.text.validation.FloatRangeValidator

        textinputDateRegex = (TextInput)wtkxSerializer.get("textinputDateRegex");
        textinputCustomBoolean = (TextInput)wtkxSerializer.get("textinputCustomBoolean");

        // standard float range model
        textinputFloatRange.setText("0.5");
        textinputFloatRange.setValidator(new FloatRangeValidator(0.3f, 2000f));

        // test the listener by updating a label
        textinputFloatRange.getTextInputListeners().add(new TextInputListener() {
            @Override
            public void maximumLengthChanged(TextInput textInput, int previousMaximumLength) {
View Full Code Here

Examples of org.apache.pivot.wtk.text.validation.FloatRangeValidator

        textinputDateRegex = (TextInput)wtkxSerializer.get("textinputDateRegex");
        textinputCustomBoolean = (TextInput)wtkxSerializer.get("textinputCustomBoolean");

        // standard float range model
        textinputFloatRange.setText("0.5");
        textinputFloatRange.setValidator(new FloatRangeValidator(0.3f, 2000f));

        // test the listener by updating a label
        textinputFloatRange.getTextInputListeners().add(new TextInputListener() {
            @Override
            public void maximumLengthChanged(TextInput textInput, int previousMaximumLength) {
View Full Code Here

Examples of org.apache.pivot.wtk.validation.FloatRangeValidator

        // standard float range model
        // note that float approximations could give errors,
        // try to increment/decrement the initial value near a range end, to see problems ...
        textinputFloatRange.setText(nf.format(new Float(testValue)));
        textinputFloatRange.setValidator(new FloatRangeValidator(2.0f, 123456789f));

        // test the listener by updating a label
        textinputFloatRange.getTextInputListeners().add(new TextInputListener.Adapter() {
            @Override
            public void textValidChanged(TextInput textInput) {
View Full Code Here

Examples of org.apache.pivot.wtk.validation.FloatRangeValidator

        textinputDateRegex = (TextInput)bxmlSerializer.getNamespace().get("textinputDateRegex");
        textinputCustomBoolean = (TextInput)bxmlSerializer.getNamespace().get("textinputCustomBoolean");

        // standard float range model
        textinputFloatRange.setText("0.5");
        textinputFloatRange.setValidator(new FloatRangeValidator(0.3f, 2000f));

        // test the listener by updating a label
        textinputFloatRange.getTextInputListeners().add(new TextInputListener.Adapter() {
            @Override
            public void textValidChanged(TextInput textInput) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.