jxl.write.biff
Class CellValue

java.lang.Object
  |
  +--jxl.biff.RecordData
        |
        +--jxl.biff.WritableRecordData
              |
              +--jxl.write.biff.CellValue
All Implemented Interfaces:
ByteData, Cell, WritableCell
Direct Known Subclasses:
BlankRecord, BooleanRecord, DateRecord, FormulaRecord, LabelRecord, NumberRecord, ReadFormulaRecord

public abstract class CellValue
extends WritableRecordData
implements WritableCell

Abstract class which stores the common data used for cells, such as row, column and formatting information. Any record which directly represents the contents of a cell, such as labels and numbers, are derived from this class data store


Field Summary
private  int column
          The column in the worksheet at which this cell is located
private  XFRecord format
          The format applied to this cell
private  FormattingRecords formattingRecords
          A handle to the formatting records, used in case we want to change the format of the cell once it has been added to the spreadsheet
private  boolean referenced
          A flag to indicate that this record is already referenced within a worksheet
private  int row
          The row in the worksheet at which this cell is located
private  WritableSheetImpl sheet
          A handle to the sheet
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Fields inherited from class jxl.biff.RecordData
code, record
 
Constructor Summary
protected CellValue(Type t, Cell c)
          Constructor used when creating a writable cell from a read-only cell (when copying a workbook)
protected CellValue(Type t, int c, int r)
          Constructor used when building writable cells from the Java API
protected CellValue(Type t, int c, int r, CellFormat st)
          Overloaded constructor used when building writable cells from the Java API which also takes a format
 
Method Summary
(package private)  void decrementColumn()
          Decrements the column of this cell by one.
(package private)  void decrementRow()
          Decrements the row of this cell by one.
 CellFormat getCellFormat()
          API method which gets the format applied to this cell
 int getColumn()
          Returns the column number of this cell
 byte[] getData()
          Gets the data to write to the output file
 int getRow()
          Returns the row number of this cell
(package private)  int getXFIndex()
          Gets the internal index of the formatting record
(package private)  void incrementColumn()
          Increments the column of this cell by one.
(package private)  void incrementRow()
          Increments the row of this cell by one.
 boolean isHidden()
          Indicates whether or not this cell is hidden, by virtue of either the entire row or column being collapsed
(package private)  boolean isReferenced()
          Internal method to see if this cell is referenced within the workbook.
(package private)  void setCellDetails(FormattingRecords fr, SharedStrings ss, WritableSheetImpl s)
          Called when the cell is added to the worksheet in order to indicate that this object is already added to the worksheet This method also verifies that the associated formats and formats have been initialized correctly
 void setCellFormat(CellFormat cf)
          An API function which sets the format to apply to this cell
 
Methods inherited from class jxl.biff.WritableRecordData
getBytes, handleContinueRecords
 
Methods inherited from class jxl.biff.RecordData
getCode, getRecord
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface jxl.Cell
getContents, getType
 

Field Detail

row

private int row
The row in the worksheet at which this cell is located

column

private int column
The column in the worksheet at which this cell is located

format

private XFRecord format
The format applied to this cell

formattingRecords

private FormattingRecords formattingRecords
A handle to the formatting records, used in case we want to change the format of the cell once it has been added to the spreadsheet

referenced

private boolean referenced
A flag to indicate that this record is already referenced within a worksheet

sheet

private WritableSheetImpl sheet
A handle to the sheet
Constructor Detail

CellValue

protected CellValue(Type t,
                    int c,
                    int r)
Constructor used when building writable cells from the Java API
Parameters:
c - the column
t - the type indicator
r - the row

CellValue

protected CellValue(Type t,
                    Cell c)
Constructor used when creating a writable cell from a read-only cell (when copying a workbook)
Parameters:
c - the cell to clone
t - the type of this cell

CellValue

protected CellValue(Type t,
                    int c,
                    int r,
                    CellFormat st)
Overloaded constructor used when building writable cells from the Java API which also takes a format
Parameters:
c - the column
t - the cell type
r - the row
st - the format to apply to this cell
Method Detail

setCellFormat

public void setCellFormat(CellFormat cf)
An API function which sets the format to apply to this cell
Specified by:
setCellFormat in interface WritableCell
Parameters:
cf - the format to apply to this cell

getRow

public int getRow()
Returns the row number of this cell
Specified by:
getRow in interface Cell
Returns:
the row number of this cell

getColumn

public int getColumn()
Returns the column number of this cell
Specified by:
getColumn in interface Cell
Returns:
the column number of this cell

isHidden

public boolean isHidden()
Indicates whether or not this cell is hidden, by virtue of either the entire row or column being collapsed
Specified by:
isHidden in interface Cell
Returns:
TRUE if this cell is hidden, FALSE otherwise

getData

public byte[] getData()
Gets the data to write to the output file
Overrides:
getData in class WritableRecordData
Returns:
the binary data

setCellDetails

void setCellDetails(FormattingRecords fr,
                    SharedStrings ss,
                    WritableSheetImpl s)
Called when the cell is added to the worksheet in order to indicate that this object is already added to the worksheet This method also verifies that the associated formats and formats have been initialized correctly
Parameters:
fr - the formatting records
ss - the shared strings used within the workbook
s - the sheet this is being added to

isReferenced

final boolean isReferenced()
Internal method to see if this cell is referenced within the workbook. Once this has been placed in the workbook, it becomes immutable
Returns:
TRUE if this cell has been added to a sheet, FALSE otherwise

getXFIndex

final int getXFIndex()
Gets the internal index of the formatting record
Returns:
the index of the format record

getCellFormat

public CellFormat getCellFormat()
API method which gets the format applied to this cell
Specified by:
getCellFormat in interface Cell
Returns:
the format for this cell

incrementRow

void incrementRow()
Increments the row of this cell by one. Invoked by the sheet when inserting rows

decrementRow

void decrementRow()
Decrements the row of this cell by one. Invoked by the sheet when removing rows

incrementColumn

void incrementColumn()
Increments the column of this cell by one. Invoked by the sheet when inserting columns

decrementColumn

void decrementColumn()
Decrements the column of this cell by one. Invoked by the sheet when removing columns