ref #9838: change order of ui element creation and setting entity in collection elements
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / StatisticalMeasurementValueSection.java
index cef5b828bd07430f94d81a86af9293e8934588ff..1d6566dd5ef7d4004e215afb62390bd074327433 100644 (file)
@@ -1,9 +1,8 @@
-// $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.
 */
 package eu.etaxonomy.taxeditor.ui.section.description;
 
 import java.util.Collection;
+import java.util.Comparator;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.description.QuantitativeData;
 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
 
 /**
  * <p>StatisticalMeasurementValueSection class.</p>
@@ -27,8 +29,8 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
  * @version 1.0
  */
 public class StatisticalMeasurementValueSection extends
-               AbstractEntityCollectionSection<QuantitativeData, StatisticalMeasurementValue> {
-       
+               AbstractEntityCollectionSection<QuantitativeData, StatisticalMeasurementValue> implements IEnableableFormElement{
+
        /**
         * <p>Constructor for StatisticalMeasurementValueSection.</p>
         *
@@ -42,7 +44,7 @@ public class StatisticalMeasurementValueSection extends
                        int style) {
                super(formFactory, conversation, parentElement, "Statistical Measurement Value", style);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public Collection<StatisticalMeasurementValue> getCollection(
@@ -50,6 +52,11 @@ public class StatisticalMeasurementValueSection extends
                return entity.getStatisticalValues();
        }
 
+       @Override
+       public Comparator<StatisticalMeasurementValue> getComparator() {
+        return new DefaultCdmBaseComparator<>();
+       }
+
        /** {@inheritDoc} */
        @Override
        public StatisticalMeasurementValue createNewElement() {
@@ -79,4 +86,20 @@ public class StatisticalMeasurementValueSection extends
        protected String getTooltipString() {
                return "Create new statistical value";
        }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public StatisticalMeasurementValue addExisting() {
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean allowAddExisting() {
+        return false;
+    }
 }