Project

General

Profile

« Previous | Next » 

Revision 49f7b066

Added by Patrick Plitzner over 5 years ago

ref #7887 Sort vocabularies in term editor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermSorter.java
14 14

  
15 15
import eu.etaxonomy.cdm.model.common.OrderedTermBase;
16 16
import eu.etaxonomy.cdm.persistence.dto.TermDto;
17
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
18
import eu.etaxonomy.cdm.remote.l10n.TermRepresentation_L10n;
17 19

  
18 20
/**
19 21
 * @author pplitzner
......
50 52
                return 1;
51 53
            }
52 54
        }
53
        else {
54
            return super.compare(viewer, e1, e2);
55
        else if(e1 instanceof TermVocabularyDto && e2 instanceof TermVocabularyDto) {
56
            TermVocabularyDto termVoc1 = (TermVocabularyDto)e1;
57
            TermVocabularyDto termVoc2 = (TermVocabularyDto)e2;
58
            termVoc1.localize(new TermRepresentation_L10n());
59
            termVoc2.localize(new TermRepresentation_L10n());
60
            if(termVoc1.getRepresentation_L10n()!=null){
61
                if(termVoc2.getRepresentation_L10n()!=null) {
62
                    return termVoc1.getRepresentation_L10n().compareTo(termVoc2.getRepresentation_L10n());
63
                }
64
                else{
65
                    return 1;
66
                }
67
            }
68
            else if(termVoc2.getRepresentation_L10n()!=null){
69
                return -1;
70
            }
55 71
        }
72
        return super.compare(viewer, e1, e2);
56 73
    }
57 74
}

Also available in: Unified diff