001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.record;
019:
020: import org.apache.poi.util.*;
021:
022: /**
023: * 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)
024: * NOTE: This source is automatically generated please do not modify this file. Either subclass or
025: * remove the record in src/records/definitions.
026:
027: * @author Andrew C. Oliver (acoliver at apache.org)
028: */
029: public class SeriesToChartGroupRecord extends Record {
030: public final static short sid = 0x1045;
031: private short field_1_chartGroupIndex;
032:
033: public SeriesToChartGroupRecord() {
034:
035: }
036:
037: /**
038: * Constructs a SeriesToChartGroup record and sets its fields appropriately.
039: *
040: * @param in the RecordInputstream to read the record from
041: */
042:
043: public SeriesToChartGroupRecord(RecordInputStream in) {
044: super (in);
045:
046: }
047:
048: /**
049: * Checks the sid matches the expected side for this record
050: *
051: * @param id the expected sid.
052: */
053: protected void validateSid(short id) {
054: if (id != sid) {
055: throw new RecordFormatException(
056: "Not a SeriesToChartGroup record");
057: }
058: }
059:
060: protected void fillFields(RecordInputStream in) {
061: field_1_chartGroupIndex = in.readShort();
062: }
063:
064: public String toString() {
065: StringBuffer buffer = new StringBuffer();
066:
067: buffer.append("[SeriesToChartGroup]\n");
068: buffer.append(" .chartGroupIndex = ").append("0x")
069: .append(HexDump.toHex(getChartGroupIndex())).append(
070: " (").append(getChartGroupIndex()).append(" )");
071: buffer.append(System.getProperty("line.separator"));
072:
073: buffer.append("[/SeriesToChartGroup]\n");
074: return buffer.toString();
075: }
076:
077: public int serialize(int offset, byte[] data) {
078: int pos = 0;
079:
080: LittleEndian.putShort(data, 0 + offset, sid);
081: LittleEndian.putShort(data, 2 + offset,
082: (short) (getRecordSize() - 4));
083:
084: LittleEndian.putShort(data, 4 + offset + pos,
085: field_1_chartGroupIndex);
086:
087: return getRecordSize();
088: }
089:
090: /**
091: * Size of record (exluding 4 byte header)
092: */
093: public int getRecordSize() {
094: return 4 + 2;
095: }
096:
097: public short getSid() {
098: return sid;
099: }
100:
101: public Object clone() {
102: SeriesToChartGroupRecord rec = new SeriesToChartGroupRecord();
103:
104: rec.field_1_chartGroupIndex = field_1_chartGroupIndex;
105: return rec;
106: }
107:
108: /**
109: * Get the chart group index field for the SeriesToChartGroup record.
110: */
111: public short getChartGroupIndex() {
112: return field_1_chartGroupIndex;
113: }
114:
115: /**
116: * Set the chart group index field for the SeriesToChartGroup record.
117: */
118: public void setChartGroupIndex(short field_1_chartGroupIndex) {
119: this .field_1_chartGroupIndex = field_1_chartGroupIndex;
120: }
121:
122: } // END OF CLASS
|