View | Details | Raw Unified | Return to bug 45919
Collapse All | Expand All

(-)HSSFRow.java (-21 / +91 lines)
Line 35 Link Here
35
public final class HSSFRow implements Comparable {
35
public class HSSFRow implements Comparable {
36
  protected class BookNSheet
37
  {
38
    protected HSSFWorkbook book;
39
    protected HSSFSheet sheet;
40
    int row;
41
  }
Line 57 Link Here
64
//    /**
65
//     * Creates new HSSFRow from scratch. Only HSSFSheet should do this.
66
//     *
67
//     * @param book low-level Workbook object containing the sheet that contains this row
68
//     * @param sheet low-level Sheet object that contains this Row
69
//     * @param rowNum the row number of this row (0 based)
70
//     * @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int)
71
//     */
72
//    HSSFRow(HSSFWorkbook book, HSSFSheet sheet, int rowNum)
73
//    {
74
//        this.rowNum = rowNum;
75
//        this.book = book;
76
//        this.sheet = sheet;
77
//        row = new RowRecord(rowNum);
78
//
79
//        setRowNum(rowNum);
80
//    }
81
Line 59 Link Here
59
     * Creates new HSSFRow from scratch. Only HSSFSheet should do this.
83
     * Creates an HSSFRow from a low level RowRecord object.  Only HSSFSheet should do
84
     * this.  HSSFSheet uses this when an existing file is read in.
Line 63 Link Here
63
     * @param rowNum the row number of this row (0 based)
88
     * @param record the low level api object this row should represent
Line 66 Link Here
66
    HSSFRow(HSSFWorkbook book, HSSFSheet sheet, int rowNum)
91
    protected HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record)
Line 68 Link Here
68
        this.rowNum = rowNum;
Line 71 Link Here
71
        row = new RowRecord(rowNum);
95
        row = record;
Line 73 Link Here
73
        setRowNum(rowNum);
97
        setRowNum(record.getRowNumber());
Lines 77-78 Link Here
77
     * Creates an HSSFRow from a low level RowRecord object.  Only HSSFSheet should do
101
     * You can now also create a new HSSFRow with this public constructor,
78
     * this.  HSSFSheet uses this when an existing file is read in.
102
     * not having to use HSSFSheet.createRow.
103
     * This makes it possible to derive classes from HSSFRow 
104
     * (it is no longer <final>) and to construct objects of the derived
105
     * classes which can be used like the original ones.
Lines 80-83 Link Here
80
     * @param book low-level Workbook object containing the sheet that contains this row
107
     * @param sheet
81
     * @param sheet low-level Sheet object that contains this Row
108
     * @param rowNum
82
     * @param record the low level api object this row should represent
83
     * @see org.apache.poi.hssf.usermodel.HSSFSheet#createRow(int)
Line 85 Link Here
85
    HSSFRow(HSSFWorkbook book, HSSFSheet sheet, RowRecord record)
110
    public HSSFRow(HSSFSheet sheet, int rowNum)
Line 87 Link Here
87
        this.book = book;
Line 89 Link Here
89
        row = record;
113
        this.rowNum = rowNum;
114
        this.book = sheet.workbook;
115
        row = new RowRecord(rowNum);
Line 91 Link Here
91
        setRowNum(record.getRowNumber());
117
        setRowNum(rowNum);
118
        sheet.initNewRow (this);
Line 92 Link Here
120
  
Line 103 Link Here
132
     * You can verride this in derived classes for custom derived cell classes,
133
     * but it's not necessary, as createCell (int, int) is used internally
Line 105 Link Here
105
     * @param column - the column number this cell represents
135
     * @param columnIndex - the column number this cell represents
Line 124 Link Here
155
     * ## Override this in derived classes for custom derived cell classes ##
Line 133 Link Here
133
        HSSFCell cell = new HSSFCell(book, sheet, getRowNum(), (short)columnIndex, type);
164
//        HSSFCell cell = new HSSFCell(book, sheet, getRowNum(), (short)columnIndex, type);
165
//
166
//        addCell(cell);
167
//        sheet.getSheet().addValueRecord(getRowNum(), cell.getCellValueRecord());
168
        return new HSSFCell (this, columnIndex, type);
169
    }
Line 134 Link Here
171
    /**
172
     * Service function for the new public HSSFCell Constructor
173
     * @return a BookNSheet Object which contains Workbook, Sheet ans Row Idx 
174
     * of this row
175
     */
176
    BookNSheet getPrivateParts ()
177
    {
178
      BookNSheet pp = new BookNSheet ();
179
      pp.book = this.book;
180
      pp.sheet = this.sheet;
181
      pp.row = getRowNum();
182
      return pp;
183
    }
184
185
    /**
186
     * Last phase of the initialzation of a newly constructed HSSFCell
187
     * @param cell
188
     */
189
    void initNewCell (HSSFCell cell)
190
    {
Line 137 Link Here
137
        return cell;
Line 187 Link Here
243
     * This method is invoked indirectly by all HSSFWorkbook constructors with 
244
     * IO access when a new cell must be created.
245
     * ## Override this in derived classes for custom derived cell classes ##
246
     * Just pass on the parameters to an HSSFCell-derived-class constructor
247
     * @param pBook - The HSSF Workbook object associated with the row
248
     * @param pSheet - The HSSF Sheet which contains the row
249
     * @param pCell - The low level record from which the cell is to be created
250
     * @return a new HSSFCell
251
     */
252
    protected HSSFCell HSSFCellFactory (HSSFWorkbook pBook, HSSFSheet pSheet
253
                                       ,CellValueRecordInterface pCell)
254
    {
255
      return new HSSFCell (pBook, pSheet, pCell);
256
    }
257
    /**
Line 194 Link Here
194
        HSSFCell hcell = new HSSFCell(book, sheet, cell);
264
        HSSFCell hcell = HSSFCellFactory (book, sheet, cell);

Return to bug 45919