- added TaxonName to Determinations in DetailsView
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 22 Jan 2015 14:37:50 +0000 (14:37 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 22 Jan 2015 14:37:50 +0000 (14:37 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailElement.java

index f9405739c604f5070a98b931d22b4e0c32005a19..9d9c4ab5e0b1aaefcfd4b0f85a3c34dc51cba340 100644 (file)
@@ -14,6 +14,7 @@ import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -38,6 +39,7 @@ public class DeterminationEventDetailElement extends
        private TermComboElement<DefinedTerm> combo_determinationModifier;
        private CheckboxElement checkbox_preferredFlag;
        private EntitySelectionElement<TaxonBase> selection_taxonBase;
+       private EntitySelectionElement<TaxonNameBase> selectionTaxonNameBase;
 
        // private TODO a set of references
 
@@ -79,6 +81,7 @@ public class DeterminationEventDetailElement extends
                this.entity = entity;
                combo_determinationModifier.setSelection(entity.getModifier());
                selection_taxonBase.setEntity(entity.getTaxon());
+               selectionTaxonNameBase.setEntity(entity.getTaxonName());
                super.setEntity(entity);
        }
 
@@ -92,6 +95,10 @@ public class DeterminationEventDetailElement extends
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
+           selectionTaxonNameBase = formFactory
+                   .createSelectionElement(TaxonNameBase.class,
+                           getConversationHolder(), element, "Taxon Name", null,
+                           EntitySelectionElement.NOTHING, style);
                selection_taxonBase = formFactory
                                .createSelectionElement(TaxonBase.class,
                                                getConversationHolder(), element, "Taxon", null,
@@ -124,8 +131,13 @@ public class DeterminationEventDetailElement extends
                        getEntity().setModifier(combo_determinationModifier.getSelection());
                } else if (eventSource == checkbox_preferredFlag) {
                        getEntity().setPreferredFlag(checkbox_preferredFlag.getSelection());
+               } else if (eventSource == selectionTaxonNameBase) {
+                   getEntity().setTaxonName(selectionTaxonNameBase.getSelection());
                } else if (eventSource == selection_taxonBase) {
-                       getEntity().setTaxon(selection_taxonBase.getSelection());
+                       TaxonBase taxon = selection_taxonBase.getSelection();
+            getEntity().setTaxon(taxon);
+            getEntity().setTaxonName(taxon.getName());
+            selectionTaxonNameBase.setEntity(taxon.getName());
                }
                // else if(eventSource == TODO set of references){
                //