Examples of addValidator()


Examples of com.vaadin.data.validator.CompositeValidator.addValidator()

        // TODO CompositeValidator
        tf = new TextField(
                "A field, must be a floating point number with 4-5 chars");
        CompositeValidator cv = new CompositeValidator(CombinationMode.AND,
                "The field must contain a floating point number with 4-5 characters");
        cv.addValidator(new StringLengthValidator(
                "String length of '{0}' should be 4-5 characters", 4, 5, false));
        cv.addValidator(new DoubleValidator(
                "{0} must be a floating point number"));
        tf.addValidator(cv);
        tf.setValue("12.34");
View Full Code Here

Examples of com.vaadin.data.validator.CompositeValidator.addValidator()

                "A field, must be a floating point number with 4-5 chars");
        CompositeValidator cv = new CompositeValidator(CombinationMode.AND,
                "The field must contain a floating point number with 4-5 characters");
        cv.addValidator(new StringLengthValidator(
                "String length of '{0}' should be 4-5 characters", 4, 5, false));
        cv.addValidator(new DoubleValidator(
                "{0} must be a floating point number"));
        tf.addValidator(cv);
        tf.setValue("12.34");
        form.addField("j", tf);
View Full Code Here

Examples of com.vaadin.data.validator.CompositeValidator.addValidator()

        tf = new TextField(
                "A field, must be a floating point number or 4-5 chars");
        cv = new CompositeValidator(CombinationMode.OR,
                "The field must contain a floating point  or with 4-5 characters");
        cv.addValidator(new StringLengthValidator(
                "String length of '{0}' should be 4-5 characters", 4, 5, false));
        cv.addValidator(new DoubleValidator(
                "{0} must be a floating point number"));
        tf.addValidator(cv);
        tf.setValue("12.34g");
View Full Code Here

Examples of com.vaadin.data.validator.CompositeValidator.addValidator()

                "A field, must be a floating point number or 4-5 chars");
        cv = new CompositeValidator(CombinationMode.OR,
                "The field must contain a floating point  or with 4-5 characters");
        cv.addValidator(new StringLengthValidator(
                "String length of '{0}' should be 4-5 characters", 4, 5, false));
        cv.addValidator(new DoubleValidator(
                "{0} must be a floating point number"));
        tf.addValidator(cv);
        tf.setValue("12.34g");
        form.addField("jb", tf);
View Full Code Here

Examples of com.vaadin.ui.DateField.addValidator()

        DateField dateField1 = new DateField("Not required", dateProperty1);
        dateField1.setLocale(new Locale("fi", "FI"));
        dateField1.setResolution(DateField.RESOLUTION_DAY);
        dateField1.setId("_DF1");
        dateField1.setImmediate(true);
        dateField1.addValidator(dateValidator);
        addComponent(dateField1);

        // required
        Property<Date> dateProperty2 = new ObjectProperty<Date>(date);
        DateField dateField2 = new DateField("Required", dateProperty2);
View Full Code Here

Examples of com.vaadin.ui.DateField.addValidator()

        dateField2.setLocale(new Locale("fi", "FI"));
        dateField2.setResolution(DateField.RESOLUTION_DAY);
        dateField2.setId("_DF2");
        dateField2.setRequired(true);
        dateField2.setImmediate(true);
        dateField2.addValidator(dateValidator);
        addComponent(dateField2);
    }

    @Override
    protected String getDescription() {
View Full Code Here

Examples of com.vaadin.ui.DateField.addValidator()

            }
        });

        final DateField validated = new DateField("Validated Default DateField");
        validated.setImmediate(true);
        validated.addValidator(new NullValidator("Validator: Date is NULL",
                false));
        addComponent(validated);
    }

    @Override
View Full Code Here

Examples of com.vaadin.ui.Field.addValidator()

                    TextField tf = (TextField) f;
                    tf.setWidth("100%");
                }
                if (propertyId.equals("kilometers")) {
                    f.setWidth("4em");
                    f.addValidator(new Validator() {
                        @Override
                        public void validate(Object value)
                                throws InvalidValueException {
                            // FIXME this does not follow the standard pattern
                            // for validators and has side effects!
View Full Code Here

Examples of com.vaadin.ui.TextField.addValidator()

                if (!"".equals("" + value)) {
                    throw new InvalidValueException("Value is not empty string");
                }
            }
        });
        tx.addValidator(v2);

        final String[] visibleProps = { "required", "invalidAllowed",
                "readOnly", "readThrough", "invalidCommitted",
                "validationVisible" };
        for (int i = 0; i < visibleProps.length; i++) {
View Full Code Here

Examples of com.vaadin.ui.TextField.addValidator()

                w.showNotification("TextField is " + (tf.isValid() ? "" : "in")
                        + "valid, with error: " + tf.getErrorMessage(),
                        Notification.TYPE_WARNING_MESSAGE);
            }
        });
        tf.addValidator(new Validator() {

            @Override
            public void validate(Object value) throws InvalidValueException {
                if (value == null || value.toString().length() <= 3) {
                    throw new InvalidValueException(
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.