diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/VocabularyTermModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/VocabularyTermModel.java index ea1492ba7669d08b8ad0a5d96e643c6454c9434b..63a26d85d08c6663d739e2cd40085aad2b96b314 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/VocabularyTermModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/VocabularyTermModel.java @@ -30,7 +30,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTerm; * * @author Izabela Adamczyk */ -public class VocabularyTermModel extends NonHierarchicalBaseModel implements Comparable<VocabularyTermModel> +public class VocabularyTermModel extends NonHierarchicalBaseModel implements + Comparable<VocabularyTermModel> { private static final String ORDINAL = "ordinal"; @@ -40,16 +41,11 @@ public class VocabularyTermModel extends NonHierarchicalBaseModel implements Com { set(ModelDataPropertyNames.CODE, term.getCode()); set(ORDINAL, term.getOrdinal()); - set(ModelDataPropertyNames.CODE_WITH_LABEL, getCodeWithLabel(term)); + set(ModelDataPropertyNames.CODE_WITH_LABEL, term.getCodeOrLabel()); set(ModelDataPropertyNames.TOOLTIP, VocabularyPropertyColRenderer.renderAsTooltip(term)); set(ModelDataPropertyNames.OBJECT, term); } - private String getCodeWithLabel(VocabularyTerm term) - { - return VocabularyPropertyColRenderer.renderCodeWithLabel(term); - } - public static final List<VocabularyTermModel> convert(List<VocabularyTerm> terms) { final ArrayList<VocabularyTermModel> list = new ArrayList<VocabularyTermModel>(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java index 8c6ee1ab249f5984177ed1be2eb264c664cb7bbe..103f80748f500f5a1f266921d444a9fce24ef9f3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/model/renderer/VocabularyPropertyColRenderer.java @@ -60,7 +60,7 @@ public class VocabularyPropertyColRenderer<T extends IEntityPropertiesHolder> ex final String description = term.getDescription(); final String url = term.getUrl(); - String result = renderCodeWithLabel(term); + String result = term.getCodeOrLabel(); if (url != null) { result = ExternalHyperlink.createAnchorString(result, url); @@ -70,11 +70,6 @@ public class VocabularyPropertyColRenderer<T extends IEntityPropertiesHolder> ex return result; } - public static final String renderCodeWithLabel(VocabularyTerm term) - { - return term.toString(); - } - public static final String renderAsTooltip(VocabularyTerm term) { final String code = term.getCode(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTerm.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTerm.java index 993d7ebcea6e01d44297877712dd938bd416e283..77fa0356a33fe3610884949fa980145d13862dd2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTerm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTerm.java @@ -94,6 +94,12 @@ public class VocabularyTerm extends CodeWithRegistration<Vocabulary> implements return label == null ? code : (code == null ? label : label + " [" + code + "]"); } + public String getCodeOrLabel() + { + String code = getCode(); + return label == null ? code : label; + } + public String getUrl() { return url;