Revision bfbad836
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import java.util.ArrayList; |
13 | 13 |
import java.util.Arrays; |
14 |
import java.util.HashMap; |
|
14 | 15 |
import java.util.HashSet; |
15 | 16 |
import java.util.List; |
16 | 17 |
import java.util.Set; |
... | ... | |
31 | 32 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
32 | 33 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
33 | 34 |
import eu.etaxonomy.cdm.model.common.Language; |
35 |
import eu.etaxonomy.cdm.model.common.OrderedTermComparator; |
|
34 | 36 |
import eu.etaxonomy.cdm.model.common.TermIdInVocabularyComparator; |
35 | 37 |
import eu.etaxonomy.cdm.model.common.TermLanguageComparator; |
38 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
36 | 39 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
37 | 40 |
import eu.etaxonomy.cdm.model.description.Distribution; |
38 | 41 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
... | ... | |
136 | 139 |
}else{ |
137 | 140 |
area = distribution.getArea().getTitleCache(); |
138 | 141 |
} |
139 |
|
|
142 |
|
|
140 | 143 |
}else{ |
141 | 144 |
continue; |
142 | 145 |
} |
... | ... | |
166 | 169 |
|
167 | 170 |
private SortedSet<DefinedTermBase> loadNamedAreas() { |
168 | 171 |
IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore(); |
172 |
|
|
169 | 173 |
String values = preferenceStore.getString(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS); |
170 | 174 |
|
171 | 175 |
if (values != null && values != "") { //$NON-NLS-1$ |
... | ... | |
181 | 185 |
} |
182 | 186 |
ITermService service = CdmStore.getService(ITermService.class); |
183 | 187 |
termlist = service.find(uuidList); |
184 |
if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ |
|
188 |
if (PreferencesUtil.isSortNamedAreaByOrderInVocabulary()){ |
|
189 |
return getTermsOrderedByVocabularyOrder(termlist); |
|
190 |
} else if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ |
|
185 | 191 |
return getTermsOrderedByIdInVocabulary(termlist); |
186 |
} else {
|
|
192 |
}else{
|
|
187 | 193 |
return getTermsOrderedByLabels(termlist, CdmStore.getDefaultLanguage()); |
188 | 194 |
} |
189 | 195 |
} |
... | ... | |
200 | 206 |
return result; |
201 | 207 |
} |
202 | 208 |
|
209 |
public SortedSet<DefinedTermBase> getTermsOrderedByVocabularyOrder(List<DefinedTermBase> listAreas){ |
|
210 |
HashMap<TermVocabulary<DefinedTermBase>, List<DefinedTermBase>> vocs = new HashMap<>(); |
|
211 |
OrderedTermComparator<?> comp = new OrderedTermComparator<>(); |
|
212 |
|
|
213 |
SortedSet<DefinedTermBase> result = new TreeSet(comp.reversed()); |
|
214 |
result.addAll(listAreas); |
|
215 |
|
|
216 |
return result; |
|
217 |
} |
|
218 |
|
|
203 | 219 |
/** |
204 | 220 |
* @return the namedAreas |
205 | 221 |
*/ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java | ||
---|---|---|
84 | 84 |
PreferencesUtil.setShowIdInVocabularyInChecklistEditor(isShowIdInVocabulary); |
85 | 85 |
} |
86 | 86 |
}); |
87 |
|
|
87 |
|
|
88 | 88 |
final Button showSymbol = new Button(child, SWT.CHECK); |
89 | 89 |
boolean isShowSymbol = PreferencesUtil.isShowSymbolInChecklistEditor(); |
90 | 90 |
showSymbol.setText("Show Symbol of the Status, if existing"); |
... | ... | |
108 | 108 |
PreferencesUtil.setShowRankInChecklistEditor(isShowRank); |
109 | 109 |
} |
110 | 110 |
}); |
111 |
|
|
111 |
final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK); |
|
112 |
boolean isSortByVocabularyOrder = PreferencesUtil.isSortNamedAreaByOrderInVocabulary(); |
|
113 |
sortNamedAreaByVocabularyOrder.setText("Sort Areas by Order in Vocabulary"); |
|
114 |
sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder); |
|
115 |
sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){ |
|
116 |
@Override |
|
117 |
public void widgetSelected(SelectionEvent e) { |
|
118 |
boolean isSortByVocabularyOrder = sortNamedAreaByVocabularyOrder.getSelection(); |
|
119 |
PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder); |
|
120 |
} |
|
121 |
}); |
|
112 | 122 |
|
113 | 123 |
if(isEditorActivated){ |
114 | 124 |
child.setEnabled(true); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java | ||
---|---|---|
207 | 207 |
public static final String ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN= "eu.etaxonomy.taxeditor.abcd_import_configurator.overwriteExistingSpecimens"; |
208 | 208 |
public static final String ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR = "eu.etaxonomy.taxeditor.abcd_import_configurator.defaultAuthor"; |
209 | 209 |
public static final String ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID = "eu.etaxonomy.taxeditor.abcd_import_configurator.classificationUuid"; |
210 |
public static final String ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.abcd_import_configurator.nomenclaturalCode"; |
|
210 | 211 |
public static final String ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG = "eu.etaxonomy.taxeditor.abcd_import_configurator.allowOverride"; |
211 | 212 |
|
212 | 213 |
|
... | ... | |
220 | 221 |
public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia"; |
221 | 222 |
public static final String SHOW_MEDIA_PREVIEW = "eu.etaxonomy.taxeditor.media.showMediaPreview"; |
222 | 223 |
public static final String SORT_TAXA_BY_RANK_AND_NAME = "eu.etaxonomy.taxeditor.selection.taxa.sortByRankAndName"; |
224 |
public static final String SORT_NAMED_AREA_BY_VOCABULARY_ORDER = "eu.etaxonomy.taxeditor.distribution.namedArea.sortByVocabularyOrder"; |
|
225 |
|
|
223 | 226 |
|
224 | 227 |
|
225 | 228 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | ||
---|---|---|
1166 | 1166 |
config.setReuseExistingDescriptiveGroups(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS)); |
1167 | 1167 |
config.setReuseExistingMetaData(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA)); |
1168 | 1168 |
config.setReuseExistingTaxaWhenPossible(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE)); |
1169 |
config.setNomenclaturalCode(NomenclaturalCode.getByKey(PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE))); |
|
1169 | 1170 |
return config; |
1170 | 1171 |
|
1171 | 1172 |
} |
... | ... | |
1300 | 1301 |
return getPreferenceStore().getBoolean(IPreferenceKeys.SORT_TAXA_BY_RANK_AND_NAME); |
1301 | 1302 |
} |
1302 | 1303 |
|
1304 |
/** |
|
1305 |
* @return |
|
1306 |
*/ |
|
1307 |
public static boolean isSortNamedAreaByOrderInVocabulary() { |
|
1308 |
|
|
1309 |
return getPreferenceStore().getBoolean(IPreferenceKeys.SORT_NAMED_AREA_BY_VOCABULARY_ORDER); |
|
1310 |
} |
|
1311 |
|
|
1312 |
public static void setSortNamedAreasByOrderInVocabulary(boolean isSortByVocabularyOrder) { |
|
1313 |
getPreferenceStore().setValue(IPreferenceKeys.SORT_NAMED_AREA_BY_VOCABULARY_ORDER, isSortByVocabularyOrder); |
|
1314 |
|
|
1315 |
} |
|
1316 |
|
|
1303 | 1317 |
|
1304 | 1318 |
|
1305 | 1319 |
} |
Also available in: Unified diff
ref #7234: add possibility to sort named areas by vocabulary order in distribution editor