Project

General

Profile

« Previous | Next » 

Revision a59c4b04

Added by Patrick Plitzner about 5 years ago

Sort terms in term editor by label when order index is zero

View differences:

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
            int orderIndexCompare = 0;
47 48
            if(termDto1.getOrderIndex()!=null){
48 49
                if(termDto2.getOrderIndex()!=null){
49
                    return termDto1.getOrderIndex() - termDto2.getOrderIndex();
50
                    orderIndexCompare =   termDto1.getOrderIndex() - termDto2.getOrderIndex();
50 51
                }
51 52
                else{
52
                    return 1;
53
                    orderIndexCompare = 1;
53 54
                }
54 55
            }
55 56
            else if(termDto2.getOrderIndex()!=null){
56
                return -1;
57
                orderIndexCompare = -1;
57 58
            }
58
            else{
59
            if(orderIndexCompare == 0){
59 60
                // order index are equal or null -> compare by label
60 61
                termDto1.localize(new TermRepresentation_L10n());
61 62
                termDto2.localize(new TermRepresentation_L10n());

Also available in: Unified diff