Project

General

Profile

« Previous | Next » 

Revision 580d5157

Added by Andreas Kohlbecker about 5 years ago

ref #8050 validing related name nomenclatural reference to require the user to add missing references when reusing an exising name

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
39 39
import eu.etaxonomy.cdm.vaadin.component.TextFieldNFix;
40 40
import eu.etaxonomy.cdm.vaadin.component.common.FilterableAnnotationsField;
41 41
import eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField;
42
import eu.etaxonomy.cdm.vaadin.data.validator.NomenclaturalReferenceExistsValidator;
42 43
import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
43 44
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorAction;
44 45
import eu.etaxonomy.cdm.vaadin.event.TaxonNameEditorActionStrRep;
......
611 612
            nomReferenceCombobox.setDescription("Selection limited to nomenclatural reference and parts of it.");
612 613
        }
613 614
        if(isModeEnabled(TaxonNamePopupEditorMode.REQUIRE_NOMENCLATURALREFERENCE)) {
614
            if(combinationAuthorshipField.getValue() == null){
615
                nomReferenceCombobox.setRequired(true);
616
                nomReferenceCombobox.setImmediate(true);
617
            } else {
618
                combinationAuthorshipField.addValueChangeListener(e -> {
619
                    if(e.getProperty().getValue() == null){
620
                        nomReferenceCombobox.setRequired(true);
621
                        nomReferenceCombobox.setImmediate(true);
622
                    }
623
                });
624
            }
615
            nomReferenceCombobox.setRequired(true);
616
            nomReferenceCombobox.setImmediate(true);
617

  
618
            String userHint = "Please use the 'Edit' function to fix the problem in the related name.";
619
            validationField.getRelatedNameComboBox().getSelect().addValidator(new NomenclaturalReferenceExistsValidator(userHint));
620
            orthographicVariantField.getRelatedNameComboBox().getSelect().addValidator(new NomenclaturalReferenceExistsValidator(userHint));
621
            basionymsComboboxSelect.addFieldValidator(new NomenclaturalReferenceExistsValidator(userHint));
622
            replacedSynonymsComboboxSelect.addFieldValidator(new NomenclaturalReferenceExistsValidator(userHint));
625 623
        }
626 624
    }
627 625

  

Also available in: Unified diff