jxl.write.biff
Class DateRecord

java.lang.Object
  extended byjxl.biff.RecordData
      extended byjxl.biff.WritableRecordData
          extended byjxl.write.biff.CellValue
              extended byjxl.write.biff.DateRecord
All Implemented Interfaces:
ByteData, Cell, WritableCell
Direct Known Subclasses:
DateTime

public abstract class DateRecord
extends CellValue

A date stored in the database


Nested Class Summary
protected static class DateRecord.GMTDate
          Class definition for a dummy variable
 
Field Summary
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Constructor Summary
protected DateRecord(DateCell dc)
          Constructor invoked when copying a readable spreadsheet
protected DateRecord(int c, int r, java.util.Date d)
          Constructor invoked by the user API
protected DateRecord(int c, int r, java.util.Date d, CellFormat st)
          Constructor invoked from the user API
protected DateRecord(int c, int r, java.util.Date d, CellFormat st, boolean tim)
          Constructor invoked from the API
protected DateRecord(int c, int r, java.util.Date d, CellFormat st, DateRecord.GMTDate a)
          Constructor invoked from the user API
protected DateRecord(int c, int r, java.util.Date d, DateRecord.GMTDate a)
          Constructor invoked by the user API
protected DateRecord(int c, int r, DateRecord dr)
          Copy constructor
 
Method Summary
 java.lang.String getContents()
          Quick and dirty function to return the contents of this cell as a string.
 byte[] getData()
          Gets the binary data for writing
 java.util.Date getDate()
          Gets the date contained in this cell
 java.text.DateFormat getDateFormat()
          Gets the DateFormat used to format the cell.
 CellType getType()
          Returns the content type of this cell
 boolean isTime()
          Indicates whether the date value contained in this cell refers to a date, or merely a time.
protected  void setDate(java.util.Date d)
          Sets the date in this cell
protected  void setDate(java.util.Date d, DateRecord.GMTDate a)
          Sets the date in this cell, taking the timezone into account
 
Methods inherited from class jxl.write.biff.CellValue
addCellFeatures, getCellFeatures, getCellFormat, getColumn, getRow, getSheet, getWritableCellFeatures, isHidden, removeComment, setCellFeatures, setCellFormat
 
Methods inherited from class jxl.biff.WritableRecordData
getBytes
 
Methods inherited from class jxl.biff.RecordData
getCode, getRecord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jxl.write.WritableCell
copyTo
 

Constructor Detail

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d)
Constructor invoked by the user API

Parameters:
c - the column
r - the row
d - the date

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     DateRecord.GMTDate a)
Constructor invoked by the user API

Parameters:
c - the column
r - the row
d - the date
a - adjust timezone

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     CellFormat st)
Constructor invoked from the user API

Parameters:
c - the column
r - the row
st - the format for the date
d - the date

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     CellFormat st,
                     DateRecord.GMTDate a)
Constructor invoked from the user API

Parameters:
c - the column
r - the row
st - the format for the date
d - the date
a - adjust for the timezone

DateRecord

protected DateRecord(int c,
                     int r,
                     java.util.Date d,
                     CellFormat st,
                     boolean tim)
Constructor invoked from the API

Parameters:
c - the column
r - the row
st - the date format
tim - time indicator
d - the date

DateRecord

protected DateRecord(DateCell dc)
Constructor invoked when copying a readable spreadsheet

Parameters:
dc - the date to copy

DateRecord

protected DateRecord(int c,
                     int r,
                     DateRecord dr)
Copy constructor

Parameters:
c - the column
r - the row
dr - the record to copy
Method Detail

getType

public CellType getType()
Returns the content type of this cell

Returns:
the content type for this cell

getData

public byte[] getData()
Gets the binary data for writing

Overrides:
getData in class CellValue
Returns:
the binary data

getContents

public java.lang.String getContents()
Quick and dirty function to return the contents of this cell as a string. For more complex manipulation of the contents, it is necessary to cast this interface to correct subinterface

Returns:
the contents of this cell as a string

setDate

protected void setDate(java.util.Date d)
Sets the date in this cell

Parameters:
d - the date

setDate

protected void setDate(java.util.Date d,
                       DateRecord.GMTDate a)
Sets the date in this cell, taking the timezone into account

Parameters:
d - the date
a - adjust for timezone

getDate

public java.util.Date getDate()
Gets the date contained in this cell

Returns:
the cell contents

isTime

public boolean isTime()
Indicates whether the date value contained in this cell refers to a date, or merely a time. When writing a cell, all dates are fully defined, even if they refer to a time

Returns:
FALSE if this is full date, TRUE if a time

getDateFormat

public java.text.DateFormat getDateFormat()
Gets the DateFormat used to format the cell. This will normally be the format specified in the excel spreadsheet, but in the event of any difficulty parsing this, it will revert to the default date/time format.

Returns:
the DateFormat object used to format the date in the original excel cell