}
private void buildGui() {
final EntityModel entityModel = (EntityModel) getModel();
final ColumnSpans columnSpans = entityModel.getObject().getSpecification().getFacet(MemberGroupLayoutFacet.class).getColumnSpans();
renderedFirstField = false;
// left column
MarkupContainer leftColumn = new WebMarkupContainer(ID_LEFT_COLUMN);
add(leftColumn);
boolean addedProperties;
if(columnSpans.getLeft() > 0) {
addedProperties = addPropertiesInColumn(leftColumn, MemberGroupLayoutHint.LEFT, columnSpans);
addButtons(leftColumn);
addFeedbackGui(leftColumn);
} else {
Components.permanentlyHide(this, ID_LEFT_COLUMN);
addedProperties = false;
}
if(!addedProperties) {
// a bit hacky...
Components.permanentlyHide(this,
ID_EDIT_BUTTON, ID_OK_BUTTON, ID_CANCEL_BUTTON,
ID_FEEDBACK);
}
// middle column
if(columnSpans.getMiddle() > 0) {
MarkupContainer middleColumn = new WebMarkupContainer(ID_MIDDLE_COLUMN);
add(middleColumn);
addPropertiesInColumn(middleColumn, MemberGroupLayoutHint.MIDDLE, columnSpans);
} else {
Components.permanentlyHide(this, ID_MIDDLE_COLUMN);
}
// right column
if(columnSpans.getRight() > 0) {
MarkupContainer rightColumn = new WebMarkupContainer(ID_RIGHT_COLUMN);
add(rightColumn);
addPropertiesInColumn(rightColumn, MemberGroupLayoutHint.RIGHT, columnSpans);
} else {
Components.permanentlyHide(this, ID_RIGHT_COLUMN);
}
// collections
if(columnSpans.getCollections() > 0) {
final String idCollectionsToShow;
final String idCollectionsToHide;
int collectionSpan;
if (columnSpans.exceedsRow()) {
idCollectionsToShow = ID_ENTITY_COLLECTIONS_OVERFLOW;
idCollectionsToHide = ID_ENTITY_COLLECTIONS;
collectionSpan = 12;
} else {
idCollectionsToShow = ID_ENTITY_COLLECTIONS;
idCollectionsToHide = ID_ENTITY_COLLECTIONS_OVERFLOW;
collectionSpan = columnSpans.getCollections();
}
final Component collectionsColumn = getComponentFactoryRegistry().addOrReplaceComponent(this, idCollectionsToShow, ComponentType.ENTITY_COLLECTIONS, entityModel);
addClassForSpan(collectionsColumn, collectionSpan);