1 |
278a5e0a
|
Katja Luther
|
/**
|
2 |
|
|
* Copyright (C) 2018 EDIT
|
3 |
|
|
* European Distributed Institute of Taxonomy
|
4 |
|
|
* http://www.e-taxonomy.eu
|
5 |
|
|
*
|
6 |
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7 |
|
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8 |
|
|
*/
|
9 |
|
|
package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
|
10 |
|
|
|
11 |
|
|
import java.util.ArrayList;
|
12 |
|
|
import java.util.Collection;
|
13 |
|
|
import java.util.Collections;
|
14 |
|
|
import java.util.Comparator;
|
15 |
|
|
import java.util.List;
|
16 |
|
|
|
17 |
|
|
import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
|
18 |
|
|
|
19 |
|
|
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
|
20 |
|
|
import eu.etaxonomy.cdm.model.common.OrderedTermComparator;
|
21 |
|
|
import eu.etaxonomy.cdm.model.common.Representation;
|
22 |
|
|
import eu.etaxonomy.cdm.model.common.TermType;
|
23 |
|
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
24 |
|
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
25 |
|
|
|
26 |
|
|
/**
|
27 |
|
|
* @author k.luther
|
28 |
|
|
* @since 05.12.2018
|
29 |
|
|
*
|
30 |
|
|
*/
|
31 |
|
|
public class StatusComboBoxDataProvider implements IComboBoxDataProvider {
|
32 |
|
|
|
33 |
|
|
private DistributionEditor editor;
|
34 |
|
|
private int maxVisibleItems;
|
35 |
|
|
|
36 |
|
|
public StatusComboBoxDataProvider(DistributionEditor editor) {
|
37 |
|
|
super();
|
38 |
|
|
this.editor = editor;
|
39 |
ec6c94b9
|
Katja Luther
|
|
40 |
278a5e0a
|
Katja Luther
|
}
|
41 |
|
|
|
42 |
|
|
@Override
|
43 |
|
|
public List<?> getValues(int columnIndex, int rowIndex) {
|
44 |
|
|
return getValues();
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
public static List<?> getValues(){
|
48 |
|
|
List<DefinedTermBase> inputAll = new ArrayList<>();
|
49 |
|
|
PresenceAbsenceTerm noneTerm = PresenceAbsenceTerm.NewInstance();
|
50 |
ec6c94b9
|
Katja Luther
|
noneTerm.setTitleCache(" - ", true);
|
51 |
|
|
noneTerm.addRepresentation(Representation.NewInstance(" - ", "", "", CdmStore.getDefaultLanguage()));
|
52 |
278a5e0a
|
Katja Luther
|
inputAll.add(noneTerm);
|
53 |
|
|
Collection<DefinedTermBase> input = CdmStore.getTermManager().getPreferredTerms(TermType.PresenceAbsenceTerm);
|
54 |
|
|
List<DefinedTermBase> inputList = new ArrayList(input);
|
55 |
|
|
Comparator<DefinedTermBase> comp = new OrderedTermComparator<>();
|
56 |
|
|
Collections.sort(inputList, comp);
|
57 |
|
|
Collections.sort(inputList, Collections.reverseOrder());
|
58 |
|
|
|
59 |
|
|
inputAll.addAll(1, inputList);
|
60 |
|
|
return inputAll;
|
61 |
|
|
}
|
62 |
|
|
|
63 |
|
|
public int getMaxVisibleItems(){
|
64 |
|
|
return maxVisibleItems;
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
}
|