Project

General

Profile

« Previous | Next » 

Revision dee4cf65

Added by Andreas Kohlbecker over 5 years ago

ref #7867 attempting to avoid FieldGroup in TeamOrPersonField without having any idea why this can happen & better logging for further analyis

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/common/TeamOrPersonField.java
12 12
import java.util.EnumSet;
13 13
import java.util.List;
14 14

  
15
import org.apache.log4j.Logger;
15 16
import org.vaadin.viritin.fields.LazyComboBox;
16 17

  
17 18
import com.vaadin.data.Validator.InvalidValueException;
......
56 57

  
57 58
    private static final long serialVersionUID = 660806402243118112L;
58 59

  
60
    private static final Logger logger = Logger.getLogger(TeamOrPersonField.class);
61

  
59 62
    private static final String PRIMARY_STYLE = "v-team-or-person-field";
60 63

  
61 64
    private CssLayout root = new CssLayout();
......
207 210
                personsListEditor.registerParentFieldGroup(fieldGroup);
208 211

  
209 212
            } else {
210
                setComponentError(new UserError("TeamOrPersonField Error: Unsupported value type: " + newValue.getClass().getName()));
213
                UserError usererror = new UserError("TeamOrPersonField Error: Unsupported value type: " + newValue.getClass().getName());
214
                setComponentError(usererror);
215
                logger.error(usererror.getMessage());
211 216
            }
212 217
        } else {
213 218
            if(oldValue != null){
214 219
                // value is null --> clean up all nested fields
215 220
                // allow replacing old content in the editor by null
216 221
                setReadOnlyComponents(false);
217
                if(oldValue instanceof Person){
222
                if(Person.class.isAssignableFrom(oldValue.getClass())){
218 223
                    personField.unregisterParentFieldGroup(fieldGroup);
219 224
                    personField.setReadOnly(false);
220 225
                    personField.setValue((Person) null);
221
                } else {
226
                } else if(Team.class.isAssignableFrom(oldValue.getClass())){
222 227
                    titleField.unbindFrom(fieldGroup);
223 228
                    nomenclaturalTitleField.unbindFrom(fieldGroup);
224 229
                    fieldGroup.unbind(personsListEditor);
......
227 232
                    personsListEditor.setReadOnly(false);
228 233
                    personsListEditor.setValue(null);
229 234
                    personsListEditor.registerParentFieldGroup(null);
235
                } else {
236
                    UserError usererror = new UserError("TeamOrPersonField Error: Unsupported value type in oldValue: " + oldValue.getClass().getName());
237
                    setComponentError(usererror);
238
                    logger.error(usererror.getMessage());
230 239
                }
231 240
            }
232 241
        }

Also available in: Unified diff