Skip to content
Snippets Groups Projects
Commit 0552cc59 authored by buczekp's avatar buczekp
Browse files

SE-248 don't render vocabulary term code together with label in browsers and combo boxes

SVN: 16155
parent 8c9ab851
No related branches found
No related tags found
No related merge requests found
......@@ -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>();
......
......@@ -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();
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment