latest changes from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / occurrence / FieldUnitGeneralDetailElement.java
index e68552eb8649dca1603261beef1fe56d181f1b42..e127f9dd8b9aad7111a113a9a9627383ad8bf05f 100644 (file)
@@ -9,16 +9,21 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 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.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
 import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.PointElement;
@@ -38,6 +43,7 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
     private ToggleableTextElement toggleableText_titleCache;
     private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
     private EntitySelectionElement<NamedArea> selection_country;
+    private CollectingAreasDetailSection section_collectingAreas;
     private LanguageStringWithLabelElement languageText_locality;
     private PointElement element_point;
     private NumberWithLabelElement number_elevation;
@@ -70,6 +76,12 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
         combo_specorobstype.setSelection(entity.getType());
         selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
                 "Country", entity.getCountry(), EntitySelectionElement.NOTHING, 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);
+        }
+
         languageText_locality = formFactory.createLanguageStringWithLabelElement(formElement, "Locality",
                 entity.getLocality(), style);
         element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style);