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/section/name/NameDetailElement.java
11 11

  
12 12
import java.util.Arrays;
13 13
import java.util.Collection;
14
import java.util.Comparator;
14 15

  
15 16
import org.apache.log4j.Logger;
16 17
import org.eclipse.swt.SWT;
......
77 78
	/** {@inheritDoc} */
78 79
	@Override
79 80
	protected void createControls(ICdmFormElement formElement, INonViralName nonViralName, int style) {
81
		Comparator<Rank> comparator = null;
82
		if(PreferencesUtil.getSortRanksHierarchichally()){
83
			comparator = new Comparator<Rank>(){
80 84

  
85
			@Override
86
			public int compare(Rank o1, Rank o2) {
87
				return o2.compareTo(o1);
88
			}
89

  
90
		};
91
		}
81 92
	    if (isAdvancedView){
82 93
	    	toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
83
	    	combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
94
	    	
95
	    	combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style, comparator);
84 96
	    	createGenusOrUninomialControls(this, nonViralName, style);
85 97
            createInfragenerericEpithetControls(this, nonViralName, style);
86 98
            createSpecificEpithetControls(this, nonViralName, style);
......
93 105
        	}
94 106

  
95 107
    	    if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK)){
96
    	        combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
108
    	        combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style, comparator);
97 109
    	    }
98 110

  
99 111
    		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS)){

Also available in: Unified diff