Inspired by bug #44958 - Record level support for Data Tables. (No formula parser...
[poi.git] / src / java / org / apache / poi / hssf / record / SeriesToChartGroupRecord.java
blob96e882e7c5a4a78aa2845714348246263755ffa7
2 /* ====================================================================
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================== */
20 package org.apache.poi.hssf.record;
24 import org.apache.poi.util.*;
26 /**
27 * Indicates the chart-group index for a series. The order probably defines the mapping. So the 0th record probably means the 0th series. The only field in this of course defines which chart group the 0th series (for instance) would map to. Confusing? Well thats because it is. (p 522 BCG)
28 * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29 * remove the record in src/records/definitions.
31 * @author Andrew C. Oliver (acoliver at apache.org)
33 public class SeriesToChartGroupRecord
34 extends Record
36 public final static short sid = 0x1045;
37 private short field_1_chartGroupIndex;
40 public SeriesToChartGroupRecord()
45 /**
46 * Constructs a SeriesToChartGroup record and sets its fields appropriately.
48 * @param in the RecordInputstream to read the record from
51 public SeriesToChartGroupRecord(RecordInputStream in)
53 super(in);
57 /**
58 * Checks the sid matches the expected side for this record
60 * @param id the expected sid.
62 protected void validateSid(short id)
64 if (id != sid)
66 throw new RecordFormatException("Not a SeriesToChartGroup record");
70 protected void fillFields(RecordInputStream in)
72 field_1_chartGroupIndex = in.readShort();
75 public String toString()
77 StringBuffer buffer = new StringBuffer();
79 buffer.append("[SeriesToChartGroup]\n");
80 buffer.append(" .chartGroupIndex = ")
81 .append("0x").append(HexDump.toHex( getChartGroupIndex ()))
82 .append(" (").append( getChartGroupIndex() ).append(" )");
83 buffer.append(System.getProperty("line.separator"));
85 buffer.append("[/SeriesToChartGroup]\n");
86 return buffer.toString();
89 public int serialize(int offset, byte[] data)
91 int pos = 0;
93 LittleEndian.putShort(data, 0 + offset, sid);
94 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
96 LittleEndian.putShort(data, 4 + offset + pos, field_1_chartGroupIndex);
98 return getRecordSize();
102 * Size of record (exluding 4 byte header)
104 public int getRecordSize()
106 return 4 + 2;
109 public short getSid()
111 return sid;
114 public Object clone() {
115 SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord();
117 rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
118 return rec;
125 * Get the chart group index field for the SeriesToChartGroup record.
127 public short getChartGroupIndex()
129 return field_1_chartGroupIndex;
133 * Set the chart group index field for the SeriesToChartGroup record.
135 public void setChartGroupIndex(short field_1_chartGroupIndex)
137 this.field_1_chartGroupIndex = field_1_chartGroupIndex;
141 } // END OF CLASS