whitespace

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1716051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2015-11-24 07:53:17 +00:00
parent 8eabc4710a
commit e7d29ad533
6 changed files with 101 additions and 101 deletions

View File

@ -221,17 +221,17 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
} }
} }
if (log.check( POILogger.DEBUG )) { if (log.check( POILogger.DEBUG )) {
if (cval instanceof Record) { if (cval instanceof Record) {
log.log( DEBUG, "record id = " + Integer.toHexString( ( (Record) cval ).getSid() ) ); log.log( DEBUG, "record id = " + Integer.toHexString( ( (Record) cval ).getSid() ) );
} else { } else {
log.log( DEBUG, "record = " + cval ); log.log( DEBUG, "record = " + cval );
} }
} }
hrow.createCellFromRecord( cval ); hrow.createCellFromRecord( cval );
if (log.check( POILogger.DEBUG )) { if (log.check( POILogger.DEBUG )) {
log.log( DEBUG, "record took ", log.log( DEBUG, "record took ",
Long.valueOf( System.currentTimeMillis() - cellstart ) ); Long.valueOf( System.currentTimeMillis() - cellstart ) );
} }
} }
if (log.check( POILogger.DEBUG )) { if (log.check( POILogger.DEBUG )) {

View File

@ -970,17 +970,17 @@ public interface Sheet extends Iterable<Row> {
public DataValidationHelper getDataValidationHelper(); public DataValidationHelper getDataValidationHelper();
/** /**
* Returns the list of DataValidation in the sheet. * Returns the list of DataValidation in the sheet.
* @return list of DataValidation in the sheet * @return list of DataValidation in the sheet
*/ */
public List<? extends DataValidation> getDataValidations(); public List<? extends DataValidation> getDataValidations();
/** /**
* Creates a data validation object * Creates a data validation object
* @param dataValidation The Data validation object settings * @param dataValidation The Data validation object settings
*/ */
public void addValidationData(DataValidation dataValidation); public void addValidationData(DataValidation dataValidation);
/** /**
* Enable filtering for a range of cells * Enable filtering for a range of cells

View File

@ -1233,8 +1233,8 @@ public class SXSSFSheet implements Sheet, Cloneable
private void collapseRow(int rowIndex) { private void collapseRow(int rowIndex) {
SXSSFRow row = getRow(rowIndex); SXSSFRow row = getRow(rowIndex);
if(row == null) { if(row == null) {
throw new IllegalArgumentException("Invalid row number("+ rowIndex + "). Row does not exist."); throw new IllegalArgumentException("Invalid row number("+ rowIndex + "). Row does not exist.");
} else { } else {
int startRow = findStartOfRowOutlineGroup(rowIndex); int startRow = findStartOfRowOutlineGroup(rowIndex);
// Hide all the columns until the end of the group // 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) { private int findStartOfRowOutlineGroup(int rowIndex) {
// Find the start of the group. // Find the start of the group.
Row row = getRow(rowIndex); Row row = getRow(rowIndex);
int level = ((SXSSFRow) row).getOutlineLevel(); int level = ((SXSSFRow) row).getOutlineLevel();
if(level == 0) { 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; int currentRow = rowIndex;
while (getRow(currentRow) != null) { while (getRow(currentRow) != null) {

View File

@ -2801,9 +2801,9 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
@Override @Override
@SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support @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) { 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<Row> it = rowIterator() ; it.hasNext() ; ) { for (Iterator<Row> it = rowIterator() ; it.hasNext() ; ) {
XSSFRow row = (XSSFRow)it.next(); XSSFRow row = (XSSFRow)it.next();
int rownum = row.getRowNum(); int rownum = row.getRowNum();
@ -2822,14 +2822,14 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
if(sheetComments != null){ if(sheetComments != null){
CTCommentList lst = sheetComments.getCTComments().getCommentList(); CTCommentList lst = sheetComments.getCTComments().getCommentList();
for (CTComment comment : lst.getCommentArray()) { for (CTComment comment : lst.getCommentArray()) {
String strRef = comment.getRef(); String strRef = comment.getRef();
CellAddress ref = new CellAddress(strRef); CellAddress ref = new CellAddress(strRef);
// is this comment part of the current row? // is this comment part of the current row?
if(ref.getRow() == rownum) { if(ref.getRow() == rownum) {
sheetComments.removeComment(ref); sheetComments.removeComment(ref);
vml.removeCommentShape(ref.getRow(), ref.getColumn()); 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. // 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, // 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 // i.e. when shifting down, start from down and go up, when shifting up, vice-versa
SortedMap<XSSFComment, Integer> commentsToShift = new TreeMap<XSSFComment, Integer>(new Comparator<XSSFComment>() { SortedMap<XSSFComment, Integer> commentsToShift = new TreeMap<XSSFComment, Integer>(new Comparator<XSSFComment>() {
public int compare(XSSFComment o1, XSSFComment o2) { public int compare(XSSFComment o1, XSSFComment o2) {
int row1 = o1.getRow(); int row1 = o1.getRow();
int row2 = o2.getRow(); int row2 = o2.getRow();
if(row1 == row2) { if(row1 == row2) {
// ordering is not important when row is equal, but don't return zero to still // ordering is not important when row is equal, but don't return zero to still
// get multiple comments per row into the map // get multiple comments per row into the map
return o1.hashCode() - o2.hashCode(); return o1.hashCode() - o2.hashCode();
} }
// when shifting down, sort higher row-values first // when shifting down, sort higher row-values first
if(n > 0) { if(n > 0) {
return row1 < row2 ? 1 : -1; return row1 < row2 ? 1 : -1;
} else { } else {
// sort lower-row values first when shifting up // sort lower-row values first when shifting up
return row1 > row2 ? 1 : -1; return row1 > row2 ? 1 : -1;
} }
} }
}); });
for (Iterator<Row> it = rowIterator() ; it.hasNext() ; ) { for (Iterator<Row> it = rowIterator() ; it.hasNext() ; ) {
@ -2875,26 +2875,26 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
int rownum = row.getRowNum(); int rownum = row.getRowNum();
if(sheetComments != null){ if(sheetComments != null){
// calculate the new rownum // calculate the new rownum
int newrownum = shiftedRowNum(startRow, endRow, n, rownum); int newrownum = shiftedRowNum(startRow, endRow, n, rownum);
// is there a change necessary for the current row? // is there a change necessary for the current row?
if(newrownum != rownum) { if(newrownum != rownum) {
CTCommentList lst = sheetComments.getCTComments().getCommentList(); CTCommentList lst = sheetComments.getCTComments().getCommentList();
for (CTComment comment : lst.getCommentArray()) { for (CTComment comment : lst.getCommentArray()) {
String oldRef = comment.getRef(); String oldRef = comment.getRef();
CellReference ref = new CellReference(oldRef); CellReference ref = new CellReference(oldRef);
// is this comment part of the current row? // is this comment part of the current row?
if(ref.getRow() == rownum) { if(ref.getRow() == rownum) {
XSSFComment xssfComment = new XSSFComment(sheetComments, comment, XSSFComment xssfComment = new XSSFComment(sheetComments, comment,
vml == null ? null : vml.findCommentShape(rownum, ref.getCol())); vml == null ? null : vml.findCommentShape(rownum, ref.getCol()));
// we should not perform the shifting right here as we would then find // we should not perform the shifting right here as we would then find
// already shifted comments and would shift them again... // already shifted comments and would shift them again...
commentsToShift.put(xssfComment, newrownum); 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, // 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 // i.e. from down to up if shifting down, vice-versa otherwise
for(Map.Entry<XSSFComment, Integer> entry : commentsToShift.entrySet()) { for(Map.Entry<XSSFComment, Integer> entry : commentsToShift.entrySet()) {
entry.getKey().setRow(entry.getValue()); entry.getKey().setRow(entry.getValue());
} }
XSSFRowShifter rowShifter = new XSSFRowShifter(this); 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) { private int shiftedRowNum(int startRow, int endRow, int n, int rownum) {
// no change if before any affected row // no change if before any affected row
if(rownum < startRow && (n > 0 || (startRow - rownum) > n)) { if(rownum < startRow && (n > 0 || (startRow - rownum) > n)) {
return rownum; return rownum;
} }
// no change if after any affected row // no change if after any affected row
if(rownum > endRow && (n < 0 || (rownum - endRow) > n)) { if(rownum > endRow && (n < 0 || (rownum - endRow) > n)) {
return rownum; return rownum;
} }
// row before and things are moved up // row before and things are moved up
if(rownum < startRow) { if(rownum < startRow) {
// row is moved down by the shifting // row is moved down by the shifting
return rownum + (endRow - startRow); return rownum + (endRow - startRow);
} }
// row is after and things are moved down // row is after and things are moved down
if(rownum > endRow) { if(rownum > endRow) {
// row is moved up by the shifting // row is moved up by the shifting
return rownum - (endRow - startRow); return rownum - (endRow - startRow);
} }
// row is part of the shifted block // row is part of the shifted block
return rownum + n; return rownum + n;
} }
/** /**
* Location of the top left visible cell Location of the top left visible cell in the bottom right * Location of the top left visible cell Location of the top left visible cell in the bottom right

View File

@ -92,9 +92,9 @@ public class TestSXSSFSheet extends BaseTestSheet {
@Test @Test
public void getCellComment() throws IOException { public void getCellComment() throws IOException {
// TODO: reading cell comments via Sheet does not work currently as it tries // 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 // to access the underlying sheet for this, but comments are stored as
// properties on Cells... // properties on Cells...
} }
@Override @Override

View File

@ -119,7 +119,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
HSSFWorkbook wb = new HSSFWorkbook(); HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet(); HSSFSheet s = wb.createSheet();
GridsetRecord gridsetRec = s.getSheet().getGridsetRecord(); GridsetRecord gridsetRec = s.getSheet().getGridsetRecord();
assertTrue(gridsetRec.getGridset()); assertTrue(gridsetRec.getGridset());
s.setGridsPrinted(true); s.setGridsPrinted(true);
assertFalse(gridsetRec.getGridset()); assertFalse(gridsetRec.getGridset());
wb.close(); wb.close();
@ -535,28 +535,28 @@ public final class TestHSSFSheet extends BaseTestSheet {
// verify limits // verify limits
try { try {
sheet.setZoom(0, 2); sheet.setZoom(0, 2);
fail("Should catch Exception here"); fail("Should catch Exception here");
} catch (IllegalArgumentException e) { } 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 { try {
sheet.setZoom(65536, 2); sheet.setZoom(65536, 2);
fail("Should catch Exception here"); fail("Should catch Exception here");
} catch (IllegalArgumentException e) { } 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 { try {
sheet.setZoom(2, 0); sheet.setZoom(2, 0);
fail("Should catch Exception here"); fail("Should catch Exception here");
} catch (IllegalArgumentException e) { } 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 { try {
sheet.setZoom(2, 65536); sheet.setZoom(2, 65536);
fail("Should catch Exception here"); fail("Should catch Exception here");
} catch (IllegalArgumentException e) { } 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(); wb.close();
@ -652,7 +652,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
} }
@Test @Test
public void autoSizeColumn() throws IOException { public void autoSizeColumn() throws IOException {
HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("43902.xls"); HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("43902.xls");
String sheetName = "my sheet"; String sheetName = "my sheet";
HSSFSheet sheet = wb1.getSheet(sheetName); HSSFSheet sheet = wb1.getSheet(sheetName);
@ -1161,8 +1161,8 @@ public final class TestHSSFSheet extends BaseTestSheet {
thrown.expect(IllegalArgumentException.class); thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Maximum row number is 65535"); thrown.expectMessage("Maximum row number is 65535");
sheet.showInPane(Integer.MAX_VALUE, 3); sheet.showInPane(Integer.MAX_VALUE, 3);
wb.close(); wb.close();
} }
@Test @Test