From 4d0724878f197288815a111bea9f4812dc60629a Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Tue, 24 Nov 2015 07:53:17 +0000 Subject: [PATCH] whitespace git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1716051 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/usermodel/HSSFSheet.java | 10 +- .../org/apache/poi/ss/usermodel/Sheet.java | 12 +- .../apache/poi/xssf/streaming/SXSSFSheet.java | 8 +- .../apache/poi/xssf/usermodel/XSSFSheet.java | 136 +++++++++--------- .../poi/xssf/streaming/TestSXSSFSheet.java | 6 +- .../poi/hssf/usermodel/TestHSSFSheet.java | 32 ++--- 6 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index 83003a7366..0a6c0c432a 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -221,17 +221,17 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet { } } if (log.check( POILogger.DEBUG )) { - if (cval instanceof Record) { + if (cval instanceof Record) { log.log( DEBUG, "record id = " + Integer.toHexString( ( (Record) cval ).getSid() ) ); - } else { - log.log( DEBUG, "record = " + cval ); - } + } else { + log.log( DEBUG, "record = " + cval ); + } } hrow.createCellFromRecord( cval ); if (log.check( POILogger.DEBUG )) { log.log( DEBUG, "record took ", Long.valueOf( System.currentTimeMillis() - cellstart ) ); - } + } } if (log.check( POILogger.DEBUG )) { diff --git a/src/java/org/apache/poi/ss/usermodel/Sheet.java b/src/java/org/apache/poi/ss/usermodel/Sheet.java index 14548bc89d..db03057e65 100644 --- a/src/java/org/apache/poi/ss/usermodel/Sheet.java +++ b/src/java/org/apache/poi/ss/usermodel/Sheet.java @@ -970,17 +970,17 @@ public interface Sheet extends Iterable { public DataValidationHelper getDataValidationHelper(); - /** + /** * Returns the list of DataValidation in the sheet. * @return list of DataValidation in the sheet */ public List getDataValidations(); - /** - * Creates a data validation object - * @param dataValidation The Data validation object settings - */ - public void addValidationData(DataValidation dataValidation); + /** + * Creates a data validation object + * @param dataValidation The Data validation object settings + */ + public void addValidationData(DataValidation dataValidation); /** * Enable filtering for a range of cells diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index 70a4f7f20a..d6eea5ca61 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -1233,8 +1233,8 @@ public class SXSSFSheet implements Sheet, Cloneable private void collapseRow(int rowIndex) { SXSSFRow row = getRow(rowIndex); if(row == null) { - throw new IllegalArgumentException("Invalid row number("+ rowIndex + "). Row does not exist."); - } else { + throw new IllegalArgumentException("Invalid row number("+ rowIndex + "). Row does not exist."); + } else { int startRow = findStartOfRowOutlineGroup(rowIndex); // Hide all the columns until the end of the group @@ -1254,10 +1254,10 @@ public class SXSSFSheet implements Sheet, Cloneable */ private int findStartOfRowOutlineGroup(int rowIndex) { // Find the start of the group. - Row row = getRow(rowIndex); + Row row = getRow(rowIndex); int level = ((SXSSFRow) row).getOutlineLevel(); if(level == 0) { - throw new IllegalArgumentException("Outline level is zero for the row (" + rowIndex + ")."); + throw new IllegalArgumentException("Outline level is zero for the row (" + rowIndex + ")."); } int currentRow = rowIndex; while (getRow(currentRow) != null) { diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index 7ffe736014..379a675bba 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -2801,9 +2801,9 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { @Override @SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support public void shiftRows(int startRow, int endRow, final int n, boolean copyRowHeight, boolean resetOriginalRowHeight) { - XSSFVMLDrawing vml = getVMLDrawing(false); + XSSFVMLDrawing vml = getVMLDrawing(false); - // first remove all rows which will be overwritten + // first remove all rows which will be overwritten for (Iterator it = rowIterator() ; it.hasNext() ; ) { XSSFRow row = (XSSFRow)it.next(); int rownum = row.getRowNum(); @@ -2822,14 +2822,14 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { if(sheetComments != null){ CTCommentList lst = sheetComments.getCTComments().getCommentList(); for (CTComment comment : lst.getCommentArray()) { - String strRef = comment.getRef(); - CellAddress ref = new CellAddress(strRef); + String strRef = comment.getRef(); + CellAddress ref = new CellAddress(strRef); - // is this comment part of the current row? - if(ref.getRow() == rownum) { + // is this comment part of the current row? + if(ref.getRow() == rownum) { sheetComments.removeComment(ref); vml.removeCommentShape(ref.getRow(), ref.getColumn()); - } + } } } // FIXME: (performance optimization) this should be moved outside the for-loop so that hyperlinks only needs to be iterated over once. @@ -2849,25 +2849,25 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { // we need to sort it in a way so the shifting does not mess up the structures, // i.e. when shifting down, start from down and go up, when shifting up, vice-versa SortedMap commentsToShift = new TreeMap(new Comparator() { - public int compare(XSSFComment o1, XSSFComment o2) { - int row1 = o1.getRow(); - int row2 = o2.getRow(); - - if(row1 == row2) { - // ordering is not important when row is equal, but don't return zero to still - // get multiple comments per row into the map - return o1.hashCode() - o2.hashCode(); - } - - // when shifting down, sort higher row-values first - if(n > 0) { - return row1 < row2 ? 1 : -1; - } else { - // sort lower-row values first when shifting up - return row1 > row2 ? 1 : -1; - } - } - }); + public int compare(XSSFComment o1, XSSFComment o2) { + int row1 = o1.getRow(); + int row2 = o2.getRow(); + + if(row1 == row2) { + // ordering is not important when row is equal, but don't return zero to still + // get multiple comments per row into the map + return o1.hashCode() - o2.hashCode(); + } + + // when shifting down, sort higher row-values first + if(n > 0) { + return row1 < row2 ? 1 : -1; + } else { + // sort lower-row values first when shifting up + return row1 > row2 ? 1 : -1; + } + } + }); for (Iterator it = rowIterator() ; it.hasNext() ; ) { @@ -2875,26 +2875,26 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { int rownum = row.getRowNum(); if(sheetComments != null){ - // calculate the new rownum - int newrownum = shiftedRowNum(startRow, endRow, n, rownum); - - // is there a change necessary for the current row? - if(newrownum != rownum) { + // calculate the new rownum + int newrownum = shiftedRowNum(startRow, endRow, n, rownum); + + // is there a change necessary for the current row? + if(newrownum != rownum) { CTCommentList lst = sheetComments.getCTComments().getCommentList(); for (CTComment comment : lst.getCommentArray()) { - String oldRef = comment.getRef(); - CellReference ref = new CellReference(oldRef); - - // is this comment part of the current row? - if(ref.getRow() == rownum) { - XSSFComment xssfComment = new XSSFComment(sheetComments, comment, + String oldRef = comment.getRef(); + CellReference ref = new CellReference(oldRef); + + // is this comment part of the current row? + if(ref.getRow() == rownum) { + XSSFComment xssfComment = new XSSFComment(sheetComments, comment, vml == null ? null : vml.findCommentShape(rownum, ref.getCol())); - - // we should not perform the shifting right here as we would then find - // already shifted comments and would shift them again... - commentsToShift.put(xssfComment, newrownum); + + // we should not perform the shifting right here as we would then find + // already shifted comments and would shift them again... + commentsToShift.put(xssfComment, newrownum); } - } + } } } @@ -2911,7 +2911,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { // the Map is sorted and thus provides them in the order that we need here, // i.e. from down to up if shifting down, vice-versa otherwise for(Map.Entry entry : commentsToShift.entrySet()) { - entry.getKey().setRow(entry.getValue()); + entry.getKey().setRow(entry.getValue()); } XSSFRowShifter rowShifter = new XSSFRowShifter(this); @@ -2936,31 +2936,31 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { } private int shiftedRowNum(int startRow, int endRow, int n, int rownum) { - // no change if before any affected row - if(rownum < startRow && (n > 0 || (startRow - rownum) > n)) { - return rownum; - } - - // no change if after any affected row - if(rownum > endRow && (n < 0 || (rownum - endRow) > n)) { - return rownum; - } - - // row before and things are moved up - if(rownum < startRow) { - // row is moved down by the shifting - return rownum + (endRow - startRow); - } - - // row is after and things are moved down - if(rownum > endRow) { - // row is moved up by the shifting - return rownum - (endRow - startRow); - } - - // row is part of the shifted block - return rownum + n; - } + // no change if before any affected row + if(rownum < startRow && (n > 0 || (startRow - rownum) > n)) { + return rownum; + } + + // no change if after any affected row + if(rownum > endRow && (n < 0 || (rownum - endRow) > n)) { + return rownum; + } + + // row before and things are moved up + if(rownum < startRow) { + // row is moved down by the shifting + return rownum + (endRow - startRow); + } + + // row is after and things are moved down + if(rownum > endRow) { + // row is moved up by the shifting + return rownum - (endRow - startRow); + } + + // row is part of the shifted block + return rownum + n; + } /** * Location of the top left visible cell Location of the top left visible cell in the bottom right diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java index a5da399371..52f4a8692e 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java @@ -92,9 +92,9 @@ public class TestSXSSFSheet extends BaseTestSheet { @Test public void getCellComment() throws IOException { - // TODO: reading cell comments via Sheet does not work currently as it tries - // to access the underlying sheet for this, but comments are stored as - // properties on Cells... + // TODO: reading cell comments via Sheet does not work currently as it tries + // to access the underlying sheet for this, but comments are stored as + // properties on Cells... } @Override diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index fed4bc5466..d21930b471 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -119,7 +119,7 @@ public final class TestHSSFSheet extends BaseTestSheet { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet s = wb.createSheet(); GridsetRecord gridsetRec = s.getSheet().getGridsetRecord(); - assertTrue(gridsetRec.getGridset()); + assertTrue(gridsetRec.getGridset()); s.setGridsPrinted(true); assertFalse(gridsetRec.getGridset()); wb.close(); @@ -535,28 +535,28 @@ public final class TestHSSFSheet extends BaseTestSheet { // verify limits try { - sheet.setZoom(0, 2); - fail("Should catch Exception here"); + sheet.setZoom(0, 2); + fail("Should catch Exception here"); } catch (IllegalArgumentException e) { - assertEquals("Numerator must be greater than 0 and less than 65536", e.getMessage()); + assertEquals("Numerator must be greater than 0 and less than 65536", e.getMessage()); } try { - sheet.setZoom(65536, 2); - fail("Should catch Exception here"); + sheet.setZoom(65536, 2); + fail("Should catch Exception here"); } catch (IllegalArgumentException e) { - assertEquals("Numerator must be greater than 0 and less than 65536", e.getMessage()); + assertEquals("Numerator must be greater than 0 and less than 65536", e.getMessage()); } try { - sheet.setZoom(2, 0); - fail("Should catch Exception here"); + sheet.setZoom(2, 0); + fail("Should catch Exception here"); } catch (IllegalArgumentException e) { - assertEquals("Denominator must be greater than 0 and less than 65536", e.getMessage()); + assertEquals("Denominator must be greater than 0 and less than 65536", e.getMessage()); } try { - sheet.setZoom(2, 65536); - fail("Should catch Exception here"); + sheet.setZoom(2, 65536); + fail("Should catch Exception here"); } catch (IllegalArgumentException e) { - assertEquals("Denominator must be greater than 0 and less than 65536", e.getMessage()); + assertEquals("Denominator must be greater than 0 and less than 65536", e.getMessage()); } wb.close(); @@ -652,7 +652,7 @@ public final class TestHSSFSheet extends BaseTestSheet { } @Test - public void autoSizeColumn() throws IOException { + public void autoSizeColumn() throws IOException { HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("43902.xls"); String sheetName = "my sheet"; HSSFSheet sheet = wb1.getSheet(sheetName); @@ -1161,8 +1161,8 @@ public final class TestHSSFSheet extends BaseTestSheet { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Maximum row number is 65535"); - sheet.showInPane(Integer.MAX_VALUE, 3); - wb.close(); + sheet.showInPane(Integer.MAX_VALUE, 3); + wb.close(); } @Test -- 2.39.5