classesBuilder.append(sortedStyle);
}
appendExtraStyles(prevHeader, classesBuilder);
// Render the header.
TableCellBuilder th =
tr.startTH().colSpan(prevColspan).className(classesBuilder.toString());
enableColumnHandlers(th, column);
if (prevHeader != null) {
// Build the header.
Context context = new Context(0, curColumn - prevColspan, prevHeader.getKey());
renderSortableHeader(th, context, prevHeader, isSorted, isSortAscending);
}
th.endTH();
// Reset the previous header.
prevHeader = header;
prevColspan = 1;
classesBuilder = new StringBuilder(className);
isSortable = false;
isSorted = false;
} else {
// Increment the colspan if the headers == each other.
prevColspan++;
}
// Update the sorted state.
column = table.getColumn(curColumn);
if (!isFooter && column.isSortable()) {
isSortable = true;
isSorted = (column == sortedColumn);
}
}
// Append the last header.
if (isSortable) {
classesBuilder.append(sortableStyle);
}
if (isSorted) {
classesBuilder.append(sortedStyle);
}
// The first and last columns could be the same column.
classesBuilder.append(" ").append(
isFooter ? style.lastColumnFooter() : style.lastColumnHeader());
appendExtraStyles(prevHeader, classesBuilder);
// Render the last header.
TableCellBuilder th = tr.startTH().colSpan(prevColspan).className(classesBuilder.toString());
enableColumnHandlers(th, column);
if (prevHeader != null) {
Context context = new Context(0, curColumn - prevColspan, prevHeader.getKey());
renderSortableHeader(th, context, prevHeader, isSorted, isSortAscending);
}
th.endTH();
// End the row.
tr.endTR();
return true;