jxl.biff
Class PaletteRecord

java.lang.Object
  |
  +--jxl.biff.RecordData
        |
        +--jxl.biff.WritableRecordData
              |
              +--jxl.biff.PaletteRecord
All Implemented Interfaces:
ByteData

public class PaletteRecord
extends WritableRecordData

A record representing the RGB colour palette


Inner Class Summary
private static class PaletteRecord.RGB
          The internal RGB structure
 
Field Summary
private  boolean dirty
          A dirty flag indicating that this palette has been tampered with in some way
private  boolean initialized
          Initialized flag
private static int numColours
          The number of colours in the palette
private  boolean read
          Flag indicating that the palette was read in
private  PaletteRecord.RGB[] rgbColours
          The list of bespoke rgb colours used by this sheet
 
Fields inherited from class jxl.biff.WritableRecordData
maxRecordLength
 
Fields inherited from class jxl.biff.RecordData
code, record
 
Constructor Summary
PaletteRecord()
          Default constructor - used when there is no palette specified
PaletteRecord(Record t)
          Constructor
 
Method Summary
 byte[] getData()
          Accessor for the binary data - used when copying
private  void initialize()
          Initialize the record data
 boolean isDirty()
          Accessor for the dirty flag, which indicates if this palette has been modified
 void setColourRGB(Colour c, int r, int g, int b)
          Sets the RGB value for the specified colour for this workbook
private  int setValueRange(int val, int min, int max)
          Forces the value passed in to be between the range passed in
 
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
 

Field Detail

rgbColours

private PaletteRecord.RGB[] rgbColours
The list of bespoke rgb colours used by this sheet

dirty

private boolean dirty
A dirty flag indicating that this palette has been tampered with in some way

read

private boolean read
Flag indicating that the palette was read in

initialized

private boolean initialized
Initialized flag

numColours

private static final int numColours
The number of colours in the palette
Constructor Detail

PaletteRecord

public PaletteRecord(Record t)
Constructor
Parameters:
t - the raw bytes

PaletteRecord

public PaletteRecord()
Default constructor - used when there is no palette specified
Method Detail

getData

public byte[] getData()
Accessor for the binary data - used when copying
Overrides:
getData in class WritableRecordData
Returns:
the binary data

initialize

private void initialize()
Initialize the record data

isDirty

public boolean isDirty()
Accessor for the dirty flag, which indicates if this palette has been modified
Returns:
TRUE if the palette has been modified, FALSE if it is the default

setColourRGB

public void setColourRGB(Colour c,
                         int r,
                         int g,
                         int b)
Sets the RGB value for the specified colour for this workbook
Parameters:
c - the colour whose RGB value is to be overwritten
r - the red portion to set (0-255)
g - the green portion to set (0-255)
b - the blue portion to set (0-255)

setValueRange

private int setValueRange(int val,
                          int min,
                          int max)
Forces the value passed in to be between the range passed in
Parameters:
val - the value to constrain
min - the minimum acceptable value
max - the maximum acceptable value
Returns:
the constrained value