use of org.knime.workbench.repository.model.AbstractRepositoryObject in project knime-core by knime.
the class RepositoryStyledLabelProvider method update.
@Override
public void update(final ViewerCell cell) {
Object obj = cell.getElement();
if (obj instanceof IRepositoryObject) {
StyledString styledString = new StyledString(m_provider.getText(obj));
if (m_appendCategory) {
// receive the category string.
String categoryString = getCategoryString((IRepositoryObject) obj);
if (!categoryString.isEmpty()) {
styledString.append(String.format("\t - %s", categoryString), StyledString.DECORATIONS_STYLER);
}
}
if (m_appendAdditionalInfoKeys.length > 0) {
if (obj instanceof AbstractRepositoryObject) {
AbstractRepositoryObject aro = (AbstractRepositoryObject) obj;
for (String key : m_appendAdditionalInfoKeys) {
if (aro.getAdditionalInfo(key) != null) {
styledString.append(String.format("\t [%s]", ((AbstractRepositoryObject) obj).getAdditionalInfo(key)), StyledString.QUALIFIER_STYLER);
}
}
}
}
cell.setText(styledString.toString());
cell.setStyleRanges(styledString.getStyleRanges());
} else {
cell.setText(m_provider.getText(obj));
}
cell.setImage(m_provider.getImage(obj));
}
Aggregations