jxl.biff
Class FormatRecord

java.lang.Object
  |
  +--jxl.biff.RecordData
        |
        +--jxl.biff.WritableRecordData
              |
              +--jxl.biff.FormatRecord
All Implemented Interfaces:
ByteData, DisplayFormat, Format
Direct Known Subclasses:
DateFormatRecord, NumberFormatRecord

public class FormatRecord
extends WritableRecordData
implements DisplayFormat, Format

A non-built format record


Inner Class Summary
private static class FormatRecord.BiffType
           
 
Field Summary
static FormatRecord.BiffType biff7
           
static FormatRecord.BiffType biff8
           
private  byte[] data
          The raw data
private  boolean date
          Indicates whether this is a date formatting record
private static java.lang.String[] dateStrings
           
private  java.text.Format format
          The format object
private  java.lang.String formatString
          The formatting string
private  int indexCode
          The index code
private  boolean initialized
          Initialized flag
private  boolean number
          Indicates whether this a number formatting record
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Fields inherited from class jxl.biff.RecordData
code, record
 
Constructor Summary
protected FormatRecord()
          Constructor used by writable formats
protected FormatRecord(FormatRecord fr)
          Copy constructor - can be invoked by public access
  FormatRecord(Record t, WorkbookSettings ws, FormatRecord.BiffType biffType)
          Constructs this object from the raw data.
(package private) FormatRecord(java.lang.String fmt, int refno)
          Constructor invoked when copying sheets
 
Method Summary
 boolean equals(java.lang.Object o)
          Standard equals method.
 byte[] getData()
          Used to get the data when writing out the format record
 java.text.DateFormat getDateFormat()
          Gets the java equivalent date format for the formatString
 int getFormatIndex()
          Gets the format index of this record
 java.lang.String getFormatString()
          Gets the formatting string.
 int getIndexCode()
          Gets the index code, for use as a hash value
 java.text.NumberFormat getNumberFormat()
          Gets the java equivalent number format for the formatString
 void initialize(int pos)
          Sets the index of this record.
 boolean isBuiltIn()
          Indicates whether this formula is a built in
 boolean isDate()
          Sees if this format is a date format
 boolean isInitialized()
          Accessor to see whether this object is initialized or not.
 boolean isNumber()
          Sees if this format is a number format
protected  java.lang.String replace(java.lang.String input, java.lang.String search, java.lang.String replace)
          Replaces all instances of search with replace in the input.
protected  void setFormatString(java.lang.String s)
          Called by the immediate subclass to set the string once the Java-Excel replacements have been done
 
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, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

initialized

private boolean initialized
Initialized flag

data

private byte[] data
The raw data

indexCode

private int indexCode
The index code

formatString

private java.lang.String formatString
The formatting string

date

private boolean date
Indicates whether this is a date formatting record

number

private boolean number
Indicates whether this a number formatting record

format

private java.text.Format format
The format object

dateStrings

private static java.lang.String[] dateStrings

biff8

public static final FormatRecord.BiffType biff8

biff7

public static final FormatRecord.BiffType biff7
Constructor Detail

FormatRecord

FormatRecord(java.lang.String fmt,
             int refno)
Constructor invoked when copying sheets

FormatRecord

protected FormatRecord()
Constructor used by writable formats

FormatRecord

protected FormatRecord(FormatRecord fr)
Copy constructor - can be invoked by public access

FormatRecord

public FormatRecord(Record t,
                    WorkbookSettings ws,
                    FormatRecord.BiffType biffType)
Constructs this object from the raw data. Used when reading in a format record
Parameters:
t - the raw data
Method Detail

getData

public byte[] getData()
Used to get the data when writing out the format record
Overrides:
getData in class WritableRecordData
Following copied from class: jxl.biff.WritableRecordData
Returns:
subclass specific biff data

getFormatIndex

public int getFormatIndex()
Gets the format index of this record
Specified by:
getFormatIndex in interface DisplayFormat
Returns:
the format index of this record

isInitialized

public boolean isInitialized()
Accessor to see whether this object is initialized or not.
Specified by:
isInitialized in interface DisplayFormat
Returns:
TRUE if this font record has been initialized, FALSE otherwise

initialize

public void initialize(int pos)
Sets the index of this record. Called from the FormattingRecords object
Specified by:
initialize in interface DisplayFormat
Parameters:
pos - the position of this font in the workbooks font list

replace

protected final java.lang.String replace(java.lang.String input,
                                         java.lang.String search,
                                         java.lang.String replace)
Replaces all instances of search with replace in the input. Used for replacing microsoft number formatting characters with java equivalents
Parameters:
input - the format string
search - the Excel character to be replaced
replace - the java equivalent
Returns:
the input string with the specified substring replaced

setFormatString

protected final void setFormatString(java.lang.String s)
Called by the immediate subclass to set the string once the Java-Excel replacements have been done

isDate

public final boolean isDate()
Sees if this format is a date format
Returns:
TRUE if this format is a date

isNumber

public final boolean isNumber()
Sees if this format is a number format
Returns:
TRUE if this format is a number

getNumberFormat

public final java.text.NumberFormat getNumberFormat()
Gets the java equivalent number format for the formatString
Returns:
The java equivalent of the number format for this object

getDateFormat

public final java.text.DateFormat getDateFormat()
Gets the java equivalent date format for the formatString
Returns:
The java equivalent of the date format for this object

getIndexCode

public int getIndexCode()
Gets the index code, for use as a hash value
Returns:
the ifmt code for this cell

getFormatString

public java.lang.String getFormatString()
Gets the formatting string.
Specified by:
getFormatString in interface Format
Returns:
the excel format string

isBuiltIn

public boolean isBuiltIn()
Indicates whether this formula is a built in
Specified by:
isBuiltIn in interface DisplayFormat
Returns:
FALSE

equals

public boolean equals(java.lang.Object o)
Standard equals method. This compares the contents of two format records, and not their indexCodes, which are ignored
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare
Returns:
TRUE if the two objects are equal, FALSE otherwise