From 79d06d0fbf697cbd509e959f46ee6c1c82db545b Mon Sep 17 00:00:00 2001 From: Katja Luther Date: Wed, 5 Oct 2016 14:52:40 +0200 Subject: [PATCH] fix #6047: add the possibility to the termComboElement that the idInVoc is used as label --- .../taxeditor/ui/combo/TermComboElement.java | 26 ++++++++++++++----- 1 file changed, 19 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 65ba7e019..c2f5a806f 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 @@ -48,36 +48,43 @@ public class TermComboElement private List 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 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 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 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 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(); } -- 2.34.1