// iterator on columns for header
Iterator iterator = this.tableModel.getHeaderCellList().iterator();
while (iterator.hasNext()) {
// get the header cell
HeaderCell headerCell = (HeaderCell) iterator.next();
if (headerCell.getSortable()) {
String cssSortable = this.properties.getCssSortable();
headerCell.addHeaderClass(cssSortable);
}
// if sorted add styles
if (headerCell.isAlreadySorted()) {
// sorted css class
headerCell.addHeaderClass(this.properties.getCssSorted());
// sort order css class
headerCell.addHeaderClass(this.properties.getCssOrder(this.tableModel.isSortOrderAscending()));
}
// append th with html attributes
write(headerCell.getHeaderOpenTag());
// title
String header = headerCell.getTitle();
// column is sortable, create link
if (headerCell.getSortable()) {
// creates the link for sorting
Anchor anchor = new Anchor(getSortingHref(headerCell), header);
// append to buffer
header = anchor.toString();
}
write(header);
write(headerCell.getHeaderCloseTag());
}
// close tr
write(TagConstants.TAG_TR_CLOSE);