int i = 1;
int index = 0;
- if(addEmptyElement){
- // Add an empty element for when nothing was selected yet
- combo.add(EMPTY_ELEMENT_LABEL);
- terms.add(emptyElement);
- }
-
if (termComparator != null) {
Collections.sort(preferredTerms, termComparator);
}
String[] items = labels.toArray(new String[0]);
combo.setItems(items);
-
+
+ if(addEmptyElement){
+ // Add an empty element for when nothing was selected yet
+ combo.add(EMPTY_ELEMENT_LABEL, 0);
+ terms.add(0, emptyElement);
+ }
+
if (selection != null && index == 0) {
createTermNotInPreferredTerms(selection);
}