commit cd024235d3dffd63403474311c962249d3fa2274
Author: Katja Luther <k.luther@bgbm.org>
Date:   Tue Aug 25 10:53:53 2020 +0200

    ref #9199: adapt nomenclatural status to original source and layout issues

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 d10dbd84c..866011b2d 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
@@ -1855,8 +1855,8 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public SingleSourceSection createSingleSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, int style){
-        SingleSourceSection section = new SingleSourceSection(this, conversation, parentElement, cdmEntity, selectionProvider, style);
+    public SingleSourceSection createSingleSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, String label, int style){
+        SingleSourceSection section = new SingleSourceSection(this, conversation, parentElement, cdmEntity, selectionProvider, style, label);
         addAndAdaptSection(parentElement, section);
         return section;
     }
@@ -2205,8 +2205,8 @@ public class CdmFormFactory extends FormToolkit {
         addAndAdaptElement(parentElement, element);
         return element;
     }
-    public OriginalSourceElement createOriginalSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity){
-        OriginalSourceElement element = new OriginalSourceElement(this, parentElement, cdmEntity);
+    public OriginalSourceElement createOriginalSourceElement(ICdmFormElement parentElement, CdmBase cdmEntity, String label){
+        OriginalSourceElement element = new OriginalSourceElement(this, parentElement, cdmEntity, label);
         addAndAdaptElement(parentElement, element);
         return element;
     }
@@ -2852,9 +2852,6 @@ public class CdmFormFactory extends FormToolkit {
             if (parentElement instanceof DescriptionElementSourceSection){
                parent = ((DescriptionElementSourceSection)parentElement).getParent();
             }
-            if(parent != null){
-                Composite grandParent = parent.getParent();
-            }
             element = new DescriptionElementSourceElement(this, parentElement, (DescriptionElementSource) entity,
                     removeListener, style, false);
         } else if (entity instanceof DescriptionElementSource) {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LabelElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LabelElement.java
index 4e5183abb..9d9ca03e3 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LabelElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LabelElement.java
@@ -25,7 +25,7 @@ import eu.etaxonomy.cdm.common.CdmUtils;
  * @created Jun 1, 2010
  * @version 1.0
  */
-public class LabelElement extends AbstractCdmFormElement {
+public class LabelElement extends AbstractCdmFormElement implements ISelectable{
 
 	private Label label;
 
@@ -80,4 +80,13 @@ public class LabelElement extends AbstractCdmFormElement {
 	    Font boldFont = boldDescriptor.createFont(label.getDisplay());
 	    label.setFont( boldFont );
 	}
+
+
+    @Override
+    public void setSelected(boolean selected) {
+        this.label.setBackground(selected ? SELECTED : getPersistentBackground());
+
+    }
+
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
index 1ebdefd25..5b7e40e38 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
@@ -257,6 +257,7 @@ public class TaxonNodeDetailElement extends AbstractSingleSourceElement<TaxonNod
         }
  */
 	    super.createControls(formElement, entity, style);
+	    setSourceLabel(Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE);
 
 
 		selectionNodeAgentRelation = formFactory.createTaxonNodeAgentRelationCollectionSection(formElement, getConversationHolder(), StoreUtil.getSectionStyle(TaxonNodeAgentRelationCollectionSection.class, entity.getClass().getCanonicalName()));
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java
index 11c98e35e..764191d20 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java
@@ -22,7 +22,7 @@ import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LabelElement;
-import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSourcedEntityElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
@@ -37,7 +37,7 @@ public class NameRelationshipDetailElement extends AbstractSourcedEntityElement<
 	private RuleConsideredElement ruleConsidered;
 	private EntitySelectionElement<?> selection_toName;
 	private TermComboElement<NameRelationshipType> combo_relationshipType;
-	private LabelElement label;
+	private LabelElement labelElement;
 
 //	private OriginalSourceElement sourceElement;
 
@@ -53,24 +53,25 @@ public class NameRelationshipDetailElement extends AbstractSourcedEntityElement<
 	public NameRelationshipDetailElement(CdmFormFactory cdmFormFactory,
 	        AbstractFormSection formElement,
             NameRelationship entity, SelectionListener removeListener, int style){
-	    super(cdmFormFactory, formElement, entity, removeListener, style);
+	    super(cdmFormFactory, formElement, entity, removeListener, "Source", style);
+	    setSourceLabel("Source");
 	}
 
 	@Override
 	public void createControls(ICdmFormElement element, int style) {
 
 	    NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration();
-		label = formFactory.createLabel(element, null);
+		labelElement = formFactory.createLabel(element, null);
 
 		if (config == null || config.isNameRelationsRuleConsideredActivated()){
 		    ruleConsidered = formFactory.createRuleConsideredElement(
 		            element, "Rule Considered", config == null
 		            || config.isNameRelationsRuleConsideredCodeEditionActivated(), style);
 		}
+		LabelElement spacer = formFactory.createLabel(element, null);
+		spacer.getLayoutComposite().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+		addElement(spacer);
 		super.createControls(element, style);
-
-
-
 	}
 
 	@Override
@@ -78,10 +79,11 @@ public class NameRelationshipDetailElement extends AbstractSourcedEntityElement<
 		String text = (entity.getFromName() == null? "-":entity.getFromName().getTitleCache())
 		        + " is " + (entity.getType()==null?"(no type)":entity.getType().getLabel())
 		        + " " + (entity.getToName()==null?"-":entity.getToName().getTitleCache());
-		label.setText(text);
+		labelElement.setText(text);
 		if (ruleConsidered != null){
 		    ruleConsidered.setElement(entity);
 		}
+
 		super.setEntity(entity);
 	}
 
@@ -99,15 +101,11 @@ public class NameRelationshipDetailElement extends AbstractSourcedEntityElement<
 
 	@Override
 	public void setBackground(Color color) {
-		if(label != null) {
-            label.setBackground(color);
+		if(labelElement != null) {
+            labelElement.setBackground(color);
         }
 		super.setBackground(color);
 	}
 
-    @Override
-    public SelectionArbitrator getSelectionArbitrator() {
-        // TODO Auto-generated method stub
-        return null;
-    }
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java
index 511316a9e..4350da8ac 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java
@@ -24,6 +24,8 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
 import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
+import eu.etaxonomy.taxeditor.ui.element.LabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSourcedEntityElement;
 
@@ -43,7 +45,7 @@ public class NomenclaturalStatusElement extends AbstractSourcedEntityElement<Nom
 
 	public NomenclaturalStatusElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement,
 			NomenclaturalStatus element, SelectionListener removeListener, int style) {
-		super(cdmFormFactory, formElement, element, removeListener, style);
+		super(cdmFormFactory, formElement, element, removeListener, "Source", style);
 		selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
 	}
 
@@ -84,9 +86,13 @@ public class NomenclaturalStatusElement extends AbstractSourcedEntityElement<Nom
 		if (config == null || config.isNomenclaturalStatusRuleConsideredActivated()){
 		    ruleConsidered = formFactory.createRuleConsideredElement(this, "Rule Considered", config == null || config.isNomenclaturalStatusRuleConsideredCodeEditionActivated(), style);
 		}
-
+		setSourceLabel("Source");
+		LabelElement spacer = formFactory.createLabel(this, null);
+        spacer.getLayoutComposite().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        addElement(spacer);
 		super.createControls(element, style);
 
+
 	}
 
 	/** {@inheritDoc} */
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java
index 8ecab749b..18ddda86f 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java
@@ -31,6 +31,8 @@ public class NomenclaturalReferenceDetailElement extends
 	private EntitySelectionElement<Reference> selection_nomenclaturalReference;
 	private TextWithLabelElement text_referenceDetail;
 
+//    private OriginalSourceAdvancedSection advancedSection;
+
 	/**
 	 * <p>
 	 * Constructor for NomenclaturalReferenceDetailElement.
@@ -62,6 +64,11 @@ public class NomenclaturalReferenceDetailElement extends
 		text_referenceDetail = formFactory.createTextWithLabelElement(
 				formElement, "Ref. Detail",
 				entity.getNomenclaturalMicroReference(), style);
+
+//		advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
+//		advancedSection.setEntity(entity.getNomenclaturalSource());
+//		addControl(advancedSection);
+//	    addElement(advancedSection);
 	}
 
 	/** {@inheritDoc} */
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java
index abca038cf..7fcac7e11 100755
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java
@@ -15,9 +15,7 @@ import org.eclipse.ui.forms.widgets.TableWrapData;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
 import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
-import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -35,20 +33,21 @@ public class OriginalSourceElement extends AbstractCdmDetailElement<DescriptionE
     private EntitySelectionElement<Reference> selection_Ref;
     private TextWithLabelElement microReference;
     private OriginalSourceAdvancedSection advancedSection;
-
+    private String label = "Source";
     private CdmBase cdmEntity;
 
-    public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity) {
+    public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity, String label) {
         super(formFactory, formElement);
         this.cdmEntity = cdmEntity;
-//        selectionArbitrator = formFactory.createSelectionArbitrator(this);
+        this.label = label;
+
     }
 
     @Override
     protected void createControls(ICdmFormElement formElement, DescriptionElementSource entity,  int style) {
 
         selection_Ref = formFactory.createSelectionElement(Reference.class,
-                      formElement, Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE, null,
+                      formElement, label, null,
                       EntitySelectionElement.DELETABLE, style, 100);
 
         if (entity != null){
@@ -71,9 +70,11 @@ public class OriginalSourceElement extends AbstractCdmDetailElement<DescriptionE
         addElement(advancedSection);
         advancedSection.setBackground(this.getPersistentBackground());
         advancedSection.setEntity(entity);
-        advancedSection.setExpanded(false);
-        if (StringUtils.isNotBlank(((DescriptionElementSource)entity).getIdInSource()) || StringUtils.isNotBlank(((DescriptionElementSource)entity).getIdNamespace()) || StringUtils.isNotBlank(((DescriptionElementSource)entity).getOriginalNameString()) || (((DescriptionElementSource)entity).getLinks() != null && !((DescriptionElementSource)entity).getLinks().isEmpty())  || (((DescriptionElementSource)entity).getNameUsedInSource() != null)){
+
+        if (StringUtils.isNotBlank(entity.getIdInSource()) || StringUtils.isNotBlank(entity.getIdNamespace()) || StringUtils.isNotBlank(entity.getOriginalNameString()) || (entity.getLinks() != null && !entity.getLinks().isEmpty())  || (entity.getNameUsedInSource() != null)){
             advancedSection.setExpanded(true);
+        }else{
+            advancedSection.setExpanded(false);
         }
     }
 
@@ -90,4 +91,9 @@ public class OriginalSourceElement extends AbstractCdmDetailElement<DescriptionE
         this.cdmEntity = cdmEntity;
 
     }
+
+    public EntitySelectionElement<Reference> getReferenceSelectionElement(){
+        return selection_Ref;
+    }
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/SingleSourceSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/SingleSourceSection.java
index f4d6974ec..d7fb12cb2 100755
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/SingleSourceSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/SingleSourceSection.java
@@ -12,7 +12,6 @@ import org.eclipse.jface.viewers.ISelectionProvider;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.SingleSourcedEntityBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -27,11 +26,13 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 public class SingleSourceSection extends AbstractCdmDetailSection<DescriptionElementSource> {
 
     private CdmBase cdmEntity;
+    private String label;
 
     public SingleSourceSection(CdmFormFactory formFactory, ConversationHolder conversation,
-            ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, int style) {
+            ICdmFormElement parentElement, CdmBase cdmEntity, ISelectionProvider selectionProvider, int style, String label) {
         super(formFactory, conversation, parentElement, selectionProvider, style);
         this.cdmEntity = cdmEntity;
+        this.label = label;
         ((OriginalSourceElement)this.detailElement).setCdmEntity(cdmEntity);
     }
 
@@ -39,7 +40,7 @@ public class SingleSourceSection extends AbstractCdmDetailSection<DescriptionEle
     protected AbstractCdmDetailElement<DescriptionElementSource> createCdmDetailElement(
             AbstractCdmDetailSection<DescriptionElementSource> parentElement, int style) {
 
-        return new OriginalSourceElement(getFormFactory(), parentElement, cdmEntity);
+        return new OriginalSourceElement(getFormFactory(), parentElement, cdmEntity, label);
     }
 
     @Override
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSingleSourceElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSingleSourceElement.java
index ab8e42457..9c5a34fb5 100755
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSingleSourceElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSingleSourceElement.java
@@ -24,6 +24,7 @@ public abstract class AbstractSingleSourceElement <T extends SingleSourcedEntity
             extends AbstractCdmDetailElement<T> implements ISelectableElement{
 
     protected OriginalSourceElement singleSourceSection;
+    private String label;
 
     /**
      * @param formFactory
@@ -35,22 +36,23 @@ public abstract class AbstractSingleSourceElement <T extends SingleSourcedEntity
      */
     public AbstractSingleSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
         super(formFactory, formElement);
-//        setEntity(entity);
-//        super(formFactory,formElement, entity, removeListener, null, style);
-//        // TODO Auto-generated constructor stub
-    }
 
+    }
 
+    public String getLabel() {
+        return label;
+    }
 
-//    @Override
-//    public void setEntity(T entity) {
-//        this.entity = entity;
-//
-//    }
+    public void setSourceLabel(String label) {
+        if (singleSourceSection != null){
+            singleSourceSection.getReferenceSelectionElement().setLabel(label);
+        }
+        this.label = label;
+    }
 
     @Override
     public void createControls(ICdmFormElement formElement, T entity, int style) {
-        singleSourceSection = formFactory.createOriginalSourceElement(formElement, entity);
+        singleSourceSection = formFactory.createOriginalSourceElement(formElement, entity, label);
         if (entity.getSource() == null){
             DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
             entity.setSource(source);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSourcedEntityElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSourcedEntityElement.java
index 0fc1a470a..70bd6caa5 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSourcedEntityElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractSourcedEntityElement.java
@@ -30,6 +30,7 @@ public abstract class AbstractSourcedEntityElement<T extends SingleSourcedEntity
 
 	private SelectionArbitrator selectionArbitrator;
 	private OriginalSourceElement sourceElement;
+	private String label = "Source";
 //	protected EntitySelectionElement<Reference> selection_reference;
 //	protected TextWithLabelElement text_referenceDetail;
 
@@ -37,29 +38,28 @@ public abstract class AbstractSourcedEntityElement<T extends SingleSourcedEntity
 
 	public AbstractSourcedEntityElement(CdmFormFactory formFactory,
 			AbstractFormSection section, T entity,
-			SelectionListener removeListener, int style, boolean isCommonNameReference) {
+			SelectionListener removeListener, String label, int style, boolean isCommonNameReference) {
 		super(formFactory, section, entity, removeListener, null, style);
 		// make this element selectable
 		if(formFactory.getSelectionProvider() != null){
 			selectionArbitrator = formFactory.createSelectionArbitrator(this);
 		}
 		this.isCommonNameReference = isCommonNameReference;
+
+
 	}
 
     public AbstractSourcedEntityElement(CdmFormFactory formFactory,
             AbstractFormSection section, T entity,
-            SelectionListener removeListener, int style) {
-        super(formFactory, section, entity, removeListener, null, style);
-        // make this element selectable
-        if(formFactory.getSelectionProvider() != null){
-            selectionArbitrator = formFactory.createSelectionArbitrator(this);
-        }
+            SelectionListener removeListener, String label, int style) {
+        this(formFactory, section, entity, removeListener, label, style, false);
     }
 
-	@Override
+
+    @Override
 	public void createControls(ICdmFormElement formElement, int style) {
 
-	    sourceElement = formFactory.createOriginalSourceElement(formElement, entity);
+	    sourceElement = formFactory.createOriginalSourceElement(formElement, entity, label);
 
         if (entity.getSource() == null){
             DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
@@ -75,9 +75,6 @@ public abstract class AbstractSourcedEntityElement<T extends SingleSourcedEntity
 	@Override
 	public void setEntity(T entity) {
 		this.entity = entity;
-
-//		selection_reference.setEntity(entity.getCitation());
-//		text_referenceDetail.setText(entity.getCitationMicroReference());
 	}
 
 	@Override
@@ -85,4 +82,11 @@ public abstract class AbstractSourcedEntityElement<T extends SingleSourcedEntity
 		return selectionArbitrator;
 	}
 
+	public void setSourceLabel(String sourceLabel){
+	    this.label = sourceLabel;
+	    if (sourceElement != null){
+	        this.sourceElement.getReferenceSelectionElement().setLabel(sourceLabel);
+	    }
+	}
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java
index 4f132c671..accad8edb 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java
@@ -25,9 +25,10 @@ import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSingleSourceElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -35,7 +36,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  * @date Dec 1, 2011
  *
  */
-public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<TaxonRelationship> {
+public class TaxonRelationshipDetailElement extends AbstractSingleSourceElement<TaxonRelationship> {//TODO: use AbstractSingleSourcedElement
 
 	private TermComboElement<TaxonRelationshipTypeInverseContainer> combo_taxonRelationshipType;
 	private MisappliedRelationshipComboElement combo_misappliedRelationshipType;
@@ -43,18 +44,17 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
 	private EntitySelectionElement<Taxon> selection_relatedTaxon;
 	private CheckboxElement checkBoxDoubtful;
 	protected ToggleableTextElement toggleable_cache;
-	private  EntitySelectionElement<Reference> secReference;
+//	private  EntitySelectionElement<Reference> secReference;
 	private  EntitySelectionElement<Reference> sensuReference;
 	private TextWithLabelElement text_sensu_microreference;
 
 
-	private TextWithLabelElement text_secundum_microreference;
+//	private TextWithLabelElement text_secundum_microreference;
 
 	private TextWithLabelElement text_appendedPhrase;
 
     private CheckboxElement checkbox_published;
 
-
 	private Taxon taxon;
 
 	private TaxonDetailSection taxonElement;
@@ -65,11 +65,12 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
 
     public TaxonRelationshipDetailElement(CdmFormFactory formFactory,
 			ICdmFormElement formElement) {
+
 		super(formFactory, formElement);
 	}
 
 	@Override
-	protected void createControls(ICdmFormElement formElement,
+    public void createControls(ICdmFormElement formElement,
 			TaxonRelationship entity, int style) {
 	    if ((entity.getType().isMisappliedNameOrInvalidDesignation()) ){
 
@@ -119,6 +120,8 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
             }else{
                 label = "Err. Sec.";
             }
+
+            /*TODO: use super.createControls(); to create single source element
             secReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
                     formElement, label,
                     entity.getCitation(), EntitySelectionElement.ALL,
@@ -128,6 +131,10 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                     formElement, "Detail",
                     entity.getCitationMicroReference(),null,
                     SWT.WRAP);
+                    */
+            super.createControls(formElement, entity, style);
+            setSourceLabel(label);
+
             if (entity.getType().isAnyMisappliedName()) {
                 label = "Misapplication Doubtful";
             }else{
@@ -149,7 +156,9 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
 
             checkbox_published = formFactory.createCheckbox(this,
                     "Published", taxon.isPublish(), style);
-            secReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
+            /*
+             * secReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
+
                     formElement, "Syn. Sec.",
                     entity.getCitation(), EntitySelectionElement.ALL,
                     style);
@@ -158,6 +167,10 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                     formElement, "Detail",
                     entity.getCitationMicroReference(),null,
                     SWT.WRAP);
+                    */
+
+            super.createControls(formElement, entity, style);
+            setSourceLabel("Syn. Sec.");
             sensuReference = formFactory.createSelectionElement(Reference.class,//getConversationHolder(),
                     formElement, "Sec",
                    taxon.getSec(), EntitySelectionElement.ALL,
@@ -207,11 +220,13 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
 	@Override
 	public void handleEvent(Object eventSource) {
 		if (getEntity().getType().isMisappliedNameOrInvalidDesignation() || getEntity().getType().isAnySynonym()){
-			 if (eventSource == secReference) {
+			/* if (eventSource == secReference) {
 				getEntity().setCitation(secReference.getSelection());
 			} else if (eventSource == text_secundum_microreference) {
 				getEntity().setCitationMicroReference(text_secundum_microreference.getText());
-			}  else if (eventSource == text_sensu_microreference) {
+			}  else
+			   */
+			    if (eventSource == text_sensu_microreference) {
 		        taxon.setSecMicroReference(text_sensu_microreference.getText());
 			} else if (eventSource == sensuReference) {
 				taxon.setSec(sensuReference.getSelection());
@@ -272,6 +287,12 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
 
 	}
 
+    @Override
+    public SelectionArbitrator getSelectionArbitrator() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 
 
 }
