use of io.jmix.ui.model.KeyValueCollectionContainer in project jmix by jmix-framework.
the class ShowReportTableScreen method drawTables.
protected void drawTables(JmixTableData dto) {
Map<String, List<KeyValueEntity>> data = dto.getData();
Map<String, Set<JmixTableData.ColumnInfo>> headerMap = dto.getHeaders();
tablesVBoxLayout.removeAll();
if (data == null || data.isEmpty())
return;
data.forEach((dataSetName, keyValueEntities) -> {
if (CollectionUtils.isNotEmpty(keyValueEntities)) {
KeyValueCollectionContainer container = createContainer(dataSetName, keyValueEntities, headerMap);
Table table = createTable(dataSetName, container, headerMap);
GroupBoxLayout groupBox = uiComponents.create(GroupBoxLayout.class);
groupBox.setCaption(dataSetName);
groupBox.add(table);
groupBox.expand(table);
tablesVBoxLayout.add(groupBox);
tablesVBoxLayout.expand(groupBox);
}
});
}
use of io.jmix.ui.model.KeyValueCollectionContainer in project jmix by jmix-framework.
the class ShowReportTableScreen method createContainer.
protected KeyValueCollectionContainer createContainer(String dataSetName, List<KeyValueEntity> keyValueEntities, Map<String, Set<JmixTableData.ColumnInfo>> headerMap) {
KeyValueCollectionContainer collectionContainer = dataComponents.createKeyValueCollectionContainer();
collectionContainer.setIdName(dataSetName + "Dc");
collectionContainer.setItems(keyValueEntities);
Set<JmixTableData.ColumnInfo> columnInfos = headerMap.get(dataSetName);
columnInfos.forEach(columnInfo -> {
Class javaClass = columnInfo.getColumnClass();
if (Entity.class.isAssignableFrom(javaClass) || EnumClass.class.isAssignableFrom(javaClass) || datatypeRegistry.find(javaClass) != null) {
collectionContainer.addProperty(columnInfo.getKey(), javaClass);
}
});
return collectionContainer;
}
Aggregations