poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r709217 - /poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
Date Thu, 30 Oct 2008 17:56:36 GMT
Author: josh
Date: Thu Oct 30 10:56:34 2008
New Revision: 709217

URL: http://svn.apache.org/viewvc?rev=709217&view=rev
Log:
Fixed compiler warnings / simplified code

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java?rev=709217&r1=709216&r2=709217&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/aggregates/RowRecordsAggregate.java Thu
Oct 30 10:56:34 2008
@@ -321,39 +321,38 @@
         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();
-        while (rowRecord != null && this.getRow(row).getOutlineLevel() >= level)
-        {
-            rowRecord.setZeroHeight( hidden );
-            row++;
-            rowRecord = this.getRow( row );
+        while (rowRecord != null && getRow(rowIx).getOutlineLevel() >= level)
{
+            rowRecord.setZeroHeight(true);
+            rowIx++;
+            rowRecord = getRow(rowIx);
         }
-        return row - 1;
+        return rowIx;
     }
 
-    public void collapseRow( int rowNumber )
-    {
+    public void collapseRow(int rowNumber) {
 
         // Find the start of the group.
-        int startRow = findStartOfRowOutlineGroup( rowNumber );
-        RowRecord rowRecord = getRow( startRow );
+        int startRow = findStartOfRowOutlineGroup(rowNumber);
+        RowRecord rowRecord = getRow(startRow);
 
         // Hide all the columns until the end of the group
-        int lastRow = writeHidden( rowRecord, startRow, true );
+        int nextRowIx = writeHidden(rowRecord, startRow);
 
-        // Write collapse field
-        if (getRow(lastRow + 1) != null)
-        {
-            getRow(lastRow + 1).setColapsed( true );
-        }
-        else
-        {
-            RowRecord row = createRow( lastRow + 1);
-            row.setColapsed( true );
-            insertRow( row );
+        RowRecord row = getRow(nextRowIx);
+        if (row == null) {
+            row = createRow(nextRowIx);
+            insertRow(row);
         }
+        // Write collapse field
+        row.setColapsed(true);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message