public class PanelGridRenderer extends org.primefaces.component.panelgrid.PanelGridRenderer {
@Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
ResponseWriter writer = context.getResponseWriter();
PanelGrid grid = (PanelGrid) component;
String clientId = grid.getClientId(context);
int columns = grid.getColumns();
if(columns == 0) {
columns = 1;
}
String gridClass = MobileUtils.GRID_MAP.get(columns);
String style = grid.getStyle();
String styleClass = grid.getStyleClass();
styleClass = (styleClass == null) ? gridClass : gridClass + " " + styleClass;
writer.startElement("div", grid);
writer.writeAttribute("id", clientId, "id");
writer.writeAttribute("class", styleClass, "styleClass");
if(style != null) {
writer.writeAttribute("style", style, "style");
}
int i = 0;
for(UIComponent child : grid.getChildren()) {
if(child.isRendered()) {
int blockKey = (i % columns);
String blockClass = MobileUtils.BLOCK_MAP.get(blockKey);
writer.startElement("div", null);
writer.writeAttribute("class", blockClass, null);