int currentRowInfoIndex = -1;
TableContext tableContext = htmlDataTable.getTableContext();
RowInfo rowInfo = null;
ColumnInfo columnInfo = null;
HtmlSimpleColumn currentColumn = null;
Map groupHashTable = new HashMap();
if (rows <= 0) {
last = htmlDataTable.getRowCount();
}
else {
last = first + rows;
}
//Loop over the Children Columns to find the Columns with groupBy Attribute true
List children = getChildren(htmlDataTable);
int nChildren = getChildCount(htmlDataTable);
for (int j = 0, size = nChildren; j < size; j++) {
UIComponent child = (UIComponent) children.get(j);
if (child instanceof HtmlSimpleColumn) {
currentColumn = (HtmlSimpleColumn) child;
if (currentColumn.isGroupBy()) {
groupHashTable.put(new Integer(j), null);
}
}
}
boolean groupEndReached = false;
for (int rowIndex = first; last == -1 || rowIndex < last; rowIndex++) {
htmlDataTable.setRowIndex(rowIndex);
rowInfo = new RowInfo();
//scrolled past the last row
if (!htmlDataTable.isRowAvailable()) {
break;
}
Set groupIndexList = groupHashTable.keySet();
List currentColumnContent = null;
for (Iterator it = groupIndexList.iterator(); it.hasNext();) {
currentColumnContent = new ArrayList();
Integer currentIndex = (Integer) it.next();
currentColumn = (HtmlSimpleColumn) children.get(currentIndex.intValue());
if (currentColumn.isGroupByValueSet()) {
currentColumnContent.add(currentColumn.getGroupByValue());
}
else {
// iterate the children - this avoids to add the column facet too
List currentColumnChildren = currentColumn.getChildren();
if (currentColumnChildren != null) {
collectChildrenValues(currentColumnContent, currentColumnChildren.iterator());
}
}