commit acd1721bbcdea478b6586162ff899416cfb8a5a5
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Fri Mar 2 16:27:35 2018 +0100

    ref #6526 Added comparator for type designations

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
index ac903ed9c..bc8c40ee1 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
@@ -18,6 +18,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -60,11 +61,13 @@ import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
 import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.io.common.ExportDataWrapper;
 import eu.etaxonomy.cdm.io.common.ExportResult;
 import eu.etaxonomy.cdm.io.common.ExportResultType;
 import eu.etaxonomy.cdm.io.common.ExportType;
 import eu.etaxonomy.cdm.model.common.IEnumTerm;
+import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.taxeditor.event.EventUtility;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
@@ -759,4 +762,25 @@ public abstract class AbstractUtility {
         return Status.OK_STATUS;
         }
 
+    public static Comparator<TypeDesignationBase> getTypeDesignationComparator(){
+        return new Comparator<TypeDesignationBase>() {
+            @Override
+            public int compare(TypeDesignationBase o1, TypeDesignationBase o2) {
+                if(o1==null){
+                    return 1;
+                }
+                if(o2==null){
+                    return -1;
+                }
+                if(o1.getTypeStatus()==null){
+                    return 1;
+                }
+                if(o2.getTypeStatus()==null){
+                    return-1;
+                }
+                return HibernateProxyHelper.deproxy(o2, TypeDesignationBase.class).getTypeStatus().compareTo(HibernateProxyHelper.deproxy(o1, TypeDesignationBase.class).getTypeStatus());
+            }
+        };
+    }
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java
index a2132c973..dae27c8af 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java
@@ -9,7 +9,10 @@
 
 package eu.etaxonomy.taxeditor.ui.section.name;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.INameService;
@@ -20,6 +23,7 @@ import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
 import eu.etaxonomy.cdm.model.name.TaxonName;
 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -73,7 +77,9 @@ public class TypeDesignationSection extends AbstractEntityCollectionSection<Taxo
 		if (entity == null){
 			return null;
 		}
-		return entity.getTypeDesignations();
+		List<TypeDesignationBase> typeDesignations = new ArrayList<>(entity.getTypeDesignations());
+		Collections.sort(typeDesignations, AbstractUtility.getTypeDesignationComparator());
+		return typeDesignations;
 	}
 
 	/** {@inheritDoc} */
