elementType.getAssociations(Filters.and(STATICALLY_VISIBLE_ASSOCIATIONS, PROPERTIES));
final int len = columnAssociations.size();
final ComponentFactory factory = context.getComponentFactory();
final Table table = factory.createTable(len, addSelector);
table.setSummary(summary);
for (final ObjectAssociation columnAssociation : columnAssociations) {
table.addColumnHeader(columnAssociation.getName());
}
for (final ObjectAdapter rowAdapter : facet.iterable(collection)) {
getPersistenceSession().resolveImmediately(rowAdapter);
final String elementId = context.mapObject(rowAdapter);
table.addRowHeader(factory.createObjectIcon(rowAdapter, elementId, "icon"));
for (final ObjectAssociation columnAssociation : columnAssociations) {
final ObjectAdapter columnAdapter = columnAssociation.get(rowAdapter);
final ObjectSpecification columnSpec = columnAssociation.getSpecification();
if (!columnAssociation.isVisible(getAuthenticationSession(), rowAdapter).isAllowed()) {
table.addEmptyCell();
} else if (columnSpec.isParseable()) {
final MultiLineFacet multiline = columnSpec.getFacet(MultiLineFacet.class);
final boolean shouldTruncate = multiline != null && multiline.numberOfLines() > 1;
final String titleString = columnAdapter != null ? columnAdapter.titleString() : "";
table.addCell(titleString, shouldTruncate);
} else if (columnAdapter == null) {
table.addEmptyCell();
} else {
getPersistenceSession().resolveImmediately(columnAdapter);
final String objectId = context.mapObject(columnAdapter);
table.addCell(factory.createObjectIcon(columnAssociation, columnAdapter, objectId, "icon"));
}
}
/*
* if (addSelector) { table.addCell(context.getFactory().createRemoveOption(id, elementId,
* collectionField.getId())); }