ASF Bugzilla – Attachment 22653 Details for
Bug 45919
[PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to make HSSFSheet inheritable
HSSFSheet.java.patch (text/plain), 3.91 KB, created by
Thomas Guretzki
on 2008-09-30 07:47:44 UTC
(
hide
)
Description:
Patch to make HSSFSheet inheritable
Filename:
MIME Type:
Creator:
Thomas Guretzki
Created:
2008-09-30 07:47:44 UTC
Size:
3.91 KB
patch
obsolete
>--- HSSFSheet.java Mon Sep 29 09:27:14 2008 700026 >+++ HSSFSheet.java Mon Sep 29 18:11:21 2008 >@@ -61 +61 @@ >-public final class HSSFSheet { >+public class HSSFSheet { >@@ -98,2 +98 @@ >- * Creates new HSSFSheet - called by HSSFWorkbook to create a sheet from >- * scratch. You should not be calling this from application code (its protected anyhow). >+ * Creates new HSSFSheet in the given HSSFWorkbook >@@ -101,0 +101 @@ >+ * @param sheetname - Name of new sheet. If <null> => "Sheet<n>" is used >@@ -105 +105 @@ >- protected HSSFSheet(HSSFWorkbook workbook) >+ public HSSFSheet(HSSFWorkbook p_workbook, String sheetname) >@@ -106,0 +107,5 @@ >+ this.workbook = p_workbook; >+ this.book = p_workbook.getWorkbook(); >+ if (sheetname != null) >+ if (book.doesContainsSheetName( sheetname, workbook._sheets.size() )) >+ throw new IllegalArgumentException( "The workbook already contains a sheet of name " + sheetname ); >@@ -108,3 +113,8 @@ >- rows = new TreeMap(); >- this.workbook = workbook; >- this.book = workbook.getWorkbook(); >+ rows = new TreeMap(); // new ArrayList(INITIAL_CAPACITY); >+ workbook._sheets.add(this); >+ workbook.setSheetName(workbook._sheets.size() - 1 >+ ,sheetname==null ? "Sheet" + (workbook._sheets.size() - 1) >+ : sheetname); >+ boolean isOnlySheet = workbook._sheets.size() == 1; >+ setSelected(isOnlySheet); >+ setActive(isOnlySheet); >@@ -119 +129 @@ >- * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet() >+ * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#HSSFWorkbook(DirectoryNode,POIFSFileSystem,boolean) >@@ -195,0 +206 @@ >+ * ## Override this in derived classes for custom derived row classes ## >@@ -204 +215,6 @@ >- HSSFRow row = new HSSFRow(workbook, this, rownum); >+ // HSSFRow row = new HSSFRow(workbook, this, rownum); >+ // >+ // addRow(row, true); >+ // return row; >+ return new HSSFRow (this, rownum); >+ } >@@ -206,2 +222,12 @@ >- addRow(row, true); >- return row; >+ /** >+ * >+ * Second phase of the initialization of a new HSSFRow >+ * Cannot be done in <initNewRow> because auf necessary intermediate steps >+ * Could be avoided by giving <addRow> package access, >+ * but I didn't want to change that. >+ * >+ * @param newrow the HSSFRow to be added >+ */ >+ void initNewRow (HSSFRow newrow) >+ { >+ addRow(newrow, true); >@@ -210,0 +237,14 @@ >+ * This method is invoked indirectly by all HSSFWorkbook constructors with >+ * IO access when a new row must be created. >+ * ## Override this in derived classes for custom derived row classes ## >+ * Just pass on the parameters to an HSSFRow-derived-class constructor >+ * @param pBook - The HSSF Workbook object associated with the row >+ * @param pSheet - The HSSF Sheet which contains the row >+ * @param pRow - The low level record from which the row is to be created >+ * @return a new HSSFRow >+ */ >+ protected HSSFRow HSSFRowFactory (HSSFWorkbook pBook, HSSFSheet pSheet, RowRecord pRow) >+ { >+ return new HSSFRow(pBook, pSheet, pRow); >+ } >+ /** >@@ -212 +252 @@ >- * USed when reading an existing file >+ * Used when reading an existing file >@@ -216 +255,0 @@ >- >@@ -219 +258 @@ >- HSSFRow hrow = new HSSFRow(workbook, this, row); >+ HSSFRow hrow = HSSFRowFactory (workbook, this, row); >@@ -1275 +1314 @@ >- sheet.updateFormulasAfterCellShift(shifter, externSheetIndex); >+ sheet.getRowsAggregate().updateFormulasAfterRowShift(shifter, externSheetIndex); >@@ -1284 +1323 @@ >- otherSheet.updateFormulasAfterCellShift(shifter, otherExtSheetIx); >+ otherSheet.getRowsAggregate().updateFormulasAfterRowShift(shifter, otherExtSheetIx);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 45919
:
22651
|
22652
| 22653 |
22654