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: * The series label record defines the type of label associated with the data format record.
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 Glen Stampoultzis (glens at apache.org)
028: */
029: public class SeriesLabelsRecord extends Record {
030: public final static short sid = 0x100c;
031: private short field_1_formatFlags;
032: private BitField showActual = BitFieldFactory.getInstance(0x1);
033: private BitField showPercent = BitFieldFactory.getInstance(0x2);
034: private BitField labelAsPercentage = BitFieldFactory
035: .getInstance(0x4);
036: private BitField smoothedLine = BitFieldFactory.getInstance(0x8);
037: private BitField showLabel = BitFieldFactory.getInstance(0x10);
038: private BitField showBubbleSizes = BitFieldFactory
039: .getInstance(0x20);
040:
041: public SeriesLabelsRecord() {
042:
043: }
044:
045: /**
046: * Constructs a SeriesLabels record and sets its fields appropriately.
047: *
048: * @param in the RecordInputstream to read the record from
049: */
050:
051: public SeriesLabelsRecord(RecordInputStream in) {
052: super (in);
053:
054: }
055:
056: /**
057: * Checks the sid matches the expected side for this record
058: *
059: * @param id the expected sid.
060: */
061: protected void validateSid(short id) {
062: if (id != sid) {
063: throw new RecordFormatException("Not a SeriesLabels record");
064: }
065: }
066:
067: protected void fillFields(RecordInputStream in) {
068: field_1_formatFlags = in.readShort();
069: }
070:
071: public String toString() {
072: StringBuffer buffer = new StringBuffer();
073:
074: buffer.append("[ATTACHEDLABEL]\n");
075: buffer.append(" .formatFlags = ").append("0x")
076: .append(HexDump.toHex(getFormatFlags())).append(" (")
077: .append(getFormatFlags()).append(" )");
078: buffer.append(System.getProperty("line.separator"));
079: buffer.append(" .showActual = ").append(
080: isShowActual()).append('\n');
081: buffer.append(" .showPercent = ").append(
082: isShowPercent()).append('\n');
083: buffer.append(" .labelAsPercentage = ").append(
084: isLabelAsPercentage()).append('\n');
085: buffer.append(" .smoothedLine = ").append(
086: isSmoothedLine()).append('\n');
087: buffer.append(" .showLabel = ").append(
088: isShowLabel()).append('\n');
089: buffer.append(" .showBubbleSizes = ").append(
090: isShowBubbleSizes()).append('\n');
091:
092: buffer.append("[/ATTACHEDLABEL]\n");
093: return buffer.toString();
094: }
095:
096: public int serialize(int offset, byte[] data) {
097: int pos = 0;
098:
099: LittleEndian.putShort(data, 0 + offset, sid);
100: LittleEndian.putShort(data, 2 + offset,
101: (short) (getRecordSize() - 4));
102:
103: LittleEndian.putShort(data, 4 + offset + pos,
104: field_1_formatFlags);
105:
106: return getRecordSize();
107: }
108:
109: /**
110: * Size of record (exluding 4 byte header)
111: */
112: public int getRecordSize() {
113: return 4 + 2;
114: }
115:
116: public short getSid() {
117: return sid;
118: }
119:
120: public Object clone() {
121: SeriesLabelsRecord rec = new SeriesLabelsRecord();
122:
123: rec.field_1_formatFlags = field_1_formatFlags;
124: return rec;
125: }
126:
127: /**
128: * Get the format flags field for the SeriesLabels record.
129: */
130: public short getFormatFlags() {
131: return field_1_formatFlags;
132: }
133:
134: /**
135: * Set the format flags field for the SeriesLabels record.
136: */
137: public void setFormatFlags(short field_1_formatFlags) {
138: this .field_1_formatFlags = field_1_formatFlags;
139: }
140:
141: /**
142: * Sets the show actual field value.
143: * show actual value of the data point
144: */
145: public void setShowActual(boolean value) {
146: field_1_formatFlags = showActual.setShortBoolean(
147: field_1_formatFlags, value);
148: }
149:
150: /**
151: * show actual value of the data point
152: * @return the show actual field value.
153: */
154: public boolean isShowActual() {
155: return showActual.isSet(field_1_formatFlags);
156: }
157:
158: /**
159: * Sets the show percent field value.
160: * show value as percentage of total (pie charts only)
161: */
162: public void setShowPercent(boolean value) {
163: field_1_formatFlags = showPercent.setShortBoolean(
164: field_1_formatFlags, value);
165: }
166:
167: /**
168: * show value as percentage of total (pie charts only)
169: * @return the show percent field value.
170: */
171: public boolean isShowPercent() {
172: return showPercent.isSet(field_1_formatFlags);
173: }
174:
175: /**
176: * Sets the label as percentage field value.
177: * show category label/value as percentage (pie charts only)
178: */
179: public void setLabelAsPercentage(boolean value) {
180: field_1_formatFlags = labelAsPercentage.setShortBoolean(
181: field_1_formatFlags, value);
182: }
183:
184: /**
185: * show category label/value as percentage (pie charts only)
186: * @return the label as percentage field value.
187: */
188: public boolean isLabelAsPercentage() {
189: return labelAsPercentage.isSet(field_1_formatFlags);
190: }
191:
192: /**
193: * Sets the smoothed line field value.
194: * show smooth line
195: */
196: public void setSmoothedLine(boolean value) {
197: field_1_formatFlags = smoothedLine.setShortBoolean(
198: field_1_formatFlags, value);
199: }
200:
201: /**
202: * show smooth line
203: * @return the smoothed line field value.
204: */
205: public boolean isSmoothedLine() {
206: return smoothedLine.isSet(field_1_formatFlags);
207: }
208:
209: /**
210: * Sets the show label field value.
211: * display category label
212: */
213: public void setShowLabel(boolean value) {
214: field_1_formatFlags = showLabel.setShortBoolean(
215: field_1_formatFlags, value);
216: }
217:
218: /**
219: * display category label
220: * @return the show label field value.
221: */
222: public boolean isShowLabel() {
223: return showLabel.isSet(field_1_formatFlags);
224: }
225:
226: /**
227: * Sets the show bubble sizes field value.
228: * ??
229: */
230: public void setShowBubbleSizes(boolean value) {
231: field_1_formatFlags = showBubbleSizes.setShortBoolean(
232: field_1_formatFlags, value);
233: }
234:
235: /**
236: * ??
237: * @return the show bubble sizes field value.
238: */
239: public boolean isShowBubbleSizes() {
240: return showBubbleSizes.isSet(field_1_formatFlags);
241: }
242:
243: } // END OF CLASS
|