Revision 882600fb
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermSorter.java | ||
---|---|---|
44 | 44 |
else if(e1 instanceof TermDto && e2 instanceof TermDto) { |
45 | 45 |
TermDto termDto1 = (TermDto)e1; |
46 | 46 |
TermDto termDto2 = (TermDto)e2; |
47 |
if(termDto1.getOrderIndex() == termDto2.getOrderIndex()) { |
|
48 |
return 0; |
|
49 |
} else if (termDto1.getOrderIndex() < termDto2.getOrderIndex()){ |
|
47 |
if(termDto1.getOrderIndex()!=null){ |
|
48 |
if(termDto2.getOrderIndex()!=null){ |
|
49 |
return termDto1.getOrderIndex() - termDto2.getOrderIndex(); |
|
50 |
} |
|
51 |
else{ |
|
52 |
return 1; |
|
53 |
} |
|
54 |
} |
|
55 |
else if(termDto2.getOrderIndex()!=null){ |
|
50 | 56 |
return -1; |
51 |
} else{ |
|
52 |
return 1; |
|
57 |
} |
|
58 |
else{ |
|
59 |
// order index are equal or null -> compare by label |
|
60 |
termDto1.localize(new TermRepresentation_L10n()); |
|
61 |
termDto2.localize(new TermRepresentation_L10n()); |
|
62 |
if(termDto1.getRepresentation_L10n()!=null){ |
|
63 |
if(termDto2.getRepresentation_L10n()!=null) { |
|
64 |
return termDto1.getRepresentation_L10n().compareTo(termDto2.getRepresentation_L10n()); |
|
65 |
} |
|
66 |
else{ |
|
67 |
return 1; |
|
68 |
} |
|
69 |
} |
|
70 |
else if(termDto2.getRepresentation_L10n()!=null){ |
|
71 |
return -1; |
|
72 |
} |
|
53 | 73 |
} |
54 | 74 |
} |
55 | 75 |
else if(e1 instanceof TermVocabularyDto && e2 instanceof TermVocabularyDto) { |
Also available in: Unified diff
Sort terms in term editor by label when no order index is given