Iterator headerCellsIter = model.getHeaderCellList().iterator();
boolean hasReachedGroupEnd = false;
ArrayList structsForRow = new ArrayList(model.getHeaderCellList().size());
while (headerCellsIter.hasNext())
{
HeaderCell header = (HeaderCell) headerCellsIter.next();
// Get the value to be displayed for the column
CellStruct struct = (CellStruct) currentRowValues.get(new Integer(header.getColumnNumber()));
struct.decoratedValue = struct.bodyValue;
// Check and see if there is a grouping transition. If there is, then notify the decorator
if (header.getGroup() != -1)
{
CellStruct prior = (CellStruct) previousRowValues.get(new Integer(header.getColumnNumber()));
CellStruct next = (CellStruct) nextRowValues.get(new Integer(header.getColumnNumber()));
// Why npe?
String priorBodyValue = prior != null ? prior.bodyValue : null;
String nextBodyValue = next != null ? next.bodyValue : null;
short groupingValue = groupColumns(struct.bodyValue, priorBodyValue, nextBodyValue);
hasReachedGroupEnd = hasReachedGroupEnd
|| groupingValue == GROUP_END
|| groupingValue == GROUP_NO_CHANGE;
if (tableDecorator != null)
{
switch (groupingValue)
{
case GROUP_START :
tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
break;
case GROUP_END :
tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
break;
case GROUP_START_AND_END :
tableDecorator.startOfGroup(struct.bodyValue, header.getGroup());
tableDecorator.endOfGroup(struct.bodyValue, header.getGroup());
break;
default :
break;
}
}