protected void renderChildren( FacesContext context, ResponseWriter writer, UIComponent component, int columns) throws IOException { String rowClasses; if (component instanceof HtmlPanelGrid) { rowClasses = ((HtmlPanelGrid) component).getRowClasses(); } else { rowClasses = (String) component.getAttributes().get(JSFAttr.ROW_CLASSES_ATTR); } String[] rowClassesArray = (rowClasses == null) ? org.apache.myfaces.shared_tomahawk.util.ArrayUtils.EMPTY_STRING_ARRAY : StringUtils.trim(StringUtils.splitShortString(rowClasses, ',')); int rowClassesCount = rowClassesArray.length; int childCount = getChildCount(component); if (childCount > 0) { int columnIndex = 0; int rowClassIndex = 0; boolean rowStarted = false; for (Iterator it = getChildren(component).iterator(); it.hasNext(); ) { UIComponent child = (UIComponent) it.next(); if (child.isRendered()) { if (columnIndex == 0) { // start of new/next row if (rowStarted) { // do we have to close the last row? writer.endElement(HTML.LI_ELEM); HtmlRendererUtils.writePrettyLineSeparator(context); } writer.startElement(HTML.LI_ELEM, component); if (rowClassIndex < rowClassesCount) { writer.writeAttribute(HTML.CLASS_ATTR, rowClassesArray[rowClassIndex], null); } rowStarted = true; rowClassIndex++; if (rowClassIndex == rowClassesCount) { rowClassIndex = 0; } } RendererUtils.renderChild(context, child); columnIndex++; if (columnIndex >= columns) { columnIndex = 0; } } } if (rowStarted) { writer.endElement(HTML.LI_ELEM); HtmlRendererUtils.writePrettyLineSeparator(context); } } }