Fixed compiler warnings / simplified code

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@709217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-10-30 17:56:34 +00:00
parent 4fb4965629
commit eb933eeb8f
1 changed files with 22 additions and 23 deletions

View File

@ -321,39 +321,38 @@ public final class RowRecordsAggregate extends RecordAggregate {
return currentRow-1; return currentRow-1;
} }
public int writeHidden( RowRecord rowRecord, int row, boolean hidden ) /**
{ * Hide all rows at or below the current outline level
* @return index of the <em>next<em> row after the last row that gets hidden
*/
private int writeHidden(RowRecord pRowRecord, int row) {
int rowIx = row;
RowRecord rowRecord = pRowRecord;
int level = rowRecord.getOutlineLevel(); int level = rowRecord.getOutlineLevel();
while (rowRecord != null && this.getRow(row).getOutlineLevel() >= level) while (rowRecord != null && getRow(rowIx).getOutlineLevel() >= level) {
{ rowRecord.setZeroHeight(true);
rowRecord.setZeroHeight( hidden ); rowIx++;
row++; rowRecord = getRow(rowIx);
rowRecord = this.getRow( row );
} }
return row - 1; return rowIx;
} }
public void collapseRow( int rowNumber ) public void collapseRow(int rowNumber) {
{
// Find the start of the group. // Find the start of the group.
int startRow = findStartOfRowOutlineGroup( rowNumber ); int startRow = findStartOfRowOutlineGroup(rowNumber);
RowRecord rowRecord = getRow( startRow ); RowRecord rowRecord = getRow(startRow);
// Hide all the columns until the end of the group // Hide all the columns until the end of the group
int lastRow = writeHidden( rowRecord, startRow, true ); int nextRowIx = writeHidden(rowRecord, startRow);
RowRecord row = getRow(nextRowIx);
if (row == null) {
row = createRow(nextRowIx);
insertRow(row);
}
// Write collapse field // Write collapse field
if (getRow(lastRow + 1) != null) row.setColapsed(true);
{
getRow(lastRow + 1).setColapsed( true );
}
else
{
RowRecord row = createRow( lastRow + 1);
row.setColapsed( true );
insertRow( row );
}
} }
/** /**