Project

General

Profile

« Previous | Next » 

Revision c43b6a2e

Added by Andreas Kohlbecker almost 6 years ago

fix #7498 selective handling of ToOneRelatedEntityCombobox when casting to ReloadableLazyComboBox

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
21 21

  
22 22
import com.vaadin.data.Property;
23 23
import com.vaadin.spring.annotation.SpringComponent;
24
import com.vaadin.ui.Field;
24 25

  
25 26
import eu.etaxonomy.cdm.api.service.INameService;
26 27
import eu.etaxonomy.cdm.model.agent.AgentBase;
27 28
import eu.etaxonomy.cdm.model.agent.Person;
28 29
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
30
import eu.etaxonomy.cdm.model.common.CdmBase;
29 31
import eu.etaxonomy.cdm.model.common.TermType;
30 32
import eu.etaxonomy.cdm.model.name.Rank;
31 33
import eu.etaxonomy.cdm.model.name.TaxonName;
......
50 52
import eu.etaxonomy.cdm.vaadin.util.CdmTitleCacheCaptionGenerator;
51 53
import eu.etaxonomy.cdm.vaadin.view.reference.ReferencePopupEditor;
52 54
import eu.etaxonomy.vaadin.component.ReloadableLazyComboBox;
55
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox;
53 56
import eu.etaxonomy.vaadin.event.FieldReplaceEvent;
54 57
import eu.etaxonomy.vaadin.mvp.AbstractCdmDTOEditorPresenter;
55 58
import eu.etaxonomy.vaadin.mvp.AbstractPopupEditor;
......
379 382
                    }
380 383
                }
381 384
                if(boundTargetField.matchesPropertyIdPath("validationFor.otherName")){
382
                    ReloadableLazyComboBox<TaxonName> otherNameField = (ReloadableLazyComboBox<TaxonName>)boundTargetField.getField(TaxonName.class);
385
                    ReloadableLazyComboBox<TaxonName> otherNameField = asReloadableLazyComboBox(boundTargetField.getField(TaxonName.class));
383 386
                    if(event.isCreateOrModifiedType()){
384 387
                        getCache().load(event.getEntity());
385 388
                        if(event.isCreatedType()){
......
393 396
                    }
394 397
                } else
395 398
                if(boundTargetField.matchesPropertyIdPath("basionyms")){
396
                    ReloadableLazyComboBox<TaxonName> basionymSourceField = (ReloadableLazyComboBox<TaxonName>)boundTargetField.getField(TaxonName.class);
399
                    ReloadableLazyComboBox<TaxonName> basionymSourceField = asReloadableLazyComboBox(boundTargetField.getField(TaxonName.class));
397 400
                    if(event.isCreateOrModifiedType()){
398 401
                        getCache().load(event.getEntity());
399 402
                        if(event.isCreatedType()){
......
411 414
                    }
412 415
                } else
413 416
                if(boundTargetField.matchesPropertyIdPath("replacedSynonyms")){
414
                    ReloadableLazyComboBox<TaxonName> replacedSynonyms = (ReloadableLazyComboBox<TaxonName>)boundTargetField.getField(TaxonName.class);
417
                    ReloadableLazyComboBox<TaxonName> replacedSynonyms = asReloadableLazyComboBox(boundTargetField.getField(TaxonName.class));
415 418
                    if(event.isCreateOrModifiedType()){
416 419
                        getCache().load(event.getEntity());
417 420
                        if(event.isCreatedType()){
......
432 435
        }
433 436
    }
434 437

  
438
    protected <CDM extends CdmBase> ReloadableLazyComboBox<CDM> asReloadableLazyComboBox(Field<CDM> field){
439

  
440
        if(field instanceof ToOneRelatedEntityCombobox){
441
            field = ((ToOneRelatedEntityCombobox<CDM>)field).getSelect();
442
        }
443
        return (ReloadableLazyComboBox<CDM>)field;
444
    }
445

  
435 446

  
436 447

  
437 448
    @EventBusListenerMethod(filter = EditorActionTypeFilter.Edit.class)

Also available in: Unified diff