ref #8749: sort elements of vocabulary combo
authorKatja Luther <k.luther@bgbm.org>
Fri, 6 Dec 2019 12:27:35 +0000 (13:27 +0100)
committerKatja Luther <k.luther@bgbm.org>
Fri, 6 Dec 2019 12:27:35 +0000 (13:27 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java

index f5184ba34d577ed2d0bb4d76cc4a7238ecfca742..2cc7b1f194cc62ba73a882086f79421a94b3c2a7 100644 (file)
@@ -119,6 +119,19 @@ public class VocabularyComboElement<TERM extends DefinedTermBase<TERM>, VOC exte
 
                if (vocComparator != null) {
                        Collections.sort(preferredTerms, vocComparator);
+               }else{
+                   Collections.sort(preferredTerms, new Comparator<VOC>() {
+
+                @Override
+                public int compare(VOC o1, VOC o2) {
+                    if (o1.equals(o2)){
+                        return 0;
+                    }
+                    int result = ((TermVocabulary) o1).getTitleCache().compareTo(((TermVocabulary)o2).getTitleCache());
+
+                    return result;
+                }
+            });
                }
                for (VOC term : preferredTerms) {
                        String label = getLabel(term);