fix for #5114
authorU-BGBM\k.luther <k.luther@BGBM11732.bgbm.fu-berlin.de>
Thu, 20 Aug 2015 08:37:27 +0000 (10:37 +0200)
committerk.luther <k.luther@bgbm.org>
Thu, 20 Aug 2015 10:55:21 +0000 (12:55 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java

index 9aff98e..d82f7fe 100644 (file)
@@ -51,8 +51,11 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
        private ITaxonTreeNode parentTreeNode;
 
        private EntitySelectionElement<Taxon> selection_reuseExistingTaxon;
+       private EntitySelectionElement<Reference> selection_SecRef;
 
        private Taxon taxon;
+       
+       private Reference secReference;
 
        private TextWithLabelElement textNewTaxonName;
 
@@ -92,6 +95,9 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                selection_parentTaxonNode = formFactory
                                .createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
                                                EntitySelectionElement.DELETABLE, style);
+               selection_SecRef = formFactory
+                               .createSelectionElement(Reference.class,getConversationHolder(), formElement, "Secundum Reference", null,
+                                               EntitySelectionElement.DELETABLE, style);
                selection_reuseExistingTaxon = formFactory
                                .createSelectionElement(Taxon.class,
                                                getConversationHolder(), formElement,
@@ -150,6 +156,8 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                        setClassification(selection_classification.getEntity());
                } else if (eventSource == selection_parentTaxonNode) {
                        setParentTreeNode(selection_parentTaxonNode.getEntity());
+               } else if (eventSource == selection_SecRef) {
+                       setSecReference(selection_SecRef.getEntity());
                } else if (eventSource == selection_reuseExistingTaxon) {
                        boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
                        selection_reuseExistingName.setEnabled(enabled);
@@ -236,6 +244,11 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                        this.parentTreeNode = selection_classification.getEntity();
                }
        }
+       
+       private void setSecReference(Reference secRef){
+               this.secReference = secRef;
+               setTaxon(textNewTaxonName.getText());
+       }
 
        private void setTaxon(Taxon taxon) {
                this.taxon = taxon;
@@ -252,7 +265,9 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
        private void setTaxon(TaxonNameBase taxonName) {
                Reference secundum = null;
                if (getParentTreeNode() != null) {
-                       if (getParentTreeNode() instanceof Classification) {
+                       if (this.secReference != null){
+                               secundum = this.secReference;
+                       } else if (getParentTreeNode() instanceof Classification) {
                                secundum = ((Classification) getParentTreeNode())
                                                .getReference();
                        } else if (getParentTreeNode() instanceof TaxonNode) {