Merge branch 'release/5.32.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / combo / term / TermComboElement.java
index f182217d6c039484e636941984329afa332da554..48c31aae77adf63a798427d452fecad3932a042b 100755 (executable)
@@ -161,6 +161,7 @@ public class TermComboElement<T extends DefinedTermBase>
 
        protected void addTerms(List<T> preferredTerms) {
                terms = new ArrayList<T>();
+               Collections.sort(preferredTerms, termComparator);
                if(addEmptyElement){
                    // Add an empty element for when nothing was selected yet
                    combo.add(EMPTY_ELEMENT_LABEL);
@@ -303,11 +304,13 @@ public class TermComboElement<T extends DefinedTermBase>
 //                 terms.add(emptyElement);
                }
                List<T> withoutNull = new ArrayList<>(terms);
+               
                if (termComparator != null) {
                        if (addEmptyElement){
                                withoutNull = terms.subList(1, terms.size());
                        }
-                       Collections.sort(withoutNull, termComparator);
+//                     Collections.sort(withoutNull, termComparator);          
+                       
                }
                for (T term : withoutNull) {
                        String label = getLabel(term);
@@ -416,6 +419,7 @@ public class TermComboElement<T extends DefinedTermBase>
        @Override
     public void widgetSelected(SelectionEvent e) {
            if (e.getSource().equals(combo) && combo.getSelectionIndex() >= 0){
+               int index = combo.getSelectionIndex();
                selection = terms.get(combo.getSelectionIndex());
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
            }