Project

General

Profile

« Previous | Next » 

Revision b32cbeab

Added by Katja Luther over 6 years ago

fix #6918: use comparator in rank combobox if sortRankHierarchically is set

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
42 42

  
43 43
	private Comparator<T> termComparator;
44 44

  
45
	public Comparator<T> getTermComparator() {
46
		return termComparator;
47
	}
48

  
49
	public void setTermComparator(Comparator<T> termComparator) {
50
		this.termComparator = termComparator;
51
		List<T> termsWithoutNull = terms.subList(1, terms.size());
52
		
53
		populateTerms(termsWithoutNull);
54
		
55
	}
56

  
45 57
	private final TermType termType;
46 58
	private final TermVocabulary termVocabulary;
47 59
	private final Class<T> termClass;
......
53 65

  
54 66
	public TermComboElement(CdmFormFactory formFactory,
55 67
			ICdmFormElement parentElement, TermType termType, String labelString, T selection, boolean addEmptyElement,
56
			int style, boolean useAbbrevLabel) {
57
		this(formFactory, parentElement, null, termType, null, labelString, selection, addEmptyElement, style, useAbbrevLabel);
68
			int style, boolean useAbbrevLabel, Comparator<T> comparator) {
69
		this(formFactory, parentElement, null, termType, null, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
58 70
	}
59 71

  
60 72
	public TermComboElement(CdmFormFactory formFactory,
61 73
	        ICdmFormElement parentElement, TermVocabulary<?> termVocabulary, String labelString, T selection, boolean addEmptyElement,
62
	        int style, boolean useAbbrevLabel) {
63
	    this(formFactory, parentElement, null, null, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel);
74
	        int style, boolean useAbbrevLabel, Comparator<T> comparator) {
75
	    this(formFactory, parentElement, null, null, termVocabulary, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
64 76
	}
65 77

  
66 78
    public TermComboElement(CdmFormFactory formFactory,
67 79
            ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
68 80
            int style) {
69
        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, false);
81
        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, false, null);
70 82
    }
71 83
    public TermComboElement(CdmFormFactory formFactory,
72 84
            ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
73 85
            int style, boolean useAbbrevLabel) {
74
        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, useAbbrevLabel);
86
        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, useAbbrevLabel, null);
75 87

  
76 88
    }
77 89

  
78 90
	private TermComboElement(CdmFormFactory formFactory,
79 91
	        ICdmFormElement parentElement, Class<T> termClass, TermType termType, TermVocabulary<?> termVocabulary, String labelString, T selection, boolean addEmptyElement,
80
	        int style, boolean useAbbrevLabel) {
92
	        int style, boolean useAbbrevLabel, Comparator<T> comparator) {
81 93
        super(formFactory, parentElement);
82 94

  
83 95
        this.termType = termType;
......
85 97
        this.termClass = termClass;
86 98
        this.addEmptyElement = addEmptyElement;
87 99
        this.useAbbrevLabel = useAbbrevLabel;
100
        this.termComparator = comparator;
88 101
        if (labelString != null) {
89 102
            label.setText(labelString);
90 103
        }

Also available in: Unified diff