- created specimen general element
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / CdmFormFactory.java
index 822f70e6349aee41a6cf8693172c340cce3cb6a5..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;
@@ -398,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>
@@ -429,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
@@ -1165,6 +1176,13 @@ public class CdmFormFactory extends FormToolkit {
         propertyChangeListeners.remove(listener);
     }
 
+    /**
+     * @return the propertyChangeListeners
+     */
+    public List<IPropertyChangeListener> getPropertyChangeListeners() {
+        return propertyChangeListeners;
+    }
+
     /**
      * <p>
      * createHorizontalSeparator
@@ -1346,6 +1364,8 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+
+    //--------DetailSections---------
     public NameDetailSection createNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         NameDetailSection section = new NameDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
@@ -1551,29 +1571,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public GeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
-    public GatheringEventDetailSection createGatheringSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        GatheringEventDetailSection section = new GatheringEventDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
-    public FieldObservationDetailSection createFODetailsSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        FieldObservationDetailSection section = new FieldObservationDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
     private void addAndAdaptSection(ICdmFormElement parentElement, AbstractFormSection<?> section) {
         parentElement.addElement(section);
         adapt(section);
     }
 
+    //--------DetailElements------------
 
     public UseRecordDetailElement createUseRecordDetailElement(ICdmFormElement parentElement){
         UseRecordDetailElement element = new UseRecordDetailElement(this, parentElement);
@@ -1756,6 +1759,7 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+
     public GatheringEventDetailElement createGatheringEventDetailElement(ICdmFormElement parentElement) {
         GatheringEventDetailElement element = new GatheringEventDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
@@ -1768,6 +1772,7 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+
     public DerivedUnitBaseDetailElement createDerivedUnitBaseDetailElement(ICdmFormElement parentElement) {
         DerivedUnitBaseDetailElement element = new DerivedUnitBaseDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
@@ -1789,185 +1794,202 @@ public class CdmFormFactory extends FormToolkit {
         parentElement.addElement(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
+    //--------EntityCollectionSection----------
+    public TeamMemberSection createTeamMemberSection(ConversationHolder conversation, ICdmFormElement parentElement, int style){
+        TeamMemberSection section = new TeamMemberSection(this, conversation, parentElement, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
     }
 
-    /**
-     * <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.
-     */
-    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);
+    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;
     }
 
@@ -2055,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) {
@@ -2085,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;
     }
 
     /**
@@ -2245,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;
+    }
+
 }