- created specimen general element
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / CdmFormFactory.java
index 2bcf6b521df44e9cb322a8d783d1981329055052..741d99e2139e81917734c4cb0196f0e6f1a037dc 100644 (file)
@@ -95,6 +95,18 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.ui.campanula.basicFields.NamedAreaFieldController;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationSection;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventDetailsElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralElement;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralElementController;
+import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenSection;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
@@ -103,7 +115,6 @@ import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
 import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailSection;
@@ -118,8 +129,8 @@ import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailElem
 import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.classification.TaxonNodeDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.common.ReferenceEntityDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.common.RefereneEntityDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailElement;
@@ -131,6 +142,7 @@ import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceEle
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceElement;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
+import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
 import eu.etaxonomy.taxeditor.ui.section.description.ModifierElement;
 import eu.etaxonomy.taxeditor.ui.section.description.ModifierSection;
 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageDetailElement;
@@ -268,7 +280,7 @@ public class CdmFormFactory extends FormToolkit {
     private MouseListener selectionMouseHandler;
     private FocusListener selectionFocusHandler;
 
-    private final Set selectionListenerList = new HashSet();
+    private final Set<SelectionListener> selectionListenerList = new HashSet<SelectionListener>();
 
     private final List<IPropertyChangeListener> propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
 
@@ -314,8 +326,8 @@ public class CdmFormFactory extends FormToolkit {
         event.widget = e.widget;
         SelectionEvent selectionEvent = new SelectionEvent(event);
 
-        for (Object listener : selectionListenerList) {
-            ((SelectionListener) listener).widgetSelected(selectionEvent);
+        for (SelectionListener listener : selectionListenerList) {
+            listener.widgetSelected(selectionEvent);
         }
     }
 
@@ -397,13 +409,6 @@ public class CdmFormFactory extends FormToolkit {
         }
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public void adapt(Composite composite) {
-        composite.addMouseListener(selectionMouseHandler);
-        super.adapt(composite);
-    }
-
     /**
      * <p>
      * Adapts the {@link AbstractCdmFormElement}:<br>
@@ -428,6 +433,13 @@ public class CdmFormFactory extends FormToolkit {
         super.adapt(control, trackFocus, trackKeyboard);
     }
 
+    /** {@inheritDoc} */
+    @Override
+    public void adapt(Composite composite) {
+        composite.addMouseListener(selectionMouseHandler);
+        super.adapt(composite);
+    }
+
     /**
      * <p>
      * destroyElement
@@ -1164,6 +1176,13 @@ public class CdmFormFactory extends FormToolkit {
         propertyChangeListeners.remove(listener);
     }
 
+    /**
+     * @return the propertyChangeListeners
+     */
+    public List<IPropertyChangeListener> getPropertyChangeListeners() {
+        return propertyChangeListeners;
+    }
+
     /**
      * <p>
      * createHorizontalSeparator
@@ -1313,56 +1332,6 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    // SIMPLIFY
-
-    /**
-     * Used to define which {@link AbstractCdmDetailSection} or
-     * {@link AbstractCdmDetailElement} should be created with
-     * {@link CdmFormFactory#createCdmDetailSection(DetailType, ConversationHolder, ICdmFormElement, ISelectionProvider, int)}
-     * or
-     * {@link CdmFormFactory#createCdmDetailElement(DetailType, ICdmFormElement, int)}
-     */
-    public static enum DetailType {
-        AUTHORSHIP,
-        CLASSIFICATION,
-        COLLECTION,
-        DERIVED_UNIT,
-        DERIVED_UNIT_FACADE,
-        DERIVED_UNIT_GENERAL,
-        DESCRIPTION,
-        DESCRIPTIONELEMENT,
-        DETERMINATION,
-        FEATURE_DISTRIBUTION,
-        FIELD_OBSERVATION,
-        GATHERING_EVENT,
-        GRANTEDAUTHORITY,
-        GROUP,
-        HYBRID,
-        INSTITUTION,
-        MEDIA,
-        NAMED_AREA,
-        NAMED_AREA_LEVEL,
-        NAMERELATIONSHIP,//never used
-        NATURAL_LANGUAGE,
-        NOMENCLATURALREFERENCE,
-        NONVIRALNAME,
-        PARSINGMESSAGE,
-        PERSON,
-        POLYTOMOUS_KEY,
-        POLYTOMOUS_KEY_NODE,
-        REFERENCEBASE,
-        REFERENCED_ENTITY,
-        SCIENTIFICNAME,
-        TAXON_NODE,
-        TAXON_RELATIONSHIP,
-        TAXONBASE,
-        TEAM,
-        TEAMORPERSONBASE,
-        TERM_VOCABULARY,
-        USE_RECORD,
-        USER
-    }
-
     public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass, ConversationHolder conversation,
             ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
 
@@ -1381,8 +1350,7 @@ public class CdmFormFactory extends FormToolkit {
      * @param style
      * @return
      */
-    public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass,
-            AbstractCdmDetailSection parentElement, int style) {
+    public AbstractCdmDetailElement createDefinedTermDetailElement(Class definedTermClass, AbstractCdmDetailSection parentElement, int style) {
         AbstractCdmDetailElement element = null;
 
         if (NamedArea.class.isAssignableFrom(definedTermClass)) {
@@ -1396,487 +1364,632 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public GeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        GeneralDetailSection generalSection = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-        parentElement.addElement(generalSection);
-        adapt(generalSection);
-        return generalSection;
+
+    //--------DetailSections---------
+    public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
     }
 
-    public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        GatheringEventDetailSection gatheringSection = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
-        parentElement.addElement(gatheringSection);
-        adapt(gatheringSection);
-        return gatheringSection;
+    public ReferenceDetailSection createReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        ReferenceDetailSection section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
     }
 
-    public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        FieldObservationDetailSection foDetailsSection = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
-        parentElement.addElement(foDetailsSection);
-        adapt(foDetailsSection);
-        return foDetailsSection;
+    public NomenclaturalReferenceDetailSection createNomenclaturalReferenceDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        NomenclaturalReferenceDetailSection section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
     }
 
-    /**
-     * <p>
-     * createCdmDetailSection
-     * </p>
-     *
-     * @param detailType
-     *            a
-     *            {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
-     *            object.
-     * @param parentElement
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-     *            object.
-     * @param selectionProvider
-     *            a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
-     * @param style
-     *            a int.
-     * @param conversation
-     *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
-     *            object.
-     * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-     *         object.
-     */
-    public AbstractFormSection createCdmDetailSection(DetailType detailType, ConversationHolder conversation,
-            ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
-        AbstractFormSection section = null;
-
-//        System.out.println("DetailSection: " + detailType);
-        switch (detailType) {
-        case SCIENTIFICNAME:
-            section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case REFERENCEBASE:
-            section = new ReferenceDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case NOMENCLATURALREFERENCE:
-            section = new NomenclaturalReferenceDetailSection(this, conversation, parentElement, selectionProvider,
-                    style);
-            break;
-        case TAXONBASE:
-            section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case AUTHORSHIP:
-            section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case TEAMORPERSONBASE:
-            section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case TEAM:
-            section = new TeamDetailSection(this, conversation, parentElement, null, style);
-            break;
-        case PERSON:
-            section = new PersonDetailSection(this, conversation, parentElement, null, style);
-            break;
-        case DESCRIPTION:
-            section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case DESCRIPTIONELEMENT:
-            section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case PARSINGMESSAGE:
-            section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case NONVIRALNAME:
-            section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case MEDIA:
-            section = new eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection(this, conversation,
-                    parentElement, selectionProvider, style);
-            break;
-        case DERIVED_UNIT_FACADE:
-            section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case FIELD_OBSERVATION:
-            section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case GATHERING_EVENT:
-            section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case DERIVED_UNIT:
-            section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case NATURAL_LANGUAGE:
-            section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case FEATURE_DISTRIBUTION:
-            section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case CLASSIFICATION:
-            section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case TAXON_NODE:
-            section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case POLYTOMOUS_KEY:
-            section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case POLYTOMOUS_KEY_NODE:
-            section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case INSTITUTION:
-            section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case DERIVED_UNIT_GENERAL:
-            section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case HYBRID:
-            section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case USER:
-            section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case GROUP:
-            section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case DETERMINATION:
-            section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case TAXON_RELATIONSHIP:
-            section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case REFERENCED_ENTITY:
-            section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case TERM_VOCABULARY:
-            section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case NAMED_AREA:
-            section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        case USE_RECORD:
-            section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
-            break;
-        }
+    public TaxonBaseDetailSection createTaxonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        TaxonBaseDetailSection section = new TaxonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
 
-        if (section == null) {
-            throw new RuntimeException("You tried to create a cdm detail section that is not implemented yet.");
-        }
+    public AuthorshipDetailSection createAuthorshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        AuthorshipDetailSection section = new AuthorshipDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TeamOrPersonBaseDetailSection createTeamOrPersonBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        TeamOrPersonBaseDetailSection section = new TeamOrPersonBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TeamDetailSection createTeamDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        TeamDetailSection section = new TeamDetailSection(this, conversation, parentElement, null, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public PersonDetailSection createPersonDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        PersonDetailSection section = new PersonDetailSection(this, conversation, parentElement, null, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DescriptionDetailSection createDescriptionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DescriptionDetailSection section = new DescriptionDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DescriptionElementDetailSection createDescriptionElementDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DescriptionElementDetailSection section = new DescriptionElementDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ParsingMessagesSection createParsingMessagesSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        ParsingMessagesSection section = new ParsingMessagesSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public MediaDetailsSection createMediaDetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        MediaDetailsSection section = new MediaDetailsSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DerivedUnitFacadeDetailSection createDerivedUnitFacadeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DerivedUnitFacadeDetailSection section = new DerivedUnitFacadeDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public FieldObservationDetailSection createFieldObservationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public GatheringEventDetailSection createGatheringEventDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DerivedUnitBaseDetailSection createDerivedUnitBaseDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DerivedUnitBaseDetailSection section = new DerivedUnitBaseDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public NaturalLanguageSection createNaturalLanguageSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        NaturalLanguageSection section = new NaturalLanguageSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public FeatureDistributionDetailSection createFeatureDistributionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        FeatureDistributionDetailSection section = new FeatureDistributionDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ClassificationDetailSection createClassificationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        ClassificationDetailSection section = new ClassificationDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TaxonNodeDetailSection createTaxonNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        TaxonNodeDetailSection section = new TaxonNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public PolytomousKeyDetailSection createPolytomousKeyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        PolytomousKeyDetailSection section = new PolytomousKeyDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public PolytomousKeyNodeDetailSection createPolytomousKeyNodeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        PolytomousKeyNodeDetailSection section = new PolytomousKeyNodeDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public InstitutionDetailSection createInstitutionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        InstitutionDetailSection section = new InstitutionDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public GeneralDetailSection createGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
 
+    public HybridDetailSection createHybridDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        HybridDetailSection section = new HybridDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public UserDetailSection createUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        UserDetailSection section = new UserDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public GroupDetailSection createGroupDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        GroupDetailSection section = new GroupDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DeterminationDetailSection createDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DeterminationDetailSection section = new DeterminationDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TaxonRelationshipDetailSection createTaxonRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        TaxonRelationshipDetailSection section = new TaxonRelationshipDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ReferencedEntityDetailSection createReferencedEntityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        ReferencedEntityDetailSection section = new ReferencedEntityDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TermVocabularyDetailSection createTermVocabularyDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        TermVocabularyDetailSection section = new TermVocabularyDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+
+    public NamedAreaDetailSection createNamedAreaDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        NamedAreaDetailSection section = new NamedAreaDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public UseRecordDetailSection createUseRecordDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        UseRecordDetailSection section = new UseRecordDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
         parentElement.addElement(section);
         adapt(section);
-        return section;
     }
 
-    /**
-     * <p>
-     * createCdmDetailElement
-     * </p>
-     *
-     * @param detailType
-     *            a
-     *            {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType}
-     *            object.
-     * @param style
-     *            a int.
-     * @param parentElement
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-     *            object.
-     * @return a
-     *         {@link eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement}
-     *         object.
-     */
-    public AbstractCdmDetailElement createCdmDetailElement(DetailType detailType, ICdmFormElement parentElement, int style) {
-        AbstractCdmDetailElement element = null;
+    //--------DetailElements------------
 
-        switch (detailType) {
-        case SCIENTIFICNAME:
-            element = new NameDetailElement(this, parentElement, style);
-            break;
-        case REFERENCEBASE:
-            element = new ReferenceDetailElement(this, parentElement, style);
-            break;
-        case NOMENCLATURALREFERENCE:
-            element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
-            break;
-        case TAXONBASE:
-            element = new TaxonBaseDetailElement(this, parentElement, style);
-            break;
-        case AUTHORSHIP:
-            element = new AuthorshipDetailElement(this, parentElement, style);
-            break;
-        case TEAM:
-            element = new TeamDetailElement(this, parentElement, style);
-            break;
-        case PERSON:
-            element = new PersonDetailElement(this, parentElement, style);
-            break;
-        case DESCRIPTION:
-            element = new DescriptionDetailElement(this, parentElement, style);
-            break;
-        case DESCRIPTIONELEMENT:
-            element = new DescriptionElementDetailElement(this, parentElement, style);
-            break;
-        case NONVIRALNAME:
-            element = new NonViralNameDetailElement(this, parentElement);
-            break;
-        case DERIVED_UNIT_FACADE:
-            element = new DerivedUnitFacadeDetailElement(this, parentElement);
-            break;
-        case FIELD_OBSERVATION:
-            element = new FieldObservationDetailElement(this, parentElement);
-            break;
-        case GATHERING_EVENT:
-            element = new GatheringEventDetailElement(this, parentElement);
-            break;
-        case DERIVED_UNIT:
-            element = new DerivedUnitBaseDetailElement(this, parentElement);
-            break;
-        case NATURAL_LANGUAGE:
-            element = new NaturalLanguageDetailElement(this, parentElement);
-            break;
-        case FEATURE_DISTRIBUTION:
-            element = new FeatureDistributionDetailElement(this, parentElement);
-            break;
-        case CLASSIFICATION:
-            element = new ClassificationDetailElement(this, parentElement);
-            break;
-        case TAXON_NODE:
-            element = new TaxonNodeDetailElement(this, parentElement);
-            break;
-        case COLLECTION:
-            element = new CollectionDetailElement(this, parentElement);
-            break;
-        case POLYTOMOUS_KEY:
-            element = new PolytomousKeyDetailElement(this, parentElement);
-            break;
-        case POLYTOMOUS_KEY_NODE:
-            element = new PolytomousKeyNodeDetailElement(this, parentElement);
-            break;
-        case INSTITUTION:
-            element = new InstitutionDetailElement(this, parentElement);
-            break;
-        case DERIVED_UNIT_GENERAL:
-            element = new GeneralDetailElement(this, parentElement);
-            break;
-        case HYBRID:
-            element = new HybridDetailElement(this, parentElement);
-            break;
-        case USER:
-            element = new UserDetailElement(this, parentElement);
-            break;
-        case GROUP:
-            element = new GroupDetailElement(this, parentElement);
-            break;
-        case GRANTEDAUTHORITY:
-            element = new GrantedAuthorityDetailElement(this, parentElement);
-            break;
-        case DETERMINATION:
-            element = new DeterminationDetailElement(this, parentElement);
-            break;
-        case TAXON_RELATIONSHIP:
-            element = new TaxonRelationshipDetailElement(this, parentElement);
-            break;
-        case REFERENCED_ENTITY:
-            element = new RefereneEntityDetailElement(this, parentElement);
-            break;
-        case TERM_VOCABULARY:
-            element = new TermVocabularyDetailElement(this, parentElement);
-            break;
-        case NAMED_AREA:
-            element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
-            break;
-        case NAMED_AREA_LEVEL:
-            element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
-            break;
-        case USE_RECORD:
-            // element = new UseRecordDetailElement(this, parentElement, style);
-            element = new UseRecordDetailElement(this, parentElement);
-            break;
-        }
+    public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
+        UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
 
-        if (element == null) {
-            AbstractUtility.error(this.getClass(),
-                    "Detail element was not created. Seems like the case was not implemented for the requested detail type: "
-                            + detailType, null);
-        }
+    public DefinedTermDetailElement<NamedAreaLevel> createNamedAreaLevelElement(ICdmFormElement parentElement){
+        DefinedTermDetailElement<NamedAreaLevel> element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
 
-        adapt(element);
-        parentElement.addElement(element);
+    public eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement createNamedAreaDetailElement(ICdmFormElement parentElement){
+        eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
         return element;
     }
 
-    /**
-     *
-     * Used to define which {@link AbstractEntityCollectionSection} should be
-     * created in
-     * {@link CdmFormFactory#createEntityDetailSection(EntityDetailType, ConversationHolder, ICdmFormElement, int)}
-     *
-     * @author n.hoffmann
-     * @created Mar 5, 2010
-     * @version 1.0
-     */
-    public static enum EntityDetailType {
-        TEAM, // never used
-        TEAMMEMBER,
-        ANNOTATION,
-        CREDIT,
-        DESCRIPTIONELEMENTSOURCE,
-        EXTENSION,
-        MARKER,
-        MEDIA,
-        DESCRIPTIONELEMENTMEDIA,
-        MEDIAREPRESENTATION,
-        MEDIAREPRESENTATIONPART,
-        MODIFIER,
-        NOMENCLATURALSTATUS,
-        NAME_RELATIONSHIP,
-        PROTOLOG,
-        RIGHTS,
-        SOURCE,
-        SCOPE,
-        DESCRIPTIONSOURCE,
-        TYPEDESIGNATION,
-        STATE_DATA,
-        STATISTICAL_MEASUREMENT_VALUE,
-        DESCRIBED_SPECIMEN,
-        COLLECTING_AREA, DETERMINATION_EVENT, // never used
-        SPECIMEN_COLLECTION,
-        IDENTIFIABLE_SOURCE_COLLECTION,
-        GEOGRAPHICAL_SCOPE, // never used
-        SCOPE_RESTRICTION,
-        MEMBER,
-        GRANTED_AUTHORITY,
-        GROUPS_BY_USER,
-        TAXONOMIC_SCOPE,
-        DETERMINATION_CURRENT,
-        DETERMINATION_HISTORY
+    public TermVocabularyDetailElement createTermVocabularyDetailElement(ICdmFormElement parentElement){
+        TermVocabularyDetailElement element = new TermVocabularyDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public ReferenceEntityDetailElement createReferenceEntityDetailElement(ICdmFormElement parentElement){
+        ReferenceEntityDetailElement element = new ReferenceEntityDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public TaxonRelationshipDetailElement createTaxonRelationshipDetailElement(ICdmFormElement parentElement){
+        TaxonRelationshipDetailElement element = new TaxonRelationshipDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public GrantedAuthorityDetailElement createGrantedAuthorityDetailElement(ICdmFormElement parentElement){
+        GrantedAuthorityDetailElement element = new GrantedAuthorityDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public GroupDetailElement createGroupDetailElement(ICdmFormElement parentElement){
+        GroupDetailElement element = new GroupDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public UserDetailElement createUserDetailElement(ICdmFormElement parentElement){
+        UserDetailElement element = new UserDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public HybridDetailElement createHybridDetailElement(ICdmFormElement parentElement){
+        HybridDetailElement element = new HybridDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public InstitutionDetailElement createInstitutionDetailElement(ICdmFormElement parentElement){
+        InstitutionDetailElement element = new InstitutionDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public PolytomousKeyNodeDetailElement createPolytomousKeyNodeDetailElement(ICdmFormElement parentElement){
+        PolytomousKeyNodeDetailElement element = new PolytomousKeyNodeDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public PolytomousKeyDetailElement createPolytomousKeyDetailElement(ICdmFormElement parentElement){
+        PolytomousKeyDetailElement element = new PolytomousKeyDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public CollectionDetailElement createCollectionDetailElement(ICdmFormElement parentElement){
+        CollectionDetailElement element = new CollectionDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public TaxonNodeDetailElement createTaxonNodeDetailElement(ICdmFormElement parentElement){
+        TaxonNodeDetailElement element = new TaxonNodeDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public ClassificationDetailElement createClassificationDetailElement(ICdmFormElement parentElement){
+        ClassificationDetailElement element = new ClassificationDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public FeatureDistributionDetailElement createFeatureDistributionDetailElement(ICdmFormElement parentElement){
+        FeatureDistributionDetailElement element = new FeatureDistributionDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public NaturalLanguageDetailElement createNaturalLanguageDetailElement(ICdmFormElement parentElement){
+        NaturalLanguageDetailElement element = new NaturalLanguageDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public DerivedUnitFacadeDetailElement createDerivedUnitFacadeDetailElement(ICdmFormElement parentElement){
+        DerivedUnitFacadeDetailElement element = new DerivedUnitFacadeDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public NonViralNameDetailElement createNonViralNameDetailElement(ICdmFormElement parentElement){
+        NonViralNameDetailElement element = new NonViralNameDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public DescriptionElementDetailElement createDescriptionElementDetailElement(ICdmFormElement parentElement, int style){
+        DescriptionElementDetailElement element = new DescriptionElementDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public DescriptionDetailElement createDescriptionDetailElement(ICdmFormElement parentElement, int style){
+        DescriptionDetailElement element = new DescriptionDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public PersonDetailElement createPersonDetailElement(ICdmFormElement parentElement, int style){
+        PersonDetailElement element = new PersonDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public TeamDetailElement createTeamDetailElement(ICdmFormElement parentElement, int style){
+        TeamDetailElement element = new TeamDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public AuthorshipDetailElement createAuthorshipDetailElement(ICdmFormElement parentElement, int style){
+        AuthorshipDetailElement element = new AuthorshipDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public TaxonBaseDetailElement createTaxonBaseDetailElement(ICdmFormElement parentElement, int style){
+        TaxonBaseDetailElement element = new TaxonBaseDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
+        NameDetailElement element = new NameDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
+        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public NomenclaturalReferenceDetailElement createNomenclaturalReferenceDetailElement(ICdmFormElement parentElement, int style){
+        NomenclaturalReferenceDetailElement element = new NomenclaturalReferenceDetailElement(this, parentElement, style);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+
+    public GeneralDetailElement createGeneralDetailElement(ICdmFormElement parentElement){
+        GeneralDetailElement element = new GeneralDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+
+    public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
+        GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public FieldObservationDetailElement createFieldObservationDetailElement(ICdmFormElement parentElement) {
+        FieldObservationDetailElement element = new FieldObservationDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+
+    public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
+        DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public DeterminationDetailElement createDeterminationDetailElement(ICdmFormElement parentElement) {
+        DeterminationDetailElement element = new DeterminationDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
     }
 
     /**
-     * <p>
-     * createEntityDetailSection
-     * </p>
-     *
-     * @param entityDetailType
-     *            a
-     *            {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.EntityDetailType}
-     *            object.
-     * @param style
-     *            a int.
-     * @param conversation
-     *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
-     *            object.
      * @param parentElement
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-     *            object.
-     * @return a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-     *         object.
+     * @param element
      */
-    public AbstractFormSection createEntityDetailSection(EntityDetailType entityDetailType,
-            ConversationHolder conversation, ICdmFormElement parentElement, int style) {
-        AbstractFormSection section = null;
-
-//        System.out.println("EntityDetailSection: " + entityDetailType);
-        switch (entityDetailType) {
-        case TEAM:
-            // TODO this is not an AbstractEntityCollectionSection
-            section = new TeamDetailSection(this, conversation, parentElement, null, style);
-            break;
-        case TEAMMEMBER:
-            section = new TeamMemberSection(this, conversation, parentElement, style);
-            break;
-        case ANNOTATION:
-            section = new AnnotationSection(this, conversation, parentElement, style);
-            break;
-        case CREDIT:
-            section = new CreditSection(this, conversation, parentElement, style);
-            break;
-        case DESCRIPTIONELEMENTSOURCE:
-            section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
-            break;
-        case EXTENSION:
-            section = new ExtensionSection(this, conversation, parentElement, style);
-            break;
-        case MARKER:
-            section = new MarkerSection(this, conversation, parentElement, style);
-            break;
-        case MEDIA:
-            section = new MediaSection(this, conversation, parentElement, style);
-            break;
-        case DESCRIPTIONELEMENTMEDIA:
-            section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
-            break;
-        case MEDIAREPRESENTATION:
-            section = new MediaRepresentationSection(this, conversation, parentElement, style);
-            break;
-        case MEDIAREPRESENTATIONPART:
-            section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
-            break;
-        case MODIFIER:
-            section = new ModifierSection(this, conversation, parentElement, style);
-            break;
-        case NOMENCLATURALSTATUS:
-            section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
-            break;
-        case NAME_RELATIONSHIP:
-            section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
-            break;
-        case PROTOLOG:
-            section = new ProtologueSection(this, conversation, parentElement, style);
-            break;
-        case RIGHTS:
-            section = new RightsSection(this, conversation, parentElement, style);
-            break;
-        case SOURCE:
-            section = new SourceSection(this, conversation, parentElement, style);
-            break;
-        case SCOPE:
-            section = new ScopeSection(this, conversation, parentElement, style);
-            break;
-        case DESCRIPTIONSOURCE:
-            section = new DescriptionSourceSection(this, conversation, parentElement, style);
-            break;
-        case TYPEDESIGNATION:
-            section = new TypeDesignationSection(this, conversation, parentElement, style);
-            break;
-        case STATE_DATA:
-            section = new StateDataSection(this, conversation, parentElement, style);
-            break;
-        case STATISTICAL_MEASUREMENT_VALUE:
-            section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
-            break;
-        case DESCRIBED_SPECIMEN:
-            section = new DescribedSpecimenSection(this, conversation, parentElement, style);
-            break;
-        case COLLECTING_AREA:
-            section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
-            break;
-        case DETERMINATION_CURRENT:
-            section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
-            break;
-        case DETERMINATION_HISTORY:
-            section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
-            break;
-        case SPECIMEN_COLLECTION:
-            section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
-            break;
-        case IDENTIFIABLE_SOURCE_COLLECTION:
-            section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
-            break;
-        case GEOGRAPHICAL_SCOPE:
-            section = new GeographicalScopeDetailSection(this, conversation, parentElement, style);
-            break;
-        case SCOPE_RESTRICTION:
-            section = new ScopeRestrictionSection(this, conversation, parentElement, style);
-            break;
-        case MEMBER:
-            section = new MemberDetailSection(this, conversation, parentElement, style);
-            break;
-        case GRANTED_AUTHORITY:
-            section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
-            break;
-        case GROUPS_BY_USER:
-            section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
-            break;
-        case TAXONOMIC_SCOPE:
-            section = new TaxonomicScopeSection(this, conversation, parentElement, style);
-            break;
-        }
-        parentElement.addElement(section);
-        adapt(section);
+    private void addAndAdaptElement(ICdmFormElement parentElement, AbstractCdmDetailElement<?> element) {
+        adapt(element);
+        parentElement.addElement(element);
+    }
+
+    //--------EntityCollectionSection----------
+    public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public AnnotationSection createAnnotationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        AnnotationSection section = new AnnotationSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public CreditSection createCreditSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        CreditSection section = new CreditSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DescriptionElementSourceSection createDescriptionElementSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        DescriptionElementSourceSection section = new DescriptionElementSourceSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ExtensionSection createExtensionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        ExtensionSection section = new ExtensionSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public MarkerSection createMarkerSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        MarkerSection section = new MarkerSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public MediaSection createMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        MediaSection section = new MediaSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DescriptionElementMediaSection createDescriptionElementMediaSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        DescriptionElementMediaSection section = new DescriptionElementMediaSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public MediaRepresentationSection createMediaRepresentationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        MediaRepresentationSection section = new MediaRepresentationSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public MediaRepresentationPartSection createMediaRepresentationPartSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        MediaRepresentationPartSection section = new MediaRepresentationPartSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ModifierSection createModifierSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        ModifierSection section = new ModifierSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public NomenclaturalStatusSection createNomenclaturalStatusSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        NomenclaturalStatusSection section = new NomenclaturalStatusSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public NameRelationshipDetailSection createNameRelationshipDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        NameRelationshipDetailSection section = new NameRelationshipDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ProtologueSection createProtologueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        ProtologueSection section = new ProtologueSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public RightsSection createRightsSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        RightsSection section = new RightsSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public SourceSection createSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        SourceSection section = new SourceSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ScopeSection createScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        ScopeSection section = new ScopeSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DescriptionSourceSection createDescriptionSourceSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        DescriptionSourceSection section = new DescriptionSourceSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TypeDesignationSection createTypeDesignationSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        TypeDesignationSection section = new TypeDesignationSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public StateDataSection createStateDataSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        StateDataSection section = new StateDataSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public StatisticalMeasurementValueSection createStatisticalMeasurementValueSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        StatisticalMeasurementValueSection section = new StatisticalMeasurementValueSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DescribedSpecimenSection createDescribedSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        DescribedSpecimenSection section = new DescribedSpecimenSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public CollectingAreasDetailSection createCollectingAreasDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        CollectingAreasDetailSection section = new CollectingAreasDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public CurrentDeterminationDetailSection createCurrentDeterminationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        CurrentDeterminationDetailSection section = new CurrentDeterminationDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DeterminationHistoryDetailSection createDeterminationHistoryDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        DeterminationHistoryDetailSection section = new DeterminationHistoryDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public SpecimenCollectionDetailSection createSpecimenCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        SpecimenCollectionDetailSection section = new SpecimenCollectionDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public SourceCollectionDetailSection createSourceCollectionDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        SourceCollectionDetailSection section = new SourceCollectionDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public GeographicalScopeDetailSection createGeographicalScopeDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        GeographicalScopeDetailSection section = new GeographicalScopeDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public ScopeRestrictionSection createScopeRestrictionSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        ScopeRestrictionSection section = new ScopeRestrictionSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public MemberDetailSection createMemberDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        MemberDetailSection section = new MemberDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public GrantedAuthorityDetailSection createGrantedAuthorityDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        GrantedAuthorityDetailSection section = new GrantedAuthorityDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public GroupsByUserDetailSection createGroupsByUserDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        GroupsByUserDetailSection section = new GroupsByUserDetailSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public TaxonomicScopeSection createTaxonomicScopeSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        TaxonomicScopeSection section = new TaxonomicScopeSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
         return section;
     }
 
@@ -1964,8 +2077,7 @@ public class CdmFormFactory extends FormToolkit {
         } else if (entity instanceof NamedArea) {
             element = new NamedAreaDetailElement(this, parentElement, (NamedArea) entity, removeListener, style);
         } else if (entity instanceof DeterminationEvent) {
-            element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity,
-                    removeListener, style);
+            element = new DeterminationEventDetailElement(this, parentElement, (DeterminationEvent) entity, removeListener, style);
         } else if (entity instanceof Specimen) {
             element = new SpecimenCollectionDetailElement(this, parentElement, (Specimen) entity, removeListener, style);
         } else if (entity instanceof User) {
@@ -1994,11 +2106,18 @@ public class CdmFormFactory extends FormToolkit {
 
         else if (backgroundColor != null && !backgroundColor.isDisposed()) {
             element.setPersistentBackground(backgroundColor);
+            adapt(element);
+            parentElement.addElement(element);
         }
 
+        return element;
+    }
+
+    public void createNamedAreaFieldController(AbstractFormSection parentElement, NamedArea namedArea, SelectionListener removeListener){
+//        Object entity = HibernateProxyHelper.deproxy(versionableEntity); TODO deproxy necessary??
+        NamedAreaFieldController element = new NamedAreaFieldController(this, parentElement, namedArea, removeListener, SWT.NONE);
         adapt(element);
         parentElement.addElement(element);
-        return element;
     }
 
     /**
@@ -2154,4 +2273,65 @@ public class CdmFormFactory extends FormToolkit {
         return text;
     }
 
+
+
+    /**
+     * @param conversationHolder
+     * @param parent
+     * @param detailsViewer
+     * @param i
+     * @return
+     */
+    public FieldObservationSection createFieldObservationSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+        FieldObservationSection section = new FieldObservationSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    /**
+     * @param conversationHolder
+     * @param parent
+     * @param detailsViewer
+     * @param i
+     * @return
+     */
+    public SpecimenSection createSpecimenSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+        SpecimenSection section = new SpecimenSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public SpecimenGeneralElementController createSpecimenGeneralElementController(ICdmFormElement parentElement){
+        SpecimenGeneralElement specimenGeneralElement = new SpecimenGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
+        specimenGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        SpecimenGeneralElementController element = new SpecimenGeneralElementController(specimenGeneralElement, this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public FieldObservationGeneralElementController createFieldObservationGeneralElement(ICdmFormElement parentElement){
+        FieldObservationGeneralElement fieldObservationGeneralElement = new FieldObservationGeneralElement(parentElement.getLayoutComposite(), SWT.NONE);
+        fieldObservationGeneralElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        FieldObservationGeneralElementController element = new FieldObservationGeneralElementController(fieldObservationGeneralElement, this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public GatheringEventDetailsElementController createGatheringEventDetailsElementController(ICdmFormElement parentElement) {
+        GatheringEventDetailsElement gatheringEventDetailsElement = new GatheringEventDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+        gatheringEventDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        GatheringEventDetailsElementController element = new GatheringEventDetailsElementController(gatheringEventDetailsElement, this, parentElement);
+        adapt(element);
+        parentElement.addElement(element);
+        return element;
+    }
+
+    public FieldObservationDetailsElementController createFieldObservationDetailsElementController(ICdmFormElement parentElement) {
+        FieldObservationDetailsElement fieldObservationDetailsElement = new FieldObservationDetailsElement(parentElement.getLayoutComposite(), SWT.NONE);
+        fieldObservationDetailsElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2,1));
+        FieldObservationDetailsElementController element = new FieldObservationDetailsElementController(fieldObservationDetailsElement, this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
 }