From e37a5839400f9f7ddfc429420de3178288ab872f Mon Sep 17 00:00:00 2001
From: Patrick Plitzner
Date: Thu, 2 Nov 2017 14:56:39 +0100
Subject: [PATCH] ref #7040 Fix addition of empty element in combos
---
.../taxeditor/ui/combo/TermComboElement.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
index d5dee1d87..7bd6f3b71 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
@@ -172,12 +172,6 @@ public class TermComboElement
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);
}
@@ -213,7 +207,13 @@ public class TermComboElement
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);
}
--
2.34.1