Revision e1055895
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java | ||
---|---|---|
49 | 49 |
public void setTermComparator(Comparator<T> termComparator) { |
50 | 50 |
this.termComparator = termComparator; |
51 | 51 |
List<T> termsWithoutNull = terms.subList(1, terms.size()); |
52 |
|
|
52 |
|
|
53 | 53 |
populateTerms(termsWithoutNull); |
54 |
|
|
54 |
|
|
55 | 55 |
} |
56 | 56 |
|
57 | 57 |
private final TermType termType; |
... | ... | |
181 | 181 |
if (termComparator != null) { |
182 | 182 |
Collections.sort(preferredTerms, termComparator); |
183 | 183 |
} |
184 |
terms.addAll(preferredTerms); |
|
185 |
|
|
186 |
List<String> labels = new ArrayList<>(); |
|
184 | 187 |
for (T term : preferredTerms) { |
185 | 188 |
String label = getLabel(term); |
186 | 189 |
if (label == null) { |
... | ... | |
198 | 201 |
|
199 | 202 |
} |
200 | 203 |
|
201 |
combo.add(label); |
|
202 |
terms.add(term); |
|
204 |
labels.add(label); |
|
203 | 205 |
|
204 | 206 |
i++; |
205 | 207 |
if (selection != null) { |
... | ... | |
209 | 211 |
} |
210 | 212 |
} |
211 | 213 |
|
212 |
if (selection != null && index == 0) { |
|
214 |
String[] items = labels.toArray(new String[0]); |
|
215 |
combo.setItems(items); |
|
216 |
|
|
217 |
if (selection != null && index == 0) { |
|
213 | 218 |
createTermNotInPreferredTerms(selection); |
214 | 219 |
} |
215 | 220 |
|
216 | 221 |
combo.select(index); |
222 |
|
|
217 | 223 |
} |
218 | 224 |
|
219 | 225 |
protected List<T> getPreferredTerms(){ |
Also available in: Unified diff
ref #7040 Replace Combo with CCombo which renders faster