Generics warnings and other clean-up in HSSFSheet

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@722223 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-12-01 20:52:27 +00:00
parent 2014a596be
commit 8be4abf717

View File

@ -60,9 +60,8 @@ import org.apache.poi.util.POILogger;
* @author Jean-Pierre Paris (jean-pierre.paris at m4x dot org) (Just a little, too) * @author Jean-Pierre Paris (jean-pierre.paris at m4x dot org) (Just a little, too)
* @author Yegor Kozlov (yegor at apache.org) (Autosizing columns) * @author Yegor Kozlov (yegor at apache.org) (Autosizing columns)
*/ */
public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet private static final POILogger log = POILogFactory.getLogger(HSSFSheet.class);
{
private static final int DEBUG = POILogger.DEBUG; private static final int DEBUG = POILogger.DEBUG;
/* Constants for margins */ /* Constants for margins */
@ -82,21 +81,18 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* rows. It is currently set to 20. If you generate larger sheets you may benefit * rows. It is currently set to 20. If you generate larger sheets you may benefit
* by setting this to a higher number and recompiling a custom edition of HSSFSheet. * by setting this to a higher number and recompiling a custom edition of HSSFSheet.
*/ */
public final static int INITIAL_CAPACITY = 20; public final static int INITIAL_CAPACITY = 20;
/** /**
* reference to the low level Sheet object * reference to the low level Sheet object
*/ */
private final Sheet sheet;
private Sheet sheet; /** stores rows by zero-based row number */
/** stores <tt>HSSFRow</tt>s by <tt>Integer</tt> (zero-based row number) key */ private final TreeMap<Integer, HSSFRow> rows;
private TreeMap rows; protected final Workbook book;
protected Workbook book; protected final HSSFWorkbook workbook;
protected HSSFWorkbook workbook;
private int firstrow; private int firstrow;
private int lastrow; private int lastrow;
private static POILogger log = POILogFactory.getLogger(HSSFSheet.class);
/** /**
* Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from * Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from
@ -105,11 +101,9 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param workbook - The HSSF Workbook object associated with the sheet. * @param workbook - The HSSF Workbook object associated with the sheet.
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet() * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
*/ */
protected HSSFSheet(HSSFWorkbook workbook) {
protected HSSFSheet(HSSFWorkbook workbook)
{
sheet = Sheet.createSheet(); sheet = Sheet.createSheet();
rows = new TreeMap(); rows = new TreeMap<Integer, HSSFRow>();
this.workbook = workbook; this.workbook = workbook;
this.book = workbook.getWorkbook(); this.book = workbook.getWorkbook();
} }
@ -122,11 +116,9 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param sheet - lowlevel Sheet object this sheet will represent * @param sheet - lowlevel Sheet object this sheet will represent
* @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet() * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
*/ */
protected HSSFSheet(HSSFWorkbook workbook, Sheet sheet) {
protected HSSFSheet(HSSFWorkbook workbook, Sheet sheet)
{
this.sheet = sheet; this.sheet = sheet;
rows = new TreeMap(); rows = new TreeMap<Integer, HSSFRow>();
this.workbook = workbook; this.workbook = workbook;
this.book = workbook.getWorkbook(); this.book = workbook.getWorkbook();
setPropertiesFromSheet(sheet); setPropertiesFromSheet(sheet);
@ -231,13 +223,11 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* *
* @param row representing a row to remove. * @param row representing a row to remove.
*/ */
public void removeRow(Row row) public void removeRow(Row row) {
{
HSSFRow hrow = (HSSFRow) row; HSSFRow hrow = (HSSFRow) row;
if (rows.size() > 0) if (rows.size() > 0) {
{
Integer key = new Integer(row.getRowNum()); Integer key = new Integer(row.getRowNum());
HSSFRow removedRow = (HSSFRow) rows.remove(key); HSSFRow removedRow = rows.remove(key);
if (removedRow != row) { if (removedRow != row) {
if (removedRow != null) { if (removedRow != null) {
rows.put(key, removedRow); rows.put(key, removedRow);
@ -322,18 +312,16 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* Returns the logical row (not physical) 0-based. If you ask for a row that is not * Returns the logical row (not physical) 0-based. If you ask for a row that is not
* defined you get a null. This is to say row 4 represents the fifth row on a sheet. * defined you get a null. This is to say row 4 represents the fifth row on a sheet.
* @param rowIndex row to get * @param rowIndex row to get
* @return HSSFRow representing the rownumber or null if its not defined on the sheet * @return HSSFRow representing the row number or null if its not defined on the sheet
*/ */
public HSSFRow getRow(int rowIndex) { public HSSFRow getRow(int rowIndex) {
return (HSSFRow) rows.get(new Integer(rowIndex)); return rows.get(new Integer(rowIndex));
} }
/** /**
* Returns the number of phsyically defined rows (NOT the number of rows in the sheet) * Returns the number of physically defined rows (NOT the number of rows in the sheet)
*/ */
public int getPhysicalNumberOfRows() {
public int getPhysicalNumberOfRows()
{
return rows.size(); return rows.size();
} }
@ -341,8 +329,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* Gets the first row on the sheet * Gets the first row on the sheet
* @return the number of the first logical row on the sheet, zero based * @return the number of the first logical row on the sheet, zero based
*/ */
public int getFirstRowNum() public int getFirstRowNum() {
{
return firstrow; return firstrow;
} }
@ -358,9 +345,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* or not. * or not.
* @return the number of the last row contained in this sheet, zero based. * @return the number of the last row contained in this sheet, zero based.
*/ */
public int getLastRowNum() {
public int getLastRowNum()
{
return lastrow; return lastrow;
} }
@ -663,15 +648,16 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* be the third row if say for instance the second row is undefined. * be the third row if say for instance the second row is undefined.
* Call getRowNum() on each row if you care which one it is. * Call getRowNum() on each row if you care which one it is.
*/ */
public Iterator rowIterator() public Iterator<Row> rowIterator() {
{ @SuppressWarnings("unchecked") // can this clumsy generic syntax be improved?
return rows.values().iterator(); Iterator<Row> result = (Iterator<Row>)(Iterator<? extends Row>)rows.values().iterator();
return result;
} }
/** /**
* Alias for {@link #rowIterator()} to allow * Alias for {@link #rowIterator()} to allow
* foreach loops * foreach loops
*/ */
public Iterator iterator() { public Iterator<Row> iterator() {
return rowIterator(); return rowIterator();
} }
@ -681,9 +667,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* Object. * Object.
* @return Sheet - low level representation of this HSSFSheet. * @return Sheet - low level representation of this HSSFSheet.
*/ */
Sheet getSheet() {
protected Sheet getSheet()
{
return sheet; return sheet;
} }
@ -691,9 +675,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* whether alternate expression evaluation is on * whether alternate expression evaluation is on
* @param b alternative expression evaluation or not * @param b alternative expression evaluation or not
*/ */
public void setAlternativeExpression(boolean b) {
public void setAlternativeExpression(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -704,9 +686,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* whether alternative formula entry is on * whether alternative formula entry is on
* @param b alternative formulas or not * @param b alternative formulas or not
*/ */
public void setAlternativeFormula(boolean b) {
public void setAlternativeFormula(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -717,9 +697,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* show automatic page breaks or not * show automatic page breaks or not
* @param b whether to show auto page breaks * @param b whether to show auto page breaks
*/ */
public void setAutobreaks(boolean b) {
public void setAutobreaks(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -730,9 +708,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* set whether sheet is a dialog sheet or not * set whether sheet is a dialog sheet or not
* @param b isDialog or not * @param b isDialog or not
*/ */
public void setDialog(boolean b) {
public void setDialog(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -744,9 +720,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* *
* @param b guts or no guts (or glory) * @param b guts or no guts (or glory)
*/ */
public void setDisplayGuts(boolean b) {
public void setDisplayGuts(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -757,9 +731,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* fit to page option is on * fit to page option is on
* @param b fit or not * @param b fit or not
*/ */
public void setFitToPage(boolean b) {
public void setFitToPage(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -770,9 +742,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* set if row summaries appear below detail in the outline * set if row summaries appear below detail in the outline
* @param b below or not * @param b below or not
*/ */
public void setRowSumsBelow(boolean b) {
public void setRowSumsBelow(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -783,9 +753,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* set if col summaries appear right of the detail in the outline * set if col summaries appear right of the detail in the outline
* @param b right or not * @param b right or not
*/ */
public void setRowSumsRight(boolean b) {
public void setRowSumsRight(boolean b)
{
WSBoolRecord record = WSBoolRecord record =
(WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid);
@ -796,9 +764,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* whether alternate expression evaluation is on * whether alternate expression evaluation is on
* @return alternative expression evaluation or not * @return alternative expression evaluation or not
*/ */
public boolean getAlternateExpression() {
public boolean getAlternateExpression()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getAlternateExpression(); .getAlternateExpression();
} }
@ -807,9 +773,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* whether alternative formula entry is on * whether alternative formula entry is on
* @return alternative formulas or not * @return alternative formulas or not
*/ */
public boolean getAlternateFormula() {
public boolean getAlternateFormula()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getAlternateFormula(); .getAlternateFormula();
} }
@ -818,9 +782,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* show automatic page breaks or not * show automatic page breaks or not
* @return whether to show auto page breaks * @return whether to show auto page breaks
*/ */
public boolean getAutobreaks() {
public boolean getAutobreaks()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getAutobreaks(); .getAutobreaks();
} }
@ -829,9 +791,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* get whether sheet is a dialog sheet or not * get whether sheet is a dialog sheet or not
* @return isDialog or not * @return isDialog or not
*/ */
public boolean getDialog() {
public boolean getDialog()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getDialog(); .getDialog();
} }
@ -841,9 +801,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* *
* @return guts or no guts (or glory) * @return guts or no guts (or glory)
*/ */
public boolean getDisplayGuts() {
public boolean getDisplayGuts()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getDisplayGuts(); .getDisplayGuts();
} }
@ -852,9 +810,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* fit to page option is on * fit to page option is on
* @return fit or not * @return fit or not
*/ */
public boolean getFitToPage() {
public boolean getFitToPage()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getFitToPage(); .getFitToPage();
} }
@ -863,9 +819,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* get if row summaries appear below detail in the outline * get if row summaries appear below detail in the outline
* @return below or not * @return below or not
*/ */
public boolean getRowSumsBelow() {
public boolean getRowSumsBelow()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getRowSumsBelow(); .getRowSumsBelow();
} }
@ -874,9 +828,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* get if col summaries appear right of the detail in the outline * get if col summaries appear right of the detail in the outline
* @return right or not * @return right or not
*/ */
public boolean getRowSumsRight() {
public boolean getRowSumsRight()
{
return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid))
.getRowSumsRight(); .getRowSumsRight();
} }
@ -894,36 +846,32 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param newPrintGridlines boolean to turn on or off the printing of * @param newPrintGridlines boolean to turn on or off the printing of
* gridlines * gridlines
*/ */
public void setPrintGridlines( boolean newPrintGridlines ) public void setPrintGridlines(boolean newPrintGridlines) {
{ getSheet().getPrintGridlines().setPrintGridlines(newPrintGridlines);
getSheet().getPrintGridlines().setPrintGridlines( newPrintGridlines );
} }
/** /**
* Gets the print setup object. * Gets the print setup object.
* @return The user model for the print setup object. * @return The user model for the print setup object.
*/ */
public HSSFPrintSetup getPrintSetup() public HSSFPrintSetup getPrintSetup() {
{ return new HSSFPrintSetup(sheet.getPageSettings().getPrintSetup());
return new HSSFPrintSetup( sheet.getPageSettings().getPrintSetup() );
} }
/** /**
* Gets the user model for the document header. * Gets the user model for the document header.
* @return The Document header. * @return The Document header.
*/ */
public HSSFHeader getHeader() public HSSFHeader getHeader() {
{ return new HSSFHeader(sheet.getPageSettings().getHeader());
return new HSSFHeader( sheet.getPageSettings().getHeader() );
} }
/** /**
* Gets the user model for the document footer. * Gets the user model for the document footer.
* @return The Document footer. * @return The Document footer.
*/ */
public HSSFFooter getFooter() public HSSFFooter getFooter() {
{ return new HSSFFooter(sheet.getPageSettings().getFooter());
return new HSSFFooter( sheet.getPageSettings().getFooter() );
} }
/** /**
@ -937,8 +885,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* Sets whether sheet is selected. * Sets whether sheet is selected.
* @param sel Whether to select the sheet or deselect the sheet. * @param sel Whether to select the sheet or deselect the sheet.
*/ */
public void setSelected( boolean sel ) public void setSelected(boolean sel) {
{
getSheet().getWindowTwo().setSelected(sel); getSheet().getWindowTwo().setSelected(sel);
} }
/** /**
@ -951,8 +898,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* Sets whether sheet is selected. * Sets whether sheet is selected.
* @param sel Whether to select the sheet or deselect the sheet. * @param sel Whether to select the sheet or deselect the sheet.
*/ */
public void setActive(boolean sel ) public void setActive(boolean sel) {
{
getSheet().getWindowTwo().setActive(sel); getSheet().getWindowTwo().setActive(sel);
} }
@ -961,9 +907,8 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param margin which margin to get * @param margin which margin to get
* @return the size of the margin * @return the size of the margin
*/ */
public double getMargin( short margin ) public double getMargin(short margin) {
{ return sheet.getPageSettings().getMargin(margin);
return sheet.getPageSettings().getMargin( margin );
} }
/** /**
@ -971,9 +916,8 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param margin which margin to get * @param margin which margin to get
* @param size the size of the margin * @param size the size of the margin
*/ */
public void setMargin( short margin, double size ) public void setMargin(short margin, double size) {
{ sheet.getPageSettings().setMargin(margin, size);
sheet.getPageSettings().setMargin( margin, size );
} }
/** /**
@ -1025,7 +969,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
} }
/** /**
* Sets the zoom magnication for the sheet. The zoom is expressed as a * Sets the zoom magnification for the sheet. The zoom is expressed as a
* fraction. For example to express a zoom of 75% use 3 for the numerator * fraction. For example to express a zoom of 75% use 3 for the numerator
* and 4 for the denominator. * and 4 for the denominator.
* *
@ -1050,8 +994,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* first viewed after opening it in a viewer * first viewed after opening it in a viewer
* @return short indicating the rownum (0 based) of the top row * @return short indicating the rownum (0 based) of the top row
*/ */
public short getTopRow() public short getTopRow() {
{
return sheet.getTopRow(); return sheet.getTopRow();
} }
@ -1060,8 +1003,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* first viewed after opening it in a viewer * first viewed after opening it in a viewer
* @return short indicating the rownum (0 based) of the top row * @return short indicating the rownum (0 based) of the top row
*/ */
public short getLeftCol() public short getLeftCol() {
{
return sheet.getLeftCol(); return sheet.getLeftCol();
} }
@ -1072,9 +1014,9 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param leftcol the left column to show in desktop window pane * @param leftcol the left column to show in desktop window pane
*/ */
public void showInPane(short toprow, short leftcol){ public void showInPane(short toprow, short leftcol){
this.sheet.setTopRow(toprow); sheet.setTopRow(toprow);
this.sheet.setLeftCol(leftcol); sheet.setLeftCol(leftcol);
} }
/** /**
* Shifts the merged regions left or right depending on mode * Shifts the merged regions left or right depending on mode
@ -1086,7 +1028,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param isRow * @param isRow
*/ */
protected void shiftMerged(int startRow, int endRow, int n, boolean isRow) { protected void shiftMerged(int startRow, int endRow, int n, boolean isRow) {
List shiftedRegions = new ArrayList(); List<CellRangeAddress> shiftedRegions = new ArrayList<CellRangeAddress>();
//move merged regions completely if they fall within the new region boundaries when they are shifted //move merged regions completely if they fall within the new region boundaries when they are shifted
for (int i = 0; i < getNumMergedRegions(); i++) { for (int i = 0; i < getNumMergedRegions(); i++) {
CellRangeAddress merged = getMergedRegion(i); CellRangeAddress merged = getMergedRegion(i);
@ -1161,8 +1103,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param copyRowHeight whether to copy the row height during the shift * @param copyRowHeight whether to copy the row height during the shift
* @param resetOriginalRowHeight whether to set the original row's height to the default * @param resetOriginalRowHeight whether to set the original row's height to the default
*/ */
public void shiftRows( int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight) public void shiftRows( int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight) {
{
shiftRows(startRow, endRow, n, copyRowHeight, resetOriginalRowHeight, true); shiftRows(startRow, endRow, n, copyRowHeight, resetOriginalRowHeight, true);
} }
@ -1276,10 +1217,9 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
// TODO - adjust formulas in named ranges // TODO - adjust formulas in named ranges
} }
protected void insertChartRecords( List records ) protected void insertChartRecords(List<Record> records) {
{ int window2Loc = sheet.findFirstRecordLocBySid(WindowTwoRecord.sid);
int window2Loc = sheet.findFirstRecordLocBySid( WindowTwoRecord.sid ); sheet.getRecords().addAll(window2Loc, records);
sheet.getRecords().addAll( window2Loc, records );
} }
/** /**
@ -1289,8 +1229,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param topRow Top row visible in bottom pane * @param topRow Top row visible in bottom pane
* @param leftmostColumn Left column visible in right pane. * @param leftmostColumn Left column visible in right pane.
*/ */
public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow ) public void createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow) {
{
if (colSplit < 0 || colSplit > 255) throw new IllegalArgumentException("Column must be between 0 and 255"); if (colSplit < 0 || colSplit > 255) throw new IllegalArgumentException("Column must be between 0 and 255");
if (rowSplit < 0 || rowSplit > 65535) throw new IllegalArgumentException("Row must be between 0 and 65535"); if (rowSplit < 0 || rowSplit > 65535) throw new IllegalArgumentException("Row must be between 0 and 65535");
if (leftmostColumn < colSplit) throw new IllegalArgumentException("leftmostColumn parameter must not be less than colSplit parameter"); if (leftmostColumn < colSplit) throw new IllegalArgumentException("leftmostColumn parameter must not be less than colSplit parameter");
@ -1303,9 +1242,8 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param colSplit Horizonatal position of split. * @param colSplit Horizonatal position of split.
* @param rowSplit Vertical position of split. * @param rowSplit Vertical position of split.
*/ */
public void createFreezePane( int colSplit, int rowSplit ) public void createFreezePane(int colSplit, int rowSplit) {
{ createFreezePane(colSplit, rowSplit, colSplit, rowSplit);
createFreezePane( colSplit, rowSplit, colSplit, rowSplit );
} }
/** /**
@ -1321,8 +1259,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @see #PANE_UPPER_LEFT * @see #PANE_UPPER_LEFT
* @see #PANE_UPPER_RIGHT * @see #PANE_UPPER_RIGHT
*/ */
public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane ) public void createSplitPane(int xSplitPos, int ySplitPos, int leftmostColumn, int topRow, int activePane) {
{
getSheet().createSplitPane( xSplitPos, ySplitPos, topRow, leftmostColumn, activePane ); getSheet().createSplitPane( xSplitPos, ySplitPos, topRow, leftmostColumn, activePane );
} }
@ -1331,7 +1268,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @return null if no pane configured, or the pane information. * @return null if no pane configured, or the pane information.
*/ */
public PaneInformation getPaneInformation() { public PaneInformation getPaneInformation() {
return getSheet().getPaneInformation(); return getSheet().getPaneInformation();
} }
/** /**
@ -1408,7 +1345,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
/** /**
* @return row indexes of all the horizontal page breaks, never <code>null</code> * @return row indexes of all the horizontal page breaks, never <code>null</code>
*/ */
public int[] getRowBreaks(){ public int[] getRowBreaks() {
//we can probably cache this information, but this should be a sparsely used function //we can probably cache this information, but this should be a sparsely used function
return sheet.getPageSettings().getRowBreaks(); return sheet.getPageSettings().getRowBreaks();
} }
@ -1416,7 +1353,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
/** /**
* @return column indexes of all the vertical page breaks, never <code>null</code> * @return column indexes of all the vertical page breaks, never <code>null</code>
*/ */
public int[] getColumnBreaks(){ public int[] getColumnBreaks() {
//we can probably cache this information, but this should be a sparsely used function //we can probably cache this information, but this should be a sparsely used function
return sheet.getPageSettings().getColumnBreaks(); return sheet.getPageSettings().getColumnBreaks();
} }
@ -1470,8 +1407,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* Aggregates the drawing records and dumps the escher record hierarchy * Aggregates the drawing records and dumps the escher record hierarchy
* to the standard output. * to the standard output.
*/ */
public void dumpDrawingRecords(boolean fat) public void dumpDrawingRecords(boolean fat) {
{
sheet.aggregateDrawingRecords(book.getDrawingManager(), false); sheet.aggregateDrawingRecords(book.getDrawingManager(), false);
EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid); EscherAggregate r = (EscherAggregate) getSheet().findFirstRecordBySid(EscherAggregate.sid);
@ -1495,8 +1431,7 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* This may then be used to add graphics or charts * This may then be used to add graphics or charts
* @return The new patriarch. * @return The new patriarch.
*/ */
public HSSFPatriarch createDrawingPatriarch() public HSSFPatriarch createDrawingPatriarch() {
{
// Create the drawing group if it doesn't already exist. // Create the drawing group if it doesn't already exist.
book.createDrawingGroup(); book.createDrawingGroup();
@ -1616,14 +1551,12 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet
* @param fromRow start row (0-based) * @param fromRow start row (0-based)
* @param toRow end row (0-based) * @param toRow end row (0-based)
*/ */
public void groupRow(int fromRow, int toRow) public void groupRow(int fromRow, int toRow) {
{ sheet.groupRowRange(fromRow, toRow, true);
sheet.groupRowRange( fromRow, toRow, true );
} }
public void ungroupRow(int fromRow, int toRow) public void ungroupRow(int fromRow, int toRow) {
{ sheet.groupRowRange(fromRow, toRow, false);
sheet.groupRowRange( fromRow, toRow, false );
} }
public void setRowGroupCollapsed(int rowIndex, boolean collapse) { public void setRowGroupCollapsed(int rowIndex, boolean collapse) {