Project

General

Profile

« Previous | Next » 

Revision b0ed30f0

Added by Katja Luther about 5 years ago

ref #8136: add warning message when changing type away from lectotype and citation exist

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameTypeDesignationElement.java
16 16
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
17 17
import eu.etaxonomy.cdm.model.name.TaxonName;
18 18
import eu.etaxonomy.cdm.model.term.TermType;
19
import eu.etaxonomy.taxeditor.model.MessagingUtils;
19 20
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
20 21
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
21 22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
85 86
		} else if (eventSource == selection_typeName) {
86 87
			getEntity().setTypeName(selection_typeName.getEntity());
87 88
		} else if (eventSource == combo_typeStatus) {
89
		    if (getEntity().getTypeStatus().isLectotype() && !combo_typeStatus.getSelection().isLectotype() && entity.getCitation() != null){
90
                boolean ok = MessagingUtils.confirmDialog("Citation will be removed", "When changing the type from lectotype to a non lectotype the citation will be removed.Do you want to continue?");
91
                if (!ok){
92
                    combo_typeStatus.setSelection(entity.getTypeStatus());
93
                    return;
94
                }
95
            }
88 96
			getEntity().setTypeStatus(combo_typeStatus.getSelection());
97

  
89 98
			setEntity(entity);
90 99
		} else if (eventSource == checkbox_notDesignated) {
91 100
			getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
92 101
		}
93
//		else if (eventSource == selection_reference) {
94
//			getEntity().setCitation(selection_reference.getSelection());
95
//		} else if (eventSource == text_referenceDetail) {
96
//			getEntity().setCitationMicroReference(
97
//					text_referenceDetail.getText());
98
//		}
102
		else if (eventSource == selection_reference) {
103
			getEntity().setCitation(selection_reference.getSelection());
104
		} else if (eventSource == text_referenceDetail) {
105
			getEntity().setCitationMicroReference(
106
					text_referenceDetail.getText());
107
		}
99 108
	}
100 109
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.java
18 18
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
19 19
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
20 20
import eu.etaxonomy.cdm.model.term.TermType;
21
import eu.etaxonomy.taxeditor.model.MessagingUtils;
21 22
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
22 23
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
23 24
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
78 79
	public void handleEvent(Object eventSource) {
79 80
	    super.handleEvent(eventSource);
80 81
		if (eventSource == combo_typeStatus) {
82
		    if (getEntity().getTypeStatus().isLectotype() && !combo_typeStatus.getSelection().isLectotype() && entity.getCitation() != null){
83
		        boolean ok = MessagingUtils.confirmDialog("Citation will be removed", "When changing the type from lectotype to a non lectotype the citation will be removed.Do you want to continue?");
84
		        if (!ok){
85
		            combo_typeStatus.setSelection(entity.getTypeStatus());
86
		            return;
87
		        }
88
		    }
81 89
			getEntity().setTypeStatus(combo_typeStatus.getSelection());
82 90
			setEntity(entity);
91

  
83 92
		}
84 93
		// TODO remove this once specimens are correctly implemented
85 94
		else if (eventSource == text_specimenTypeText) {
......
96 105
		} else if (eventSource == checkbox_notDesignated) {
97 106
			getEntity().setNotDesignated(checkbox_notDesignated.getSelection());
98 107
		}
99
//		else if (eventSource == selection_reference) {
100
//			getEntity().setCitation(selection_reference.getSelection());
101
//		} else if (eventSource == text_referenceDetail) {
102
//			getEntity().setCitationMicroReference(
103
//					text_referenceDetail.getText());
104
//		}
108
		else if (eventSource == selection_reference) {
109
			getEntity().setCitation(selection_reference.getSelection());
110
		} else if (eventSource == text_referenceDetail) {
111
			getEntity().setCitationMicroReference(
112
					text_referenceDetail.getText());
113
		}
105 114
	}
106 115
}

Also available in: Unified diff