- added sorting to generic configuration wizard page for imports
authorPatric Plitzner <p.plitzner@bgbm.org>
Wed, 21 Jan 2015 08:16:10 +0000 (08:16 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Wed, 21 Jan 2015 08:16:10 +0000 (08:16 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java

index 645ddbed9549232e8c55d0fa7c0444e506b8c205..7542acfcd5f0d8554cbdb5d99f476f82e41af4f7 100644 (file)
@@ -12,6 +12,8 @@ package eu.etaxonomy.taxeditor.io.wizard;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -130,6 +132,24 @@ public class GenericConfiguratorWizardPage extends WizardPage {
         composite.setLayout(gridLayout);
 
         List<Method> methods = getConfiguratorsBooleanSetMethods(configurator);
+        Collections.sort(methods, new Comparator<Method>() {
+            /* (non-Javadoc)
+             * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+             */
+            @Override
+            public int compare(Method o1, Method o2) {
+                if(o1.getName()==null && o2.getName()!=null){
+                    return -1;
+                }
+                if(o1.getName()!=null && o2.getName()==null){
+                    return 1;
+                }
+                if(o1.getName()==null && o2.getName()==null){
+                    return 0;
+                }
+                return o1.getName().compareTo(o2.getName());
+            }
+        });
 
         for (Method method : methods) {
             createCheckbox(composite, method, configurator);