- added collecting area section to general section DerivedUnit DetailsView (fixes...
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 20 Apr 2015 11:22:37 +0000 (11:22 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 20 Apr 2015 11:22:37 +0000 (11:22 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java

index 25f24e317b0e0687c21b88028e628462531e0f70..1ac5b58dea93b3758db25b287f039bbc055e2c58 100644 (file)
 
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
 
 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.Collection;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 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.Collection;
 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.CheckboxElement;
 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.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 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;
 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
 import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.PointElement;
@@ -44,6 +49,7 @@ public class DerivedUnitGeneralDetailElement extends
        private ToggleableTextElement toggleableText_titleCache;
        private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
        private EntitySelectionElement<NamedArea> selection_country;
        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;
        private LanguageStringWithLabelElement languageText_locality;
        private PointElement element_point;
        private NumberWithLabelElement number_elevation;
@@ -88,6 +94,12 @@ public class DerivedUnitGeneralDetailElement extends
                    selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
                            formElement, "Country",
                            entity.getCountry(), EntitySelectionElement.NOTHING, style);
                    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);
                    languageText_locality = formFactory
                            .createLanguageStringWithLabelElement(formElement, "Locality",
                                    entity.getLocality(), style);