Project

General

Profile

« Previous | Next » 

Revision 592b9851

Added by Andreas Kohlbecker about 5 years ago

ref #8107 getFieldGroup() returns Optional to avoid NPEs and logging errors before rethrowing as PopupEditorException

View differences:

src/main/java/eu/etaxonomy/vaadin/component/NameRelationField.java
8 8
*/
9 9
package eu.etaxonomy.vaadin.component;
10 10

  
11
import java.util.Optional;
12

  
11 13
import com.vaadin.data.fieldgroup.BeanFieldGroup;
12 14
import com.vaadin.data.fieldgroup.FieldGroup;
13 15
import com.vaadin.ui.Button;
......
99 101
     * {@inheritDoc}
100 102
     */
101 103
    @Override
102
    public FieldGroup getFieldGroup() {
103
        return fieldGroup;
104
    public Optional<FieldGroup> getFieldGroup() {
105
        return Optional.of(fieldGroup);
104 106
    }
105 107

  
106 108
    /**
......
176 178
        newValue = HibernateProxyHelper.deproxy(newValue);
177 179
        if(newValue != null) {
178 180
            compositeWrapper.addComponent(grid);
179
            getFieldGroup().bind(relatedNameComboBox, "otherName");
180
            getFieldGroup().bind(citationMicroReferenceField, "citationMicroReference");
181
            getFieldGroup().bind(citatonComboBox, "citation");
182
            getFieldGroup().bind(ruleConsideredField, "ruleConsidered");
181
            fieldGroup.bind(relatedNameComboBox, "otherName");
182
            fieldGroup.bind(citationMicroReferenceField, "citationMicroReference");
183
            fieldGroup.bind(citatonComboBox, "citation");
184
            fieldGroup.bind(ruleConsideredField, "ruleConsidered");
183 185

  
184 186
            fieldGroup.setItemDataSource(newValue);
185 187
        } else {
186 188
            if(oldValue != null){
187 189
                compositeWrapper.removeComponent(grid);
188
                getFieldGroup().unbind(relatedNameComboBox);
189
                getFieldGroup().unbind(citationMicroReferenceField);
190
                getFieldGroup().unbind(citatonComboBox);
191
                getFieldGroup().unbind(ruleConsideredField);
190
                fieldGroup.unbind(relatedNameComboBox);
191
                fieldGroup.unbind(citationMicroReferenceField);
192
                fieldGroup.unbind(citatonComboBox);
193
                fieldGroup.unbind(ruleConsideredField);
192 194

  
193 195
                fieldGroup.setItemDataSource(newValue);
194 196
            }

Also available in: Unified diff