public void encodeChildrenOfComponent(FacesContext facesContext, UIComponent component)
throws IOException {
// encode table with component's children
UIGridLayout layout = (UIGridLayout) UILayout.getLayout(component);
HtmlRendererUtil.prepareRender(facesContext, layout);
layoutEnd(facesContext, layout);
layoutMargins(layout);
final Map attributes = layout.getAttributes();
List columnWidths = (List) attributes.get(ATTR_WIDTH_LIST);
TobagoResponseWriter writer = HtmlRendererUtil.getTobagoResponseWriter(facesContext);
writer.startElement(HtmlConstants.TABLE, layout);
writer.writeAttributeFromComponent(HtmlAttributes.BORDER, ATTR_BORDER);
writer.writeClassAttribute();
writer.writeStyleAttribute();
writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
writer.writeAttribute(HtmlAttributes.CELLPADDING, 0);
writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);
if (columnWidths != null) {
writer.startElement(HtmlConstants.COLGROUP, null);
for (int i = 0; i < columnWidths.size(); i++) {
int cellWidth = ((Integer) columnWidths.get(i)).intValue();
if (cellWidth != LayoutInfo.HIDE) {
cellWidth += getCellPadding(facesContext, layout, i);
writer.startElement(HtmlConstants.COL, null);
writer.writeAttribute(HtmlAttributes.WIDTH, cellWidth);
writer.endElement(HtmlConstants.COL);
}
}
writer.endElement(HtmlConstants.COLGROUP);
}
List<UIGridLayout.Row> rows = layout.ensureRows();
for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) {
UIGridLayout.Row row = rows.get(rowIndex);
if (!row.isHidden()) {
writer.startElement(HtmlConstants.TR, null);
List cells = row.getElements();
for (int columnIndex = 0; columnIndex < cells.size(); columnIndex++) {
boolean hide = false;
if (columnWidths != null) {
Integer columWidth = ((Integer) columnWidths.get(columnIndex));
hide = columWidth.intValue() == LayoutInfo.HIDE;
}
if (!hide) {
Object object = cells.get(columnIndex);
if (object.toString().equals(UIGridLayout.USED)) {
continue; // ignore the markers UIGridLayout.Used
}
if (object.equals(UIGridLayout.FREE)) {
if (LOG.isWarnEnabled() && !layout.isIgnoreFree()) {
LOG.warn("There are free blocks in the layout: id='"
+ layout.getClientId(facesContext)
+ "'");
}
continue;
}
UIComponent cell = (UIComponent) object;