}
public String getText(Object element) {
-
- if (element instanceof DefinedTermBase) {
- DefinedTermBase<?> dtb = (DefinedTermBase<?>) element;
-
- Representation rep = dtb.getRepresentation(PreferencesUtil.getGlobalLanguage());
- if ( rep == null){
- rep = dtb.getPreferredRepresentation(new ArrayList<Language>());
- }
- String label = rep != null? rep.getLabel() : dtb.getTitleCache();
- return CdmUtils.concat(" : ", dtb.getIdInVocabulary(), label);
-
- } else if (element instanceof TermBase) {
- return ((TermBase) element).getTitleCache();
- }
+ if(element instanceof TermBase){
+ TermBase termBase = (TermBase)element;
+ Representation rep = termBase.getRepresentation(PreferencesUtil.getGlobalLanguage());
+ if (rep == null){
+ rep = termBase.getPreferredRepresentation(new ArrayList<Language>());
+ }
+ String label = rep != null? rep.getLabel() : termBase.getTitleCache();
+ if (element instanceof DefinedTermBase) {
+ DefinedTermBase<?> dtb = (DefinedTermBase<?>) element;
+ return CdmUtils.concat(" : ", dtb.getIdInVocabulary(), label);
+
+ } else {
+ return label;
+ }
+ }
// FIXME : must throw an exception here
return element.toString();