Project

General

Profile

« Previous | Next » 

Revision a2dad66e

Added by Patrick Plitzner over 9 years ago

  • added sorting to generic configuration wizard page for imports

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/GenericConfiguratorWizardPage.java
12 12

  
13 13
import java.lang.reflect.Method;
14 14
import java.util.ArrayList;
15
import java.util.Collections;
16
import java.util.Comparator;
15 17
import java.util.List;
16 18
import java.util.MissingResourceException;
17 19
import java.util.ResourceBundle;
......
130 132
        composite.setLayout(gridLayout);
131 133

  
132 134
        List<Method> methods = getConfiguratorsBooleanSetMethods(configurator);
135
        Collections.sort(methods, new Comparator<Method>() {
136
            /* (non-Javadoc)
137
             * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
138
             */
139
            @Override
140
            public int compare(Method o1, Method o2) {
141
                if(o1.getName()==null && o2.getName()!=null){
142
                    return -1;
143
                }
144
                if(o1.getName()!=null && o2.getName()==null){
145
                    return 1;
146
                }
147
                if(o1.getName()==null && o2.getName()==null){
148
                    return 0;
149
                }
150
                return o1.getName().compareTo(o2.getName());
151
            }
152
        });
133 153

  
134 154
        for (Method method : methods) {
135 155
            createCheckbox(composite, method, configurator);

Also available in: Unified diff