- added DetailsView for FieldUnit (partly fixes #3780)
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 5 Nov 2013 09:32:18 +0000 (09:32 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 5 Nov 2013 09:32:18 +0000 (09:32 +0000)
.gitattributes
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java with 97% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java with 85% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index 4c063167a9eb014fb73f664e656a69bc2c15a8eb..91d0cd5162c2e6043f03144b65e237b4e8a5a0af 100644 (file)
@@ -1423,18 +1423,20 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occ
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventWizardPage.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GeneralWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/IDerivedUnitFacadeDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/NamedAreaDetailElement.java -text
index cf09eda13ffeb7456c33c8083f8a648d47317747..4ee1e3318de265c427beaf5502678bab94f3f137 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -26,7 +26,6 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.CompoundContributionItem;
 import org.eclipse.ui.handlers.IHandlerService;
 
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
@@ -42,8 +41,8 @@ import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 public class DynamicNewObjectMenu extends CompoundContributionItem {
        private static final Logger logger = Logger
                        .getLogger(DynamicNewObjectMenu.class);
-       
-       private IHandlerService handlerService = (IHandlerService) BulkEditorUtil.getService(IHandlerService.class);
+
+       private final IHandlerService handlerService = (IHandlerService) BulkEditorUtil.getService(IHandlerService.class);
        private Map<Object, String> classLabelPairs;
        /* (non-Javadoc)
         * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
@@ -51,15 +50,16 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
        /** {@inheritDoc} */
        @Override
        protected IContributionItem[] getContributionItems() {
-               
+
                classLabelPairs = getClassLabelPairs();
-               
+
                return new IContributionItem[] {
                                new ContributionItem() {
-                                       public void fill(Menu menu, int index){
+                                       @Override
+                    public void fill(Menu menu, int index){
                                                for(final Object key : classLabelPairs.keySet()){
                                                        createMenuItem(menu, key);
-                                               }                       
+                                               }
                                        }
                                }
                };
@@ -70,9 +70,11 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
                menuItem.setText(classLabelPairs.get(key));
                menuItem.addSelectionListener(new SelectionListener(){
 
-                       public void widgetDefaultSelected(SelectionEvent e) {}
+                       @Override
+            public void widgetDefaultSelected(SelectionEvent e) {}
 
-                       public void widgetSelected(SelectionEvent ev) {
+                       @Override
+            public void widgetSelected(SelectionEvent ev) {
                                Event event = new Event();
                                event.data = key;
                                event.text = classLabelPairs.get(key);
@@ -82,15 +84,10 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
                                        logger.error("Error executing command", e);
                                        throw new RuntimeException("Error executing command", e);
                                }
-                       }                               
+                       }
                });
-               
-               //FIXME:3.3MC Need corresponding Details Viewer section for FieldUnit
-               if(key == SpecimenOrObservationType.FieldUnit){
-                       menuItem.setEnabled(false);
-               }
        }
-       
+
        /**
         * Get class label pairs from Annotated Line Editor's entity creator.
         * @return
@@ -99,13 +96,13 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
                IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
                if (editor != null){
                        IEditorInput input = editor.getEditorInput();
-                       
+
                        if(input instanceof AbstractBulkEditorInput){
                                IEntityCreator<?> entityCreator = ((AbstractBulkEditorInput) input).getEntityCreator();
                                return entityCreator.getKeyLabelPairs();
                        }
                }
-               
+
                return null;
-       }       
+       }
 }
index 00818c1455b98f60c566345fbb4f73cf30b40c25..abfe38db919230e183e29068d2585ddfc56eb9c4 100644 (file)
@@ -197,16 +197,18 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailElement
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitFacadeDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitFacadeDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.NamedAreaDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
@@ -1562,8 +1564,14 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public GeneralDetailSection createGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        GeneralDetailSection section = new GeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+    public FieldUnitGeneralDetailSection createFieldUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        FieldUnitGeneralDetailSection section = new FieldUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
+    public DerivedUnitGeneralDetailSection createDerivedUnitGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
         return section;
     }
@@ -1623,8 +1631,8 @@ 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);
+    public DerivedUnitGeneralDetailSection createFOSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        DerivedUnitGeneralDetailSection section = new DerivedUnitGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
         return section;
                }
@@ -1823,8 +1831,14 @@ public class CdmFormFactory extends FormToolkit {
     }
 
 
-    public GeneralDetailElement createGeneralDetailElement(ICdmFormElement parentElement){
-        GeneralDetailElement element = new GeneralDetailElement(this, parentElement);
+    public FieldUnitGeneralDetailElement createFieldUnitGeneralDetailElement(ICdmFormElement parentElement){
+        FieldUnitGeneralDetailElement element = new FieldUnitGeneralDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
+    public DerivedUnitGeneralDetailElement createDerivedUnitGeneralDetailElement(ICdmFormElement parentElement){
+        DerivedUnitGeneralDetailElement element = new DerivedUnitGeneralDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
         return element;
     }
index 6c23279483fa55d83dc5db22de7e5a1d3a0388e3..39fb47ea3f37acc65941849b0dec919031b0ac3b 100644 (file)
@@ -36,7 +36,7 @@ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElement<Der
 
        private final DerivedUnitFacadeConfigurator configurator;
 
-       private GeneralDetailSection section_general;
+       private DerivedUnitGeneralDetailSection section_general;
        private GatheringEventDetailSection section_gatheringEvent;
        private DerivedUnitBaseDetailSection section_derivedUnitBase;
        private FieldUnitDetailSection section_fieldUnit;
@@ -118,7 +118,7 @@ public class DerivedUnitFacadeDetailElement extends AbstractCdmDetailElement<Der
        protected void createControls(ICdmFormElement formElement,
                        DerivedUnit entity, int style) {
 
-               section_general = formFactory.createGeneralDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+               section_general = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
                section_general.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
                addControl(section_general);
                addElement(section_general);
@@ -35,7 +35,7 @@ import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
  * @created Dec 16, 2010
  * @version 1.0
  */
-public class GeneralDetailElement extends
+public class DerivedUnitGeneralDetailElement extends
                AbstractCdmDetailElement<DerivedUnitFacade> {
 
        private ToggleableTextElement toggleableText_titleCache;
@@ -55,7 +55,7 @@ public class GeneralDetailElement extends
         * @param formFactory
         * @param formElement
         */
-       public GeneralDetailElement(CdmFormFactory formFactory,
+       public DerivedUnitGeneralDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement) {
                super(formFactory, formElement);
        }
@@ -24,7 +24,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
  * @created Dec 16, 2010
  * @version 1.0
  */
-public class GeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+public class DerivedUnitGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
 
        /**
         * @param formFactory
@@ -33,7 +33,7 @@ public class GeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFa
         * @param selectionProvider
         * @param style
         */
-       public GeneralDetailSection(CdmFormFactory formFactory,
+       public DerivedUnitGeneralDetailSection(CdmFormFactory formFactory,
                        ConversationHolder conversation, ICdmFormElement parentElement,
                        ISelectionProvider selectionProvider, int style) {
                super(formFactory, conversation, parentElement, selectionProvider, style);
@@ -53,7 +53,7 @@ public class GeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFa
         */
        @Override
        protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-           return formFactory.createGeneralDetailElement(parentElement);
+           return formFactory.createDerivedUnitGeneralDetailElement(parentElement);
        }
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java
new file mode 100644 (file)
index 0000000..21d3d1e
--- /dev/null
@@ -0,0 +1,113 @@
+// $Id$
+/**
+ * Copyright (C) 2013 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.ui.section.occurrence;
+
+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.ui.combo.EnumComboElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.PointElement;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
+
+/**
+ * @author pplitzner
+ * @date 05.11.2013
+ *
+ */
+public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+    private ToggleableTextElement toggleableText_titleCache;
+    private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
+    private EntitySelectionElement<NamedArea> selection_country;
+    private LanguageStringWithLabelElement languageText_locality;
+    private PointElement element_point;
+    private NumberWithLabelElement number_elevation;
+    private TimePeriodElement element_date;
+    private EntitySelectionElement<AgentBase> selection_collector;
+    private TextWithLabelElement text_collectingNumber;
+
+    /**
+     * @param formFactory
+     * @param formElement
+     */
+    public FieldUnitGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+        super(formFactory, formElement);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
+     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
+     */
+    @Override
+    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+        toggleableText_titleCache = formFactory.createToggleableTextField(formElement, "Title Cache",
+                entity.getTitleCache(), entity.isProtectedTitleCache(), style);
+        combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
+        combo_specorobstype.setSelection(entity.getType());
+        selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
+                "Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
+        languageText_locality = formFactory.createLanguageStringWithLabelElement(formElement, "Locality",
+                entity.getLocality(), style);
+        element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style);
+        element_date = formFactory.createTimePeriodElement(formElement, "Date", entity.getGatheringPeriod(), style);
+        selection_collector = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement,
+                "Collector", entity.getCollector(), EntitySelectionElement.ALL, style);
+        text_collectingNumber = formFactory.createTextWithLabelElement(formElement, "Collecting number",
+                entity.getFieldNumber(), style);
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see
+     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
+     * .lang.Object)
+     */
+    @Override
+    public void handleEvent(Object eventSource) {
+        if (eventSource == toggleableText_titleCache) {
+            getEntity().setTitleCache(toggleableText_titleCache.getText(), toggleableText_titleCache.getState());
+        } else if (eventSource == selection_country) {
+            getEntity().setCountry(selection_country.getSelection());
+        } else if (eventSource == languageText_locality) {
+            LanguageString locality = languageText_locality.getLanguageString();
+            getEntity().setLocality(locality);
+        } else if (eventSource == element_point) {
+            getEntity().setExactLocation(element_point.getPoint());
+        } else if (eventSource == number_elevation) {
+            getEntity().setAbsoluteElevation(number_elevation.getInteger());
+        } else if (eventSource == element_date) {
+            getEntity().setGatheringPeriod(element_date.getTimePeriod());
+        } else if (eventSource == selection_collector) {
+            getEntity().setCollector(selection_collector.getSelection());
+        } else if (eventSource == text_collectingNumber) {
+            getEntity().setFieldNumber(text_collectingNumber.getText());
+        } else if (eventSource == combo_specorobstype) {
+            getEntity().setType(combo_specorobstype.getSelection());
+        }
+
+        if (eventSource != toggleableText_titleCache) {
+            toggleableText_titleCache.setText(getEntity().getTitleCache());
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailSection.java
new file mode 100644 (file)
index 0000000..589f2cf
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.ui.section.occurrence;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author pplitzner
+ * @date 05.11.2013
+ *
+ */
+public class FieldUnitGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+    /**
+     * @param formFactory
+     * @param conversation
+     * @param parentElement
+     * @param selectionProvider
+     * @param style
+     */
+    public FieldUnitGeneralDetailSection(CdmFormFactory formFactory,
+            ConversationHolder conversation, ICdmFormElement parentElement,
+            ISelectionProvider selectionProvider, int style) {
+        super(formFactory, conversation, parentElement, selectionProvider, style);
+    }
+
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
+     */
+    @Override
+    public String getHeading() {
+        return "General";
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+     */
+    @Override
+    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+        return formFactory.createFieldUnitGeneralDetailElement(parentElement);
+    }
+
+}
index 700686948103a2f3f4b89d7bbe508229df5038f1..b79fe9a9df12514c8f2ef0ebab750b48f44d2c31 100644 (file)
@@ -48,7 +48,7 @@ public class GeneralWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitFa
         */
        @Override
        public AbstractCdmDetailElement<DerivedUnitFacade> createElement(ICdmFormElement rootElement) {
-               GeneralDetailElement detailElement = formFactory.createGeneralDetailElement(rootElement);
+               DerivedUnitGeneralDetailElement detailElement = formFactory.createDerivedUnitGeneralDetailElement(rootElement);
                detailElement.setEntity(getEntity());
                checkComplete();
                return detailElement;
index 7eaf0dc4620806a165d21694b4474da123759c96..77b3589b67b373f52a444c3d2150f1a4e0c36a4d 100644 (file)
@@ -2,9 +2,9 @@
 // $Id$
 /**
  * Copyright (C) 2011 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -39,10 +39,11 @@ import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.name.NonViralName;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-
 import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
@@ -77,10 +78,11 @@ import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.GeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
@@ -94,7 +96,7 @@ import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
 
 /**
- * 
+ *
  * The DetailsViewer handles the content of the details view (
  * {@link DetailsViewPart}).<br>
  * Depending on the type of the selected element the section of the details view
@@ -112,7 +114,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         * <p>
         * Constructor for DetailsViewer.
         * </p>
-        * 
+        *
         * @param parent
         *            a {@link org.eclipse.swt.widgets.Composite} object.
         * @param viewPart
@@ -130,7 +132,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
         * .lang.Object)
@@ -145,6 +147,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                 AbstractUtility.error(getClass(), e);
                        }
                }
+               else if(input instanceof FieldUnit){
+                   input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
+               }
                super.setInput(input);
        }
 
@@ -161,7 +166,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.jface.viewers.Viewer#refresh()
         */
        /** {@inheritDoc} */
@@ -203,7 +208,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
             if (((DescriptionBase) input).isImageGallery()) {
                                createImageGallerySection(rootElement);
 
-                       } else if (isUseDescription) { 
+                       } else if (isUseDescription) {
                                createUseDescriptionSection(rootElement);
                        } else {
                                createDescriptionSection(rootElement);
@@ -219,7 +224,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                                        isUseDescription = true;
                                }
                        }
-                       
+
             if (isUseDescription == true && input instanceof CategoricalData) {
                                createUseRecordSection(rootElement);
             } else {
@@ -230,7 +235,15 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                        createMediaElementSection(rootElement);
 
         } else if (input instanceof DerivedUnitFacade) {
-                       createDerivedUnitBaseElementSection(rootElement);
+            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
+                createFieldUnitSection(rootElement);
+            }
+            else{
+                createDerivedUnitBaseElementSection(rootElement);
+            }
+
+        } else if (input instanceof FieldUnit) {
+            createFieldUnitSection(rootElement);
 
         } else if (input instanceof FeatureNodeContainer) {
                        createFeatureDistributionSection(rootElement);
@@ -256,7 +269,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                layout();
        }
 
-       
+
        /**
         * @param rootElement
         */
@@ -274,7 +287,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.jface.viewers.Viewer#getSelection()
         */
        /** {@inheritDoc} */
@@ -285,7 +298,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
         * .ISelection, boolean)
@@ -422,7 +435,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
                addPart(teamDetailSection);
        }
-       
+
        /**
         * createPersonDetailSection
      *
@@ -494,7 +507,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 //             addPart(descriptionSourceSection);
                addPart(scopeSection);
        }
-       
+
        /**
         * Creates the use Description section
      *
@@ -512,7 +525,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
                addPart(descriptionDetailSection);
                addPart(descriptionSourceSection);
-               
+
        }
 
 
@@ -525,7 +538,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
                addPart(descriptionDetailSection);
        }
-       
+
        /**
         * createMediaElementSection
      *
@@ -547,7 +560,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
        private void createDerivedUnitBaseElementSection(RootElement parent) {
                destroySections();
 
-        GeneralDetailSection generalDetailSection = formFactory.createGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
@@ -565,7 +578,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
         DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
 
-               addPart(generalDetailSection);
+               addPart(derivedUnitGeneralDetailSection);
                addPart(gatheringEventDetailSection);
                addPart(fieldUnitDetailSection);
                addPart(derivedUnitBaseDetailSection);
@@ -573,6 +586,29 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
        }
 
+       /**
+        * createDerivedUnitBaseElementSection
+        *
+        * @param parent
+        */
+       private void createFieldUnitSection(RootElement parent) {
+           destroySections();
+
+           FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+           formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+           GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+           formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+           FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+           addPart(fielUnitGeneralDetailSection);
+           addPart(gatheringEventDetailSection);
+           addPart(fieldUnitDetailSection);
+       }
+
        /**
         * @param rootElement
         */
@@ -593,9 +629,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                destroySections();
 
         PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
-        
+
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-        
+
         PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
@@ -607,7 +643,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
            addPart(taxonomicScopeSection);
 
        }
-       
+
        /**
         * create the UseRecordSection
      *
@@ -619,10 +655,10 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-               
+
                addPart(descriptionUseRecordSection);
-               
-               
+
+
        }
 
        /**
@@ -678,21 +714,4 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                addPart(definedTermDetailSection);
        }
 
-    private void createFODetailsView(RootElement parent) {
-        destroySections();
-
-        GeneralDetailSection generalDetailSection = formFactory.createFOSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-        GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-        FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFODetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
-        addPart(generalDetailSection);
-        addPart(gatheringEventDetailSection);
-        addPart(fieldUnitDetailSection);
-    }
 }