- added preference for showing Collecting Areas below Country in DetailsView (#4473)
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 20 Nov 2014 13:53:04 +0000 (13:53 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 20 Nov 2014 13:53:04 +0000 (13:53 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java

index 08bc4d8256d1d9855a5548c9a90c87cc5d535ca5..dfc178da04deaec541c5d07fb840d1a0a2b061da 100644 (file)
@@ -119,6 +119,8 @@ public interface IPreferenceKeys {
 
     public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel";
 
+    public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection";
+
 
     public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
 
index f217610d4d4999a3fd3fad28eb900a33d3178564..93ebade8b6d5af2adbbd2c6445a2f1ac5d3d363c 100644 (file)
@@ -37,6 +37,9 @@ public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage
         addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
                 "Taxon determination only on FieldUnit level",
                 getFieldEditorParent()));
+        addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
+                "Show \"Collecting Areas\" in \"General\" section of details view",
+                getFieldEditorParent()));
 
     }
 
index 840d84a0862957fa54fdba6a74cca6940d7aa44a..e127f9dd8b9aad7111a113a9a9627383ad8bf05f 100644 (file)
@@ -16,6 +16,8 @@ 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;
@@ -74,10 +76,11 @@ 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);
-
-        section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
-        section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-        section_collectingAreas.setEntity(entity);
+        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);
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} */