commit 12addc56e71b065b36ba5ca00f449243e3a44cda
Author: Katja Luther <k.luther@bgbm.org>
Date:   Wed Jun 16 13:07:44 2021 +0200

    ref #9337, #9287: show details of term and supplemental data of term node

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
index 74603f02b..c1ac6a94a 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
@@ -1788,7 +1788,7 @@ public class CdmFormFactory extends FormToolkit {
      * @return
      */
     public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
-            AbstractCdmDetailSection parentElement, int style) {
+            ICdmFormElement parentElement, int style) {
         AbstractCdmDetailElement element = null;
 
         if (NamedArea.class.isAssignableFrom(definedTermClass)) {
@@ -3136,6 +3136,10 @@ public class CdmFormFactory extends FormToolkit {
             element = new InapplicableIfCollectionElement(this, parentElement, (FeatureState) entity, removeListener, backgroundColor, style);
         } else if (entity instanceof FeatureState && parentElement instanceof OnlyApplicableIfEntityCollectionSection) {
             element = new OnlyApplicableIfCollectionElement(this, parentElement, (FeatureState) entity, removeListener, backgroundColor, style);
+        } else if (entity instanceof FeatureState && parentElement instanceof InapplicableIfEntityCollectionSectionForNode) {
+            element = new InapplicableIfCollectionElement(this, parentElement, (FeatureState) entity, removeListener, backgroundColor, style);
+        } else if (entity instanceof FeatureState && parentElement instanceof OnlyApplicableIfEntityCollectionSectionForNode) {
+            element = new OnlyApplicableIfCollectionElement(this, parentElement, (FeatureState) entity, removeListener, backgroundColor, style);
         }
 
         //check for parent section when entity is null
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermNodeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermNodeDetailElement.java
index e17f5d2b4..eca45b8a6 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermNodeDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermNodeDetailElement.java
@@ -18,9 +18,6 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
-import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
-import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 
 /**
@@ -33,13 +30,6 @@ public class TermNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto>
 
     private InapplicableIfEntityCollectionSection sectionInapplicableIf;
     private OnlyApplicableIfEntityCollectionSection sectionOnlyApplicableIf;
-    //Term details
-    private TextWithLabelElement textIdInVocabulary;
-    private TextWithLabelElement textSymbol;
-    private TextWithLabelElement textSymbol2;
-    private UriWithLabelElement uri_uri;
-    private RepresentationElement element_Representation;
-
 
 	public TermNodeDetailElement(CdmFormFactory formFactory,
 			ICdmFormElement formElement) {
@@ -48,6 +38,8 @@ public class TermNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto>
 
 	@Override
 	protected void createControls(ICdmFormElement formElement, TermNodeDto entity, int style) {
+
+
 	    sectionInapplicableIf = formFactory.createInapplicableIfEntityCollectionSection(getConversationHolder(),
                     formElement, StoreUtil.getSectionStyle(InapplicableIfEntityCollectionSection.class, getEntity().getClass().getCanonicalName()));
 	    sectionInapplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
@@ -57,10 +49,9 @@ public class TermNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto>
 	    sectionOnlyApplicableIf.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
 	    sectionOnlyApplicableIf.setEntity(getEntity());
 
-	    DefinedTermBase term = CdmStore.getService(ITermService.class).load(entity.getTerm().getUuid());
 
+	    DefinedTermBase term = CdmStore.getService(ITermService.class).load(getEntity().getTerm().getUuid());
 	    AbstractCdmDetailElement termDetailElement = formFactory.createDefinedTermDetailElement(term.getClass(), formElement, style);
-
 	    termDetailElement.setEntity(term);
 	    termDetailElement.setEnabled(false);
 
@@ -71,4 +62,6 @@ public class TermNodeDetailElement extends AbstractCdmDetailElement<TermNodeDto>
 	    EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid());
 	}
 
+
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermTreeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermTreeDetailElement.java
index 9b3da2db5..0e532f62c 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermTreeDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermTreeDetailElement.java
@@ -86,7 +86,7 @@ public class TermTreeDetailElement extends AbstractCdmDetailElement<TermTreeDto>
 	    else if (eventSource == isFlat) {
 	        getEntity().setFlat(isFlat.getSelection());
 	    }
-	    EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity().getUuid());
+	    EventUtility.postEvent(WorkbenchEventConstants.ADD_SAVE_CANDIDATE, getEntity());
 
 	}
 }
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
index b973f71e4..dc5de51e2 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
@@ -33,6 +33,7 @@ import org.springframework.security.core.GrantedAuthority;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.ITermNodeService;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.api.service.IVocabularyService;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
@@ -41,6 +42,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
 import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
@@ -174,10 +176,11 @@ public abstract class AbstractCdmEditorPartE4
         }
         if(delaySelection==null){
             delaySelection = new DelaySelection(selection, activePart, thisPart);
+        }else{
+            delaySelection.setSelection(selection);
+            delaySelection.setActivePart(activePart);
+            delaySelection.setThisPart(thisPart);
         }
-        delaySelection.setSelection(selection);
-        delaySelection.setActivePart(activePart);
-        delaySelection.setThisPart(thisPart);
         if(!isInDelay){
             isInDelay = true;
             sync.asyncExec(delaySelection);
@@ -272,6 +275,7 @@ public abstract class AbstractCdmEditorPartE4
                     element = CdmStore.getService(IVocabularyService.class).load(((TermVocabularyDto) element).getUuid());
                 }
 
+
                 selectionProvidingPart = activePart;
                 if (viewer instanceof DetailsViewerE4){
 
@@ -284,6 +288,9 @@ public abstract class AbstractCdmEditorPartE4
                 }
 
                 else{
+                    if(element instanceof TermNodeDto){
+                        element = CdmStore.getService(ITermNodeService.class).load(((TermNodeDto) element).getUuid());
+                    }
                     if (activePart.getObject() instanceof DetailsPartE4 && element instanceof TaxonName){
                         selectionProvidingPart = ((DetailsPartE4)activePart.getObject()).getSelectionProvidingPart();
                     }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
index 5b0229b18..cf8d57439 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
@@ -94,21 +94,14 @@ public class DetailsPartE4 extends AbstractCdmEditorPartE4 implements IPartConte
                     return;
                 }
             }
-//            if (partObject instanceof IDistributionEditor){
-//
-//                showViewer(structuredSelection, activePart, viewer);
-//                return;
-//
-//            }
+
             //FIXME this is a temporary workaround to fix selection handling for supplemental data view
             // Now the supp data view gets double selection from details view and name editor (see #7126)
+
             viewer.setSelection(structuredSelection, false);
 
             showViewer(structuredSelection, activePart, viewer);
-            if (viewer instanceof DetailsViewerE4){
 
-//                ((DetailsViewerE4)viewer).setDetailsEnabled(isEnabled());
-            }
 
 
             return;
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
index f20c32793..398a7cbd2 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
@@ -33,6 +33,7 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.cdm.persistence.dto.TermNodeDto;
 import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
 import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
 import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
@@ -132,7 +133,8 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
                 }
             }
 	        else if(structuredSelection.getFirstElement() instanceof TermDto
-	                || structuredSelection.getFirstElement() instanceof TermVocabularyDto){
+	                || structuredSelection.getFirstElement() instanceof TermVocabularyDto
+	                || structuredSelection.getFirstElement() instanceof TermNodeDto){
 	            showViewer(structuredSelection, activePart, viewer);
 	            return;
 	        }
