- added preference for showing Collecting Areas below Country in DetailsView (#4473)
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / GatheringEventDetailElement.java
index c1e9e98cfee179399d373d82643c4e82055428dd..cf19f5b32ac77071481322125b8e5b8ca1f0de1b 100644 (file)
 
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
@@ -40,6 +45,8 @@ public class GatheringEventDetailElement extends
 
        private TextWithLabelElement text_gatheringEventDescription;
 
+       private CollectingAreasDetailSection section_collectingAreas;
+
        /**
         * <p>
         * Constructor for GatheringEventDetailElement.
@@ -60,7 +67,8 @@ public class GatheringEventDetailElement extends
        /** {@inheritDoc} */
        @Override
        protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-        text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
+
+           text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
 
         text_gatheringEventDescription = formFactory.createTextWithLabelElement(
                        formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
@@ -71,6 +79,13 @@ public class GatheringEventDetailElement extends
                element_distToWater = formFactory.createGatheringEventUnitElement(
                                formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER,  style);
 
+
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            section_collectingAreas.setEntity(entity);
+        }
+
        }
 
        /** {@inheritDoc} */