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

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


  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();
View Full Code Here


    dateFuture.setMin(new Date());
    return dateFuture;
  }

  private static Validator createFromMax(MaxConstraintInfo max) {
    IntegerRangeValidator integerMax = new IntegerRangeValidator();
    integerMax.setMax((int) max.getValue());
    return integerMax;
  }
View Full Code Here

    integerMax.setMax((int) max.getValue());
    return integerMax;
  }

  private static Validator createFromMin(MinConstraintInfo min) {
    IntegerRangeValidator integerMin = new IntegerRangeValidator();
    integerMin.setMin((int) min.getValue());
    return integerMin;
  }
View Full Code Here

            this.form.setColWidths("140", "90", "105", "*");

            final IntegerItem valueItem = new IntegerItem(FIELD_VALUE, title);
            valueItem.setShowTitle(getShowTitle());
            valueItem.setValue(getValue());
            IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
            integerRangeValidator.setMin(1);
            integerRangeValidator.setMax(Integer.MAX_VALUE);
            valueItem.setValidators(integerRangeValidator);
            valueItem.setValidateOnChange(true);

            valueItem.addChangedHandler(new ChangedHandler() {
                public void onChanged(ChangedEvent event) {
View Full Code Here

        form.setColWidths("126", "60");

        final IntegerItem valueItem = new IntegerItem(FIELD_VALUE, title);
        valueItem.setShowTitle(getShowTitle());
        valueItem.setValue(super.getValue());
        IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
        integerRangeValidator.setMin(1);
        integerRangeValidator.setMax(Integer.MAX_VALUE);
        valueItem.setValidators(integerRangeValidator);
        valueItem.setValidateOnChange(true);

        SelectItem unitsItem = new SelectItem(FIELD_UNITS);
        unitsItem.setShowTitle(false);
View Full Code Here

    protected static DataSourceIntegerField createIntegerField(String name, String title, Integer minValue,
        Integer maxValue, Boolean required) {
        DataSourceIntegerField textField = new DataSourceIntegerField(name, title);
        textField.setRequired(required);
        if (minValue != null || maxValue != null) {
            IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
            if (minValue != null) {
                integerRangeValidator.setMin(minValue);
            } else {
                integerRangeValidator.setMin(Integer.MIN_VALUE);
            }
            if (maxValue != null) {
                integerRangeValidator.setMax(maxValue);
            } else {
                integerRangeValidator.setMax(Integer.MAX_VALUE);
            }

            textField.setValidators(integerRangeValidator);
        }
        return textField;
View Full Code Here

        final IntegerItem intervalItem = new IntegerItem();
        intervalItem.setWrapTitle(false);
        intervalItem.setWidth(75);
        intervalItem.setName(ITEM_INTERVAL);
        intervalItem.setTitle(MSG.view_inventory_collectionInterval());
        final IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
        integerRangeValidator.setMin(1);
        integerRangeValidator.setMax(10000000); // avoids exceptions if someone enters really large nums; no one needs to go higher anyway
        intervalItem.setValidators(integerRangeValidator);
        intervalItem.addChangedHandler(new ChangedHandler() {
            public void onChanged(ChangedEvent changedEvent) {
                refresh(UpdateCollectionIntervalWidget.this.schedulesView.getListGrid());
            }
        });

        // Specify a null title so no label is rendered to the left of the combo box.
        SelectItem unitsItem = new SelectItem(ITEM_UNITS, null);
        unitsItem.setValueMap(VALUE_MAP);
        unitsItem.setDefaultValue(UNITS_MINUTES);
        unitsItem.setShowTitle(false);
        unitsItem.setWidth(125);
        unitsItem.addChangedHandler(new ChangedHandler() {
            @Override
            public void onChanged(ChangedEvent event) {
                String value = (String) event.getValue();
                if (value.equals(UNITS_SECONDS)) {
                    integerRangeValidator.setMin(30);
                } else {
                    integerRangeValidator.setMin(1);
                }
                refresh(UpdateCollectionIntervalWidget.this.schedulesView.getListGrid());
            }
        });
View Full Code Here

        Set<Constraint> constraints = propertyDefinition.getConstraints();
        if (constraints != null) {
            for (Constraint constraint : constraints) {
                if (constraint instanceof IntegerRangeConstraint) {
                    IntegerRangeConstraint integerConstraint = ((IntegerRangeConstraint) constraint);
                    IntegerRangeValidator validator = new IntegerRangeValidator();
                    if (integerConstraint.getMinimum() != null) {
                        validator.setMin(integerConstraint.getMinimum().intValue());
                    } else {
                        validator.setMin(Integer.MIN_VALUE);
                    }
                    if (integerConstraint.getMaximum() != null) {
                        validator.setMax(integerConstraint.getMaximum().intValue());
                    } else {
                        validator.setMax(Integer.MAX_VALUE);
                    }

                    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

            .withAttribute("autocomplete", "off").build((FormItem) GWT.create(PasswordItem.class));

        items.addAll(passwordVerifyItems);
        credentialsForm.setFields(items.toArray(new FormItem[items.size()]));

        validator = new IntegerRangeValidator();
        ((IntegerRangeValidator) validator).setMin(0);

        regularSnapshotsForm = buildForm("<div align='left' class='storageConfig'><div>"
            + MSG.view_adminTopology_storageNodes_clusterSettings_snapshotManagement() + "</div><div>"
            + MSG.view_adminTopology_storageNodes_clusterSettings_snapshotManagement_desc() + "</div>");
View Full Code Here

        port.setRequired(false);
        port.setWidth(textFieldWidth);
        port.setPrompt(MSG.view_remoteAgentInstall_promptPort());
        port.setHoverWidth(300);
        port.setEndRow(true);
        IntegerRangeValidator portValidator = new IntegerRangeValidator();
        portValidator.setMin(1);
        portValidator.setMax(65535);
        port.setValidators(new IsIntegerValidator(), portValidator);

        TextItem username = new TextItem("username", MSG.common_title_user());
        username.setRequired(false); // if not specified, the server will attempt to use the default ssh user defined in system settings
        username.setWidth(textFieldWidth);
View Full Code Here

TOP

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

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.