public String getGroupPropertyPath() { return groupInfo.getProperty().toString(); } }
@Override public Object getGroupProperty(GroupInfo groupId) { if (containsGroup(groupId)) { return groupId.getProperty(); } return null; }
public Object getGroupProperty(GroupInfo groupId) { if (containsGroup(groupId)) { return groupId.getProperty(); } return null; }
protected void doGroupSort(CollectionDatasource.Sortable.SortInfo<MetaPropertyPath>[] sortInfo) { if (hasGroups()) { MetaPropertyPath propertyPath = sortInfo[0].getPropertyPath(); boolean asc = CollectionDatasource.Sortable.Order.ASC.equals(sortInfo[0].getOrder()); int index = ArrayUtils.indexOf(groupProperties, propertyPath); if (index > -1) { if (index == 0) { // Sort roots roots.sort(new GroupInfoComparator(asc)); } else { Object parentProperty = groupProperties[index - 1]; for (Map.Entry<GroupInfo, List<GroupInfo>> entry : children.entrySet()) { Object property = entry.getKey().getProperty(); if (property.equals(parentProperty)) { entry.getValue().sort(new GroupInfoComparator(asc)); } } } } else { Set<GroupInfo> groups = parents.keySet(); for (GroupInfo groupInfo : groups) { List<K> items = groupItems.get(groupInfo); if (items != null) { items.sort(new EntityByIdComparator<>(propertyPath, datasource, asc)); } } } } }
Object parentProperty = groupProperties[index - 1]; for (Map.Entry<GroupInfo, List<GroupInfo>> entry : children.entrySet()) { Object property = entry.getKey().getProperty(); if (property.equals(parentProperty)) { entry.getValue().sort(new GroupInfoComparator(asc));
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 && column.getXmlDescriptor() != null) { String captionProperty = column.getXmlDescriptor().attributeValue("captionProperty"); // vaadin8 move to Column if (column.getFormatter() != null) { return column.getFormatter().apply(value); } else 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()); }