ref #8047: show symbol and label in drop down of distribution editor
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / checklist / e4 / StatusHelper.java
1 /**
2 * Copyright (C) 2019 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9 package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
10
11 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
12 import eu.etaxonomy.cdm.model.metadata.TermDisplayEnum;
13 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
14
15 /**
16 * @author k.luther
17 * @since 27.05.2019
18 *
19 */
20 public class StatusHelper {
21 PresenceAbsenceTerm term;
22 String label;
23
24 public StatusHelper(PresenceAbsenceTerm term){
25 this.term = term;
26 TermDisplayEnum display = TermDisplayEnum.valueOf(PreferencesUtil.displayStatusInChecklistEditor());
27 if (display.equals(TermDisplayEnum.IdInVocabulary) && term.getIdInVocabulary() != null){
28 label = "[" + term.getIdInVocabulary()+ "] " + term.getTitleCache();
29 }else if (display.equals(TermDisplayEnum.Symbol1) && term.getSymbol() != null){
30 label = "[" + term.getSymbol()+ "] " + term.getTitleCache();
31 } else if (display.equals(TermDisplayEnum.Symbol2) && term.getSymbol2() != null){
32 label = "[" + term.getSymbol2()+ "] " + term.getTitleCache();
33 } else{
34 label = term.getTitleCache();
35 }
36 }
37 @Override
38 public String toString(){
39 return label;
40 }
41
42 }