Package org.gwtoolbox.widget.client.form.validation

Examples of org.gwtoolbox.widget.client.form.validation.ValidationResult


    public FormValidationResult validate() {
        DefaultFormValidationResult result = new DefaultFormValidationResult();
        for (Map.Entry<String, FormField> entry : formFields.fieldByKey.entrySet()) {
            FormField field = entry.getValue();
            if (field.isEnabled()) {
                ValidationResult fieldResult = entry.getValue().validate();
                result.merge(field.getKey(), fieldResult);
            }
        }
        if (formValidator != null) {
            ValidationResult generalValidationResult = formValidator.validate(this);
            if (!generalValidationResult.isValid()) {
                result.setGeneralValidationResult(generalValidationResult);
            }
        }
        return result;
    }
View Full Code Here


        public boolean isValid(String fieldKey) {
            if (generalValidationResult == null && validationResultByFieldKey == null) {
                return true;
            }
            ValidationResult result = validationResultByFieldKey == null ? null : validationResultByFieldKey.get(fieldKey);
            return result == null ? true : result.isValid();
        }
View Full Code Here

        public List<String> getErrorMessages(String fieldKey) {
            if (validationResultByFieldKey == null) {
                return null;
            }
            ValidationResult result = validationResultByFieldKey.get(fieldKey);
            return result == null ? null : result.getErrorMessages();
        }
View Full Code Here

        this.errorMessage = errorMessage;
    }

    public ValidationResult validate(String value) {
        if (value == null || value.matches(regexp)) {
            return new ValidationResult();
        }
        return new ValidationResult(errorMessage);
    }
View Full Code Here

        return this;
    }

    public ValidationResult validate() {
        clearValidationMarking();
        ValidationResult result = new ValidationResult();
        if (validators == null) {
            return result;
        }

        T value;
        try {
           value = editor.getValue();
        } catch (TextConversionException tce) {
            ValidationResult validationResult = new ValidationResult(tce.getMessage());
            markValid(validationResult);
            result.merge(validationResult);
            return result;
        }
       
        for (Validator<T> validator : validators) {
            ValidationResult validationResult = validator.validate(value);
            markValid(validationResult);
            result.merge(validationResult);
            if (!validationResult.isValid()) {
                break;
            }
        }
        return result;
    }
View Full Code Here

        this.errorMessage = errorMessage;
    }

    public ValidationResult validate(Integer value) {
        if (value == null || (value >= min && value <= max)) {
            return new ValidationResult();
        }
        return new ValidationResult(errorMessage);
    }
View Full Code Here

    public ValidationResult validate(String value) {
        if (value != null) {
            try {
                formatter.parseStrict(value);
            } catch (IllegalArgumentException e) {
                return new ValidationResult(ValidationMessages.Instance.get().datestring(format));
            }
        }
        return new ValidationResult();
    }
View Full Code Here

        this.errorMessage = errorMessage;
    }

    public ValidationResult validate(Integer value) {
        if (value == null || value >= min) {
            return new ValidationResult();
        }
        return new ValidationResult(errorMessage);
    }
View Full Code Here

*/
public class NotNullValidator implements Validator {

    public ValidationResult validate(Object value) {
        if (value == null) {
            return new ValidationResult(ValidationMessages.Instance.get().notNull());
        }
        return new ValidationResult();
    }
View Full Code Here

        this.errorMessage = errorMessage;
    }

    public ValidationResult validate(String value) {
        if (value == null || !"".equals(value)) {
            return new ValidationResult();
        }
        return new ValidationResult(errorMessage);
    }
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.form.validation.ValidationResult

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.