Search in sources :

Example 1 with InstanceUtils

use of com.haulmont.chile.core.model.utils.InstanceUtils in project cuba by cuba-platform.

the class WebLookupPickerField method createComponent.

@Override
protected void createComponent() {
    super.createComponent();
    // delegate error indication
    this.componentErrorHandler = message -> {
        if (message instanceof UserError) {
            return false;
        }
        pickerField.component.setComponentError(message);
        return true;
    };
    component.setCustomValueEquals(InstanceUtils::propertyValueEquals);
    final ComboBox selectComponent = component;
    final WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {

        @Override
        public void setRequired(boolean required) {
            super.setRequired(required);
            selectComponent.setNullSelectionAllowed(!required);
        }
    };
    pickerField = new WebPickerField(picker);
    // Required for custom components in fieldgroup
    initValueSync(selectComponent, picker);
}
Also used : UserError(com.vaadin.server.UserError) ComboBox(com.vaadin.ui.ComboBox) InstanceUtils(com.haulmont.chile.core.model.utils.InstanceUtils)

Aggregations

InstanceUtils (com.haulmont.chile.core.model.utils.InstanceUtils)1 UserError (com.vaadin.server.UserError)1 ComboBox (com.vaadin.ui.ComboBox)1