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

LegendRecord

public class LegendRecord extends Record
Defines a legend for a chart. NOTE: This source is automatically generated please do not modify this file. Either subclass or remove the record in src/records/definitions.
author
Andrew C. Oliver (acoliver at apache.org)

Fields Summary
public static final short
sid
private int
field_1_xAxisUpperLeft
private int
field_2_yAxisUpperLeft
private int
field_3_xSize
private int
field_4_ySize
private byte
field_5_type
public static final byte
TYPE_BOTTOM
public static final byte
TYPE_CORNER
public static final byte
TYPE_TOP
public static final byte
TYPE_RIGHT
public static final byte
TYPE_LEFT
public static final byte
TYPE_UNDOCKED
private byte
field_6_spacing
public static final byte
SPACING_CLOSE
public static final byte
SPACING_MEDIUM
public static final byte
SPACING_OPEN
private short
field_7_options
private BitField
autoPosition
private BitField
autoSeries
private BitField
autoXPositioning
private BitField
autoYPositioning
private BitField
vertical
private BitField
dataTable
Constructors Summary
public LegendRecord()



     
    

    
public LegendRecord(RecordInputStream in)
Constructs a Legend record and sets its fields appropriately.

param
id id must be 0x1015 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()

        LegendRecord rec = new LegendRecord();
    
        rec.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft;
        rec.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft;
        rec.field_3_xSize = field_3_xSize;
        rec.field_4_ySize = field_4_ySize;
        rec.field_5_type = field_5_type;
        rec.field_6_spacing = field_6_spacing;
        rec.field_7_options = field_7_options;
        return rec;
    
protected voidfillFields(org.apache.poi.hssf.record.RecordInputStream in)

        field_1_xAxisUpperLeft         = in.readInt();
        field_2_yAxisUpperLeft         = in.readInt();
        field_3_xSize                  = in.readInt();
        field_4_ySize                  = in.readInt();
        field_5_type                   = in.readByte();
        field_6_spacing                = in.readByte();
        field_7_options                = in.readShort();
    
public shortgetOptions()
Get the options field for the Legend record.

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

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

        return sid;
    
public bytegetSpacing()
Get the spacing field for the Legend record.

return
One of SPACING_CLOSE SPACING_MEDIUM SPACING_OPEN

        return field_6_spacing;
    
public bytegetType()
Get the type field for the Legend record.

return
One of TYPE_BOTTOM TYPE_CORNER TYPE_TOP TYPE_RIGHT TYPE_LEFT TYPE_UNDOCKED

        return field_5_type;
    
public intgetXAxisUpperLeft()
Get the x axis upper left field for the Legend record.

        return field_1_xAxisUpperLeft;
    
public intgetXSize()
Get the x size field for the Legend record.

        return field_3_xSize;
    
public intgetYAxisUpperLeft()
Get the y axis upper left field for the Legend record.

        return field_2_yAxisUpperLeft;
    
public intgetYSize()
Get the y size field for the Legend record.

        return field_4_ySize;
    
public booleanisAutoPosition()
automatic positioning (1=docked)

return
the auto position field value.

        return autoPosition.isSet(field_7_options);
    
public booleanisAutoSeries()
excel 5 only (true)

return
the auto series field value.

        return autoSeries.isSet(field_7_options);
    
public booleanisAutoXPositioning()
position of legend on the x axis is automatic

return
the auto x positioning field value.

        return autoXPositioning.isSet(field_7_options);
    
public booleanisAutoYPositioning()
position of legend on the y axis is automatic

return
the auto y positioning field value.

        return autoYPositioning.isSet(field_7_options);
    
public booleanisDataTable()
1 if chart contains data table

return
the data table field value.

        return dataTable.isSet(field_7_options);
    
public booleanisVertical()
vertical or horizontal legend (1 or 0 respectively). Always 0 if not automatic.

return
the vertical field value.

        return vertical.isSet(field_7_options);
    
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_xAxisUpperLeft);
        LittleEndian.putInt(data, 8 + offset + pos, field_2_yAxisUpperLeft);
        LittleEndian.putInt(data, 12 + offset + pos, field_3_xSize);
        LittleEndian.putInt(data, 16 + offset + pos, field_4_ySize);
        data[ 20 + offset + pos ] = field_5_type;
        data[ 21 + offset + pos ] = field_6_spacing;
        LittleEndian.putShort(data, 22 + offset + pos, field_7_options);

        return getRecordSize();
    
public voidsetAutoPosition(boolean value)
Sets the auto position field value. automatic positioning (1=docked)

        field_7_options = autoPosition.setShortBoolean(field_7_options, value);
    
public voidsetAutoSeries(boolean value)
Sets the auto series field value. excel 5 only (true)

        field_7_options = autoSeries.setShortBoolean(field_7_options, value);
    
public voidsetAutoXPositioning(boolean value)
Sets the auto x positioning field value. position of legend on the x axis is automatic

        field_7_options = autoXPositioning.setShortBoolean(field_7_options, value);
    
public voidsetAutoYPositioning(boolean value)
Sets the auto y positioning field value. position of legend on the y axis is automatic

        field_7_options = autoYPositioning.setShortBoolean(field_7_options, value);
    
public voidsetDataTable(boolean value)
Sets the data table field value. 1 if chart contains data table

        field_7_options = dataTable.setShortBoolean(field_7_options, value);
    
public voidsetOptions(short field_7_options)
Set the options field for the Legend record.

        this.field_7_options = field_7_options;
    
public voidsetSpacing(byte field_6_spacing)
Set the spacing field for the Legend record.

param
field_6_spacing One of SPACING_CLOSE SPACING_MEDIUM SPACING_OPEN

        this.field_6_spacing = field_6_spacing;
    
public voidsetType(byte field_5_type)
Set the type field for the Legend record.

param
field_5_type One of TYPE_BOTTOM TYPE_CORNER TYPE_TOP TYPE_RIGHT TYPE_LEFT TYPE_UNDOCKED

        this.field_5_type = field_5_type;
    
public voidsetVertical(boolean value)
Sets the vertical field value. vertical or horizontal legend (1 or 0 respectively). Always 0 if not automatic.

        field_7_options = vertical.setShortBoolean(field_7_options, value);
    
public voidsetXAxisUpperLeft(int field_1_xAxisUpperLeft)
Set the x axis upper left field for the Legend record.

        this.field_1_xAxisUpperLeft = field_1_xAxisUpperLeft;
    
public voidsetXSize(int field_3_xSize)
Set the x size field for the Legend record.

        this.field_3_xSize = field_3_xSize;
    
public voidsetYAxisUpperLeft(int field_2_yAxisUpperLeft)
Set the y axis upper left field for the Legend record.

        this.field_2_yAxisUpperLeft = field_2_yAxisUpperLeft;
    
public voidsetYSize(int field_4_ySize)
Set the y size field for the Legend record.

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

        StringBuffer buffer = new StringBuffer();

        buffer.append("[LEGEND]\n");
        buffer.append("    .xAxisUpperLeft       = ")
            .append("0x").append(HexDump.toHex(  getXAxisUpperLeft ()))
            .append(" (").append( getXAxisUpperLeft() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .yAxisUpperLeft       = ")
            .append("0x").append(HexDump.toHex(  getYAxisUpperLeft ()))
            .append(" (").append( getYAxisUpperLeft() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .xSize                = ")
            .append("0x").append(HexDump.toHex(  getXSize ()))
            .append(" (").append( getXSize() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .ySize                = ")
            .append("0x").append(HexDump.toHex(  getYSize ()))
            .append(" (").append( getYSize() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .type                 = ")
            .append("0x").append(HexDump.toHex(  getType ()))
            .append(" (").append( getType() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .spacing              = ")
            .append("0x").append(HexDump.toHex(  getSpacing ()))
            .append(" (").append( getSpacing() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("    .options              = ")
            .append("0x").append(HexDump.toHex(  getOptions ()))
            .append(" (").append( getOptions() ).append(" )");
        buffer.append(System.getProperty("line.separator")); 
        buffer.append("         .autoPosition             = ").append(isAutoPosition()).append('\n"); 
        buffer.append("         .autoSeries               = ").append(isAutoSeries()).append('\n"); 
        buffer.append("         .autoXPositioning         = ").append(isAutoXPositioning()).append('\n"); 
        buffer.append("         .autoYPositioning         = ").append(isAutoYPositioning()).append('\n"); 
        buffer.append("         .vertical                 = ").append(isVertical()).append('\n"); 
        buffer.append("         .dataTable                = ").append(isDataTable()).append('\n"); 

        buffer.append("[/LEGEND]\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 Legend record");
        }