fix #6047: add the possibility to the termComboElement that the idInVoc is used as...
authorKatja Luther <k.luther@bgbm.org>
Wed, 5 Oct 2016 12:52:40 +0000 (14:52 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 5 Oct 2016 12:52:40 +0000 (14:52 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java

index 65ba7e0192e100e2418a08c65901f691239e740c..c2f5a806fef4c5ae3996bae2492e8478bffbb5bf 100644 (file)
@@ -48,36 +48,43 @@ public class TermComboElement<T extends DefinedTermBase>
 
        private List<T> customPreferredTerms;
 
+       private boolean useAbbrevLabel = false;
        private boolean addEmptyElement;
 
        public TermComboElement(CdmFormFactory formFactory,
                        ICdmFormElement parentElement, TermType termType, String labelString, T selection, boolean addEmptyElement,
-                       int style) {
-               this(formFactory, parentElement, null, termType, null, labelString, selection, addEmptyElement, style);
+                       int style, boolean useAbbrevLabel) {
+               this(formFactory, parentElement, null, termType, null, labelString, selection, addEmptyElement, style, useAbbrevLabel);
        }
 
        public TermComboElement(CdmFormFactory formFactory,
                ICdmFormElement parentElement, TermVocabulary<?> termVocabulary, String labelString, T selection, boolean addEmptyElement,
                int style) {
-           this(formFactory, parentElement, null, null, termVocabulary, labelString, selection, addEmptyElement, style);
+           this(formFactory, parentElement, null, null, termVocabulary, labelString, selection, addEmptyElement, style, false);
        }
 
     public TermComboElement(CdmFormFactory formFactory,
             ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
             int style) {
-        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style);
+        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, false);
+    }
+    public TermComboElement(CdmFormFactory formFactory,
+            ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection, boolean addEmptyElement,
+            int style, boolean useAbbrevLabel) {
+        this(formFactory, parentElement, termClass, null, null, labelString, selection, addEmptyElement, style, useAbbrevLabel);
+       
     }
 
        private TermComboElement(CdmFormFactory formFactory,
                ICdmFormElement parentElement, Class<T> termClass, TermType termType, TermVocabulary<?> termVocabulary, String labelString, T selection, boolean addEmptyElement,
-               int style) {
+               int style, boolean useAbbrevLabel) {
         super(formFactory, parentElement);
 
         this.termType = termType;
         this.termVocabulary = termVocabulary;
         this.termClass = termClass;
         this.addEmptyElement = addEmptyElement;
-
+        this.useAbbrevLabel = useAbbrevLabel;
         if (labelString != null) {
             label.setText(labelString);
         }
@@ -225,7 +232,12 @@ public class TermComboElement<T extends DefinedTermBase>
                if (term == null){
                        return "";
                }else{
-                       String termLabel = term.getLabel(CdmStore.getDefaultLanguage());
+                       String termLabel = null;
+                       if (useAbbrevLabel){
+                               termLabel = term.getIdInVocabulary();
+                       }else{
+                               termLabel = term.getLabel(CdmStore.getDefaultLanguage());
+                       }
                        if (termLabel == null){
                            termLabel = term.getLabel();
                        }