Search in sources :

Example 1 with IValidationResultBuilder

use of org.jowidgets.validation.IValidationResultBuilder in project jo-client-platform by jo-source.

the class BeansStateTrackerImpl method createValidationResult.

@Override
public IValidationResult createValidationResult() {
    final IValidationResultBuilder builder = ValidationResult.builder();
    for (final IBeanProxy<BEAN_TYPE> bean : new LinkedList<IBeanProxy<BEAN_TYPE>>(validationDirtyBeans)) {
        final IValidationResult validationResult = bean.validate();
        builder.addResult(validationResult);
        if (validationResult.isOk()) {
            validationDirtyBeans.remove(bean);
        } else if (!validationResult.isValid()) {
            break;
        }
    }
    return builder.build();
}
Also used : IValidationResultBuilder(org.jowidgets.validation.IValidationResultBuilder) IValidationResult(org.jowidgets.validation.IValidationResult) LinkedList(java.util.LinkedList)

Example 2 with IValidationResultBuilder

use of org.jowidgets.validation.IValidationResultBuilder in project jo-client-platform by jo-source.

the class AttributesBeanPropertyValidator method validatePropertyImpl.

private IValidationResult validatePropertyImpl(final IBeanProxy<BEAN_TYPE> bean, final String propertyName) {
    final IValidationResultBuilder builder = ValidationResult.builder();
    final IValidator<Object> validator = validators.get(propertyName);
    if (validator != null) {
        final IValidationResult validationResult = validator.validate(bean.getValue(propertyName));
        if (!validationResult.isValid()) {
            return validationResult;
        } else if (!validationResult.isOk()) {
            builder.addResult(validationResult);
        }
    }
    return builder.build();
}
Also used : IValidationResultBuilder(org.jowidgets.validation.IValidationResultBuilder) IValidationResult(org.jowidgets.validation.IValidationResult)

Example 3 with IValidationResultBuilder

use of org.jowidgets.validation.IValidationResultBuilder in project jo-client-platform by jo-source.

the class BeanRelationTreeModelImpl method createValidationResult.

@Override
public IValidationResult createValidationResult() {
    final IValidationResultBuilder builder = ValidationResult.builder();
    builder.addResult(root.validate());
    for (final Object relationModelObject : relationNodes.values()) {
        final IBeanRelationNodeModel<?, ?> relationModel = (IBeanRelationNodeModel<?, ?>) relationModelObject;
        builder.addResult(relationModel.validate());
    }
    for (final IDataModel dataModel : externalDataModels) {
        builder.addResult(dataModel.validate());
    }
    return builder.build();
}
Also used : IBeanRelationNodeModel(org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel) IValidationResultBuilder(org.jowidgets.validation.IValidationResultBuilder) IDataModel(org.jowidgets.cap.ui.api.model.IDataModel)

Example 4 with IValidationResultBuilder

use of org.jowidgets.validation.IValidationResultBuilder in project jo-client-platform by jo-source.

the class BeanProxyImpl method createValidationResult.

@Override
public IValidationResult createValidationResult() {
    checkDisposed();
    final IValidationResultBuilder builder = ValidationResult.builder();
    final IValidationResult independentResult = independentWorstResult.get();
    if (independentResult != null && !independentResult.isValid()) {
        return independentResult;
    }
    for (final IValidationResult validationResult : validationResults.values()) {
        if (!validationResult.isValid()) {
            return validationResult;
        } else {
            builder.addResult(validationResult);
        }
    }
    return builder.build();
}
Also used : IValidationResultBuilder(org.jowidgets.validation.IValidationResultBuilder) IValidationResult(org.jowidgets.validation.IValidationResult)

Aggregations

IValidationResultBuilder (org.jowidgets.validation.IValidationResultBuilder)4 IValidationResult (org.jowidgets.validation.IValidationResult)3 LinkedList (java.util.LinkedList)1 IDataModel (org.jowidgets.cap.ui.api.model.IDataModel)1 IBeanRelationNodeModel (org.jowidgets.cap.ui.api.tree.IBeanRelationNodeModel)1