List<HeaderCell> headerCells = tableModel.getHeaderCellList();
for (Iterator<HeaderCell> it = headerCells.iterator(); it.hasNext();)
{
HeaderCell cell = it.next();
Object cssClassObj = cell.getHtmlAttributes().get("class");
String cssClass = cssClassObj != null ? cssClassObj.toString() : StringUtils.EMPTY;
buffer.append("<td"); //$NON-NLS-1$
if (StringUtils.isNotEmpty(cssClass))
{
buffer.append(" class=\""); //$NON-NLS-1$
buffer.append(cssClass);
buffer.append("\""); //$NON-NLS-1$
}
buffer.append(">"); //$NON-NLS-1$
if (cell.isTotaled())
{
String totalPropertyName = cell.getBeanPropertyName();
Object total = grandTotal ? grandTotals.get(totalPropertyName) : subTotals.get(totalPropertyName);
DisplaytagColumnDecorator[] decorators = cell.getColumnDecorators();
for (int j = 0; j < decorators.length; j++)
{
try
{
total = decorators[j].decorate(total, this.getPageContext(), tableModel.getMedia());
}
catch (DecoratorException e)
{
log.warn(e.getMessage(), e);
// ignore, use undecorated value for totals
}
}
buffer.append(total);
}
else if (groupPropertyName != null && groupPropertyName.equals(cell.getBeanPropertyName()))
{
buffer.append(grandTotal ? totalLabel : new MessageFormat(subtotalLabel, this.tableModel
.getProperties()
.getLocale()).format(new Object[]{previousValues.get(groupPropertyName)}));
}