#5202 Added alphabetical sort for cdm instances list
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 14 Sep 2015 15:01:36 +0000 (17:01 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 14 Sep 2015 15:01:36 +0000 (17:01 +0200)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java

index e599f2a0e38dedb04f920bfea8c6ab4d1eef5c87..03f8f0b7c9fcda3df6ce97140f4ec350ee442d1d 100644 (file)
@@ -12,6 +12,8 @@ package eu.etaxonomy.taxeditor.remoting.source;
 import java.io.IOException;
 import java.net.Socket;
 import java.util.ArrayList;
 import java.io.IOException;
 import java.net.Socket;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import org.apache.http.HttpEntity;
 import java.util.List;
 
 import org.apache.http.HttpEntity;
@@ -97,7 +99,13 @@ public class CdmServerInfo {
         } else {
             addInstancesViaHttp();
         }
         } else {
             addInstancesViaHttp();
         }
-
+        Collections.sort(instances, new Comparator<CdmInstanceInfo>() {
+            @Override
+            public int compare(CdmInstanceInfo cii1, CdmInstanceInfo cii2)
+            {
+                return cii1.getName().toString().compareTo(cii2.getName().toString());
+            }
+        });
     }
 
     public void addInstancesViaHttp() throws CDMServerException {
     }
 
     public void addInstancesViaHttp() throws CDMServerException {