use of com.haulmont.cuba.web.gui.components.table.TableDataContainer in project cuba by cuba-platform.
the class WebGroupTable method formatGroupPropertyValue.
protected String formatGroupPropertyValue(GroupInfo<MetaPropertyPath> groupId, @Nullable Object value) {
if (value == null) {
return "";
}
MetaPropertyPath propertyPath = groupId.getProperty();
Table.Column<E> column = columns.get(propertyPath);
if (column != null) {
if (column.getFormatter() != null) {
return column.getFormatter().apply(value);
} else if (column.getXmlDescriptor() != null) {
// vaadin8 move to Column
String captionProperty = column.getXmlDescriptor().attributeValue("captionProperty");
if (StringUtils.isNotEmpty(captionProperty)) {
Collection<?> children = component.getGroupItemIds(groupId);
if (children.isEmpty()) {
return null;
}
Object itemId = children.iterator().next();
TableDataContainer container = (TableDataContainer) component.getContainerDataSource();
Instance item = (Instance) container.getInternalItem(itemId);
Object captionValue = item.getValueEx(captionProperty);
// vaadin8 use metadataTools format with metaproperty
return metadataTools.format(captionValue);
}
}
}
return metadataTools.format(value, propertyPath.getMetaProperty());
}
Aggregations