Example usage for com.vaadin.ui AbstractField getErrorMessage

List of usage examples for com.vaadin.ui AbstractField getErrorMessage

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractField getErrorMessage.

Prototype

public ErrorMessage getErrorMessage() 

Source Link

Document

Gets the error message for this component.

Usage

From source file:info.magnolia.ui.form.field.AbstractCustomMultiField.java

License:Open Source License

/**
 * Get the error message./*from  www  . j a va2  s .com*/
 */
@Override
public ErrorMessage getErrorMessage() {
    ErrorMessage errorMessage = null;
    List<AbstractField<T>> fields = getFields(this, false);
    for (AbstractField<T> field : fields) {
        errorMessage = field.getErrorMessage();
        if (errorMessage != null) {
            return errorMessage;
        }
    }
    return errorMessage;
}

From source file:org.vaadin.viritin.MBeanFieldGroup.java

License:Apache License

/**
 * This method hides validation errors on a required fields until the field
 * has been changed for the first time. Does pretty much the same as old
 * Vaadin Form did with its validationVisibleOnCommit, but eagerly per
 * field./*from  w  w  w  . ja  v  a  2 s  .c  o m*/
 * <p>
 * Fields that hide validation errors this way are available in
 * getFieldsWithIntiallyDisabledValidation() so they can be emphasized in
 * UI.
 */
public void hideInitialEmpyFieldValidationErrors() {
    fieldsWithInitiallyDisabledValidation.clear();
    for (Field f : getFields()) {
        if (f instanceof AbstractField) {
            final AbstractField abstractField = (AbstractField) f;
            if (abstractField.getErrorMessage() != null && abstractField.isRequired() && abstractField.isEmpty()
                    && abstractField.isValidationVisible()) {
                final String propertyId = getPropertyId(abstractField).toString();
                abstractField.setValidationVisible(false);
                fieldsWithInitiallyDisabledValidation.add(propertyId);
            }
        }
    }
}