writer.endElement("th");
int columnIndex = 0;
for(UIComponent child : sheet.getChildren()) {
if(child instanceof Column && child.isRendered()) {
Column column = (Column) child;
boolean sortable = column.getValueExpression("sortBy") != null;
String style = column.getStyle();
String styleClass = column.getStyleClass();
styleClass = styleClass == null ? Sheet.CELL_CLASS : Sheet.CELL_CLASS + " " + styleClass;
String columnHeaderClass = sortable ? Sheet.COLUMN_HEADER_CLASS + " " + Sheet.SORTABLE_COLUMN : Sheet.COLUMN_HEADER_CLASS;
writer.startElement("th", null);
writer.writeAttribute("id", column.getClientId(context), style);
writer.writeAttribute("class", columnHeaderClass, null);
writer.startElement("div", null);
writer.writeAttribute("class", styleClass, null);
if(style != null) {
writer.writeAttribute("style", style, null);
}
if(sortable) {
writer.startElement("span", null);
writer.writeAttribute("class", Sheet.SORTABLE_COLUMN_ICON, null);
writer.endElement("span");
}
writer.write(Sheet.LETTERS[columnIndex]);
writer.endElement("th");
columnIndex++;
}
}
writer.endElement("tr");
writer.endElement("thead");
//frozen headers
writer.startElement("tbody", null);
writer.startElement("tr", null);
writer.writeAttribute("class", Sheet.ROW_CLASS, null);
//index column header
writer.startElement("td", null);
writer.writeAttribute("class", Sheet.COLUMN_HEADER_CLASS, null);
writer.startElement("div", null);
writer.writeAttribute("class", Sheet.INDEX_CELL_CLASS, null);
writer.write("1");
writer.endElement("div");
writer.endElement("td");
for(UIComponent child : sheet.getChildren()) {
if(child instanceof Column && child.isRendered()) {
Column column = (Column) child;
String style = column.getStyle();
String styleClass = column.getStyleClass();
styleClass = styleClass == null ? Sheet.CELL_CLASS : Sheet.CELL_CLASS + " " + styleClass;
writer.startElement("td", null);
writer.startElement("div", null);
writer.writeAttribute("class", styleClass, null);
if(style != null) {
writer.writeAttribute("style", style, null);
}
if(column.getHeader() != null) {
column.getHeader().encodeAll(context);
} else if(column.getHeaderText() != null) {
writer.write(column.getHeaderText());
}
writer.endElement("div");
writer.endElement("td");