FileDocCategorySizeDatePackage
AreaFormatRecord.javaAPI DocApache Poi 3.0.19590Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record

AreaFormatRecord

public class AreaFormatRecord extends Record
The area format record is used to define the colours and patterns for an area. NOTE: This source is automatically generated please do not modify this file. Either subclass or remove the record in src/records/definitions.
author
Glen Stampoultzis (glens at apache.org)

Fields Summary
public static final short
sid
private int
field_1_foregroundColor
private int
field_2_backgroundColor
private short
field_3_pattern
private short
field_4_formatFlags
private BitField
automatic
private BitField
invert
private short
field_5_forecolorIndex
private short
field_6_backcolorIndex
Constructors Summary
public AreaFormatRecord()



     
    

    
public AreaFormatRecord(RecordInputStream in)
Constructs a AreaFormat record and sets its fields appropriately.

param
id id must be 0x100a or an exception will be throw upon validation
param
size size the size of the data area of the record
param
data data of the record (should not contain sid/len)

        super(in);
    
    
Methods Summary
public java.lang.Objectclone()

        AreaFormatRecord rec = new AreaFormatRecord();
    
        rec.field_1_foregroundColor = field_1_foregroundColor;
        rec.field_2_backgroundColor = field_2_backgroundColor;
        rec.field_3_pattern = field_3_pattern;
        rec.field_4_formatFlags = field_4_formatFlags;
        rec.field_5_forecolorIndex = field_5_forecolorIndex;
        rec.field_6_backcolorIndex = field_6_backcolorIndex;
        return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_foregroundColor        = in.readInt();
        field_2_backgroundColor        = in.readInt();
        field_3_pattern                = in.readShort();
        field_4_formatFlags            = in.readShort();
        field_5_forecolorIndex         = in.readShort();
        field_6_backcolorIndex         = in.readShort();

    
public shortgetBackcolorIndex()
Get the backcolor index field for the AreaFormat record.

        return field_6_backcolorIndex;
    
public intgetBackgroundColor()
Get the background color field for the AreaFormat record.

        return field_2_backgroundColor;
    
public shortgetForecolorIndex()
Get the forecolor index field for the AreaFormat record.

        return field_5_forecolorIndex;
    
public intgetForegroundColor()
Get the foreground color field for the AreaFormat record.

        return field_1_foregroundColor;
    
public shortgetFormatFlags()
Get the format flags field for the AreaFormat record.

        return field_4_formatFlags;
    
public shortgetPattern()
Get the pattern field for the AreaFormat record.

        return field_3_pattern;
    
public intgetRecordSize()
Size of record (exluding 4 byte header)

        return 4  + 4 + 4 + 2 + 2 + 2 + 2;
    
public shortgetSid()

        return sid;
    
public booleanisAutomatic()
automatic formatting

return
the automatic field value.

        return automatic.isSet(field_4_formatFlags);
    
public booleanisInvert()
swap foreground and background colours when data is negative

return
the invert field value.

        return invert.isSet(field_4_formatFlags);
    
public intserialize(int offset, byte[] data)

        int pos = 0;

        LittleEndian.putShort(data, 0 + offset, sid);
        LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));

        LittleEndian.putInt(data, 4 + offset + pos, field_1_foregroundColor);
        LittleEndian.putInt(data, 8 + offset + pos, field_2_backgroundColor);
        LittleEndian.putShort(data, 12 + offset + pos, field_3_pattern);
        LittleEndian.putShort(data, 14 + offset + pos, field_4_formatFlags);
        LittleEndian.putShort(data, 16 + offset + pos, field_5_forecolorIndex);
        LittleEndian.putShort(data, 18 + offset + pos, field_6_backcolorIndex);

        return getRecordSize();
    
public voidsetAutomatic(boolean value)
Sets the automatic field value. automatic formatting

        field_4_formatFlags = automatic.setShortBoolean(field_4_formatFlags, value);
    
public voidsetBackcolorIndex(short field_6_backcolorIndex)
Set the backcolor index field for the AreaFormat record.

        this.field_6_backcolorIndex = field_6_backcolorIndex;
    
public voidsetBackgroundColor(int field_2_backgroundColor)
Set the background color field for the AreaFormat record.

        this.field_2_backgroundColor = field_2_backgroundColor;
    
public voidsetForecolorIndex(short field_5_forecolorIndex)
Set the forecolor index field for the AreaFormat record.

        this.field_5_forecolorIndex = field_5_forecolorIndex;
    
public voidsetForegroundColor(int field_1_foregroundColor)
Set the foreground color field for the AreaFormat record.

        this.field_1_foregroundColor = field_1_foregroundColor;
    
public voidsetFormatFlags(short field_4_formatFlags)
Set the format flags field for the AreaFormat record.

        this.field_4_formatFlags = field_4_formatFlags;
    
public voidsetInvert(boolean value)
Sets the invert field value. swap foreground and background colours when data is negative

        field_4_formatFlags = invert.setShortBoolean(field_4_formatFlags, value);
    
public voidsetPattern(short field_3_pattern)
Set the pattern field for the AreaFormat record.

        this.field_3_pattern = field_3_pattern;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();

        buffer.append("[AREAFORMAT]\n");
        buffer.append("    .foregroundColor      = ")
            .append("0x").append(HexDump.toHex(  getForegroundColor ()))
            .append(" (").append( getForegroundColor() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .backgroundColor      = ")
            .append("0x").append(HexDump.toHex(  getBackgroundColor ()))
            .append(" (").append( getBackgroundColor() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .pattern              = ")
            .append("0x").append(HexDump.toHex(  getPattern ()))
            .append(" (").append( getPattern() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .formatFlags          = ")
            .append("0x").append(HexDump.toHex(  getFormatFlags ()))
            .append(" (").append( getFormatFlags() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("         .automatic                = ").append(isAutomatic()).append('\n"); 
        buffer.append("         .invert                   = ").append(isInvert()).append('\n"); 
        buffer.append("    .forecolorIndex       = ")
            .append("0x").append(HexDump.toHex(  getForecolorIndex ()))
            .append(" (").append( getForecolorIndex() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .backcolorIndex       = ")
            .append("0x").append(HexDump.toHex(  getBackcolorIndex ()))
            .append(" (").append( getBackcolorIndex() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 

        buffer.append("[/AREAFORMAT]\n");
        return buffer.toString();
    
protected voidvalidateSid(short id)
Checks the sid matches the expected side for this record

param
id the expected sid.

        if (id != sid)
        {
            throw new RecordFormatException("Not a AreaFormat record");
        }