/** * For collection dynamic attributes the method returns a list of formatted collection items joined with the comma, * for non-collection dynamic attribute a formatted value is returned. * * @see DynamicAttributesTools#getDynamicAttributeValueAsString(MetaProperty, Object) */ public static String getDynamicAttributeValueAsString(MetaProperty metaProperty, Object value) { return AppBeans.get(DynamicAttributesTools.NAME, DynamicAttributesTools.class) .getDynamicAttributeValueAsString(metaProperty, value); } }
@Override public Object generateCell(com.vaadin.v7.ui.Table source, Object itemId, Object columnId) { Property property = source.getItem(itemId).getItemProperty(columnId); Object value = property.getValue(); if (value == null) { return null; } String stringValue = value.toString(); if (columnId instanceof MetaPropertyPath) { MetaProperty metaProperty = ((MetaPropertyPath) columnId).getMetaProperty(); if (DynamicAttributesUtils.isDynamicAttribute(metaProperty)) { stringValue = dynamicAttributesTools.getDynamicAttributeValueAsString(metaProperty, value); } } String cellValue = stringValue; boolean isMultiLineCell = StringUtils.contains(stringValue, "\n"); if (isMultiLineCell) { cellValue = StringUtils.replaceChars(cellValue, '\n', ' '); } int maxTextLength = column.getMaxTextLength(); if (stringValue.length() > maxTextLength + MAX_TEXT_LENGTH_GAP || isMultiLineCell) { return StringUtils.abbreviate(cellValue, maxTextLength); } else { return cellValue; } } }
} else { if (DynamicAttributesUtils.isDynamicAttribute(propertyPath.getMetaProperty())) { stringValue = dynamicAttributesTools.getDynamicAttributeValueAsString(propertyPath.getMetaProperty(), value); } else { stringValue = value == null ? null : value.toString();
return dynamicAttributesTools.getDynamicAttributeValueAsString(property, value);
if (DynamicAttributesUtils.isDynamicAttribute(columnId)) { metaProperty = dynamicAttributesTools.getMetaPropertyPath(item.getMetaClass(), columnId).getMetaProperty(); value = dynamicAttributesTools.getDynamicAttributeValueAsString(metaProperty, item.getValueEx(columnId)); } else { value = item.getValueEx(columnId);