From 5b396e7e7e8e80b5bc5b9fa937a63707f27f3a6d Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Wed, 25 Nov 2009 08:28:32 +0000 Subject: [PATCH] Fix bug in VocabularyTerm rendering. Code duplication refactored SVN: 13524 --- .../model/renderer/VocabularyPropertyColRenderer.java | 10 +--------- .../generic/shared/basic/dto/VocabularyTerm.java | 9 ++------- 2 files changed, 3 insertions(+), 16 deletions(-) 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 d9ef2448dfd..8c6ee1ab249 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 @@ -72,15 +72,7 @@ public class VocabularyPropertyColRenderer<T extends IEntityPropertiesHolder> ex public static final String renderCodeWithLabel(VocabularyTerm term) { - final String code = term.getCode(); - final String label = term.getLabel(); - if (label == null) - { - return code; - } else - { - return label + " [" + code + "]"; - } + return term.toString(); } public static final String renderAsTooltip(VocabularyTerm term) 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 afa220fc3aa..e092178f319 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 @@ -84,13 +84,8 @@ public final class VocabularyTerm extends CodeWithRegistration<Vocabulary> imple @Override public String toString() { - if (label == null) - { - return getCode(); - } else - { - return label + " [" + getCode() + "]"; - } + String code = getCode(); + return label == null ? code : (code == null ? label : label + " [" + code + "]"); } public String getUrl() -- GitLab