fix #6330 Add default sorting for all entity collections
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / supplemental / MarkerSection.java
index ffc3f10a2b37db0062f764bb674006014e2962ba..09a3b8bf9de248dde2554b7690be27afc0194498 100644 (file)
@@ -1,16 +1,15 @@
-/**
- * 
- */
 package eu.etaxonomy.taxeditor.ui.section.supplemental;
 
 import java.util.Collection;
+import java.util.Comparator;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
 import eu.etaxonomy.cdm.model.common.Marker;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
 
 /**
  * <p>MarkerSection class.</p>
@@ -18,7 +17,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
  * @author nho
  * @version $Id: $
  */
-public class MarkerSection extends AbstractEntityCollectionSection<AnnotatableEntity, Marker> {
+public class MarkerSection extends AbstractUnboundEntityCollectionSection<AnnotatableEntity, Marker> {
 
        /**
         * <p>Constructor for MarkerSection.</p>
@@ -35,13 +34,9 @@ public class MarkerSection extends AbstractEntityCollectionSection<AnnotatableEn
        /** {@inheritDoc} */
        @Override
        public Marker createNewElement() {
-               return Marker.NewInstance();
-       }
-
-       /** {@inheritDoc} */
-       @Override
-       public Collection<Marker> getCollection(AnnotatableEntity entity) {
-               return entity.getMarkers();
+               Marker marker = Marker.NewInstance();
+               marker.setFlag(true);
+        return marker;
        }
 
        /** {@inheritDoc} */
@@ -68,4 +63,32 @@ public class MarkerSection extends AbstractEntityCollectionSection<AnnotatableEn
                getEntity().removeMarker(element);
        }
 
+    @Override
+    protected Collection<Marker> getEntityCollection(AnnotatableEntity entity) {
+        return entity.getMarkers();
+    }
+
+    @Override
+    public Comparator<Marker> getComparator() {
+        return new DefaultCdmBaseComparator<>();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Marker addExisting() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean allowAddExisting() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
 }