Example usage for com.vaadin.v7.ui AbstractField isEmpty

List of usage examples for com.vaadin.v7.ui AbstractField isEmpty

Introduction

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

Prototype

@Override
    public boolean isEmpty() 

Source Link

Usage

From source file:org.vaadin.viritin.v7.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   ww w .  ja  v  a  2s.co  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);
            }
        }
    }
}