Fix Ticket #4592
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / classification / ClassificationDetailElement.java
index b13cc94fcd5156c752b72a971458c50a7b47482f..0a583772dd08a9fef91597d0318148f23768ef59 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.
  */
@@ -18,15 +18,18 @@ import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
  * <p>
  * ClassificationDetailElement class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Sep 27, 2010
  * @version 1.0
@@ -40,11 +43,18 @@ public class ClassificationDetailElement extends
 
        private TextWithLabelElement text_microReference;
 
+       private TimePeriodElement element_date;
+
+    private GeoScopeDetailSection section_collectingAreas;
+
+
+
+
        /**
         * <p>
         * Constructor for ClassificationDetailElement.
         * </p>
-        * 
+        *
         * @param formFactory
         *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
         *            object.
@@ -59,7 +69,7 @@ public class ClassificationDetailElement extends
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
         * (eu.etaxonomy.taxeditor.forms.ICdmFormElement,
@@ -68,23 +78,23 @@ public class ClassificationDetailElement extends
        /** {@inheritDoc} */
        @Override
        protected void createControls(ICdmFormElement formElement,
-                       Classification entity, int style) {
-               text_treeLabel = formFactory.createTextWithLabelElement(formElement,
-                               "Label", entity != null ? entity.getTitleCache() : null,
-                               SWT.NULL);
-               selection_reference = formFactory
-                               .createSelectionElement(Reference.class,
-                                               getConversationHolder(), formElement, "Reference",
-                                               entity != null ? entity.getReference() : null,
-                                               EntitySelectionElement.ALL, SWT.NULL);
-               text_microReference = formFactory.createTextWithLabelElement(
-                               formElement, "Reference Detail",
-                               entity != null ? entity.getMicroReference() : null, SWT.NULL);
+               Classification entity, int style) {
+           text_treeLabel = formFactory.createTextWithLabelElement(formElement, "Label", entity != null ? entity.getTitleCache() : null, SWT.NULL);
+           selection_reference = formFactory.createSelectionElement(Reference.class, getConversationHolder(), formElement, "Reference",
+                   entity != null ? entity.getReference() : null, EntitySelectionElement.ALL, SWT.NULL);
+           text_microReference = formFactory.createTextWithLabelElement(formElement, "Reference Detail",
+                   entity != null ? entity.getMicroReference() : null, SWT.NULL);
+              element_date = formFactory.createTimePeriodElement(formElement, "Date",
+                   entity.getTimeperiod(), style);
+              section_collectingAreas = formFactory.createGeoScopeDetailSection(getConversationHolder(), formElement, SWT.NULL);
+           section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+           section_collectingAreas.setEntity(entity);
+
        }
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
         * .lang.Object)
@@ -100,6 +110,8 @@ public class ClassificationDetailElement extends
                        getEntity().setReference(selection_reference.getEntity());
                } else if (eventSource == text_microReference) {
                        getEntity().setMicroReference(text_microReference.getText());
+               }else if (eventSource == element_date) {
+            getEntity().setTimeperiod(element_date.getTimePeriod());
                }
        }
 }