KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > SeriesLabelsRecord


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19
20 package org.apache.poi.hssf.record;
21
22
23
24 import org.apache.poi.util.*;
25
26 /**
27  * The series label record defines the type of label associated with the data format record.
28  * NOTE: This source is automatically generated please do not modify this file. Either subclass or
29  * remove the record in src/records/definitions.
30
31  * @author Glen Stampoultzis (glens at apache.org)
32  */

33 public class SeriesLabelsRecord
34     extends Record
35 {
36     public final static short sid = 0x100c;
37     private short field_1_formatFlags;
38     private BitField showActual = new BitField(0x1);
39     private BitField showPercent = new BitField(0x2);
40     private BitField labelAsPercentage = new BitField(0x4);
41     private BitField smoothedLine = new BitField(0x8);
42     private BitField showLabel = new BitField(0x10);
43     private BitField showBubbleSizes = new BitField(0x20);
44
45
46     public SeriesLabelsRecord()
47     {
48
49     }
50
51     /**
52      * Constructs a SeriesLabels record and sets its fields appropriately.
53      *
54      * @param id id must be 0x100c or an exception
55      * will be throw upon validation
56      * @param size size the size of the data area of the record
57      * @param data data of the record (should not contain sid/len)
58      */

59
60     public SeriesLabelsRecord(short id, short size, byte [] data)
61     {
62         super(id, size, data);
63     
64     }
65
66     /**
67      * Constructs a SeriesLabels record and sets its fields appropriately.
68      *
69      * @param id id must be 0x100c or an exception
70      * will be throw upon validation
71      * @param size size the size of the data area of the record
72      * @param data data of the record (should not contain sid/len)
73      * @param offset of the record's data
74      */

75
76     public SeriesLabelsRecord(short id, short size, byte [] data, int offset)
77     {
78         super(id, size, data, offset);
79     
80     }
81
82     /**
83      * Checks the sid matches the expected side for this record
84      *
85      * @param id the expected sid.
86      */

87     protected void validateSid(short id)
88     {
89         if (id != sid)
90         {
91             throw new RecordFormatException("Not a SeriesLabels record");
92         }
93     }
94
95     protected void fillFields(byte [] data, short size, int offset)
96     {
97
98         int pos = 0;
99         field_1_formatFlags = LittleEndian.getShort(data, pos + 0x0 + offset);
100
101     }
102
103     public String JavaDoc toString()
104     {
105         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
106
107         buffer.append("[ATTACHEDLABEL]\n");
108         buffer.append(" .formatFlags = ")
109             .append("0x").append(HexDump.toHex( getFormatFlags ()))
110             .append(" (").append( getFormatFlags() ).append(" )");
111         buffer.append(System.getProperty("line.separator"));
112         buffer.append(" .showActual = ").append(isShowActual()).append('\n');
113         buffer.append(" .showPercent = ").append(isShowPercent()).append('\n');
114         buffer.append(" .labelAsPercentage = ").append(isLabelAsPercentage()).append('\n');
115         buffer.append(" .smoothedLine = ").append(isSmoothedLine()).append('\n');
116         buffer.append(" .showLabel = ").append(isShowLabel()).append('\n');
117         buffer.append(" .showBubbleSizes = ").append(isShowBubbleSizes()).append('\n');
118
119         buffer.append("[/ATTACHEDLABEL]\n");
120         return buffer.toString();
121     }
122
123     public int serialize(int offset, byte[] data)
124     {
125         int pos = 0;
126
127         LittleEndian.putShort(data, 0 + offset, sid);
128         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
129
130         LittleEndian.putShort(data, 4 + offset + pos, field_1_formatFlags);
131
132         return getRecordSize();
133     }
134
135     /**
136      * Size of record (exluding 4 byte header)
137      */

138     public int getRecordSize()
139     {
140         return 4 + 2;
141     }
142
143     public short getSid()
144     {
145         return this.sid;
146     }
147
148     public Object JavaDoc clone() {
149         SeriesLabelsRecord rec = new SeriesLabelsRecord();
150     
151         rec.field_1_formatFlags = field_1_formatFlags;
152         return rec;
153     }
154
155
156
157
158     /**
159      * Get the format flags field for the SeriesLabels record.
160      */

161     public short getFormatFlags()
162     {
163         return field_1_formatFlags;
164     }
165
166     /**
167      * Set the format flags field for the SeriesLabels record.
168      */

169     public void setFormatFlags(short field_1_formatFlags)
170     {
171         this.field_1_formatFlags = field_1_formatFlags;
172     }
173
174     /**
175      * Sets the show actual field value.
176      * show actual value of the data point
177      */

178     public void setShowActual(boolean value)
179     {
180         field_1_formatFlags = showActual.setShortBoolean(field_1_formatFlags, value);
181     }
182
183     /**
184      * show actual value of the data point
185      * @return the show actual field value.
186      */

187     public boolean isShowActual()
188     {
189         return showActual.isSet(field_1_formatFlags);
190     }
191
192     /**
193      * Sets the show percent field value.
194      * show value as percentage of total (pie charts only)
195      */

196     public void setShowPercent(boolean value)
197     {
198         field_1_formatFlags = showPercent.setShortBoolean(field_1_formatFlags, value);
199     }
200
201     /**
202      * show value as percentage of total (pie charts only)
203      * @return the show percent field value.
204      */

205     public boolean isShowPercent()
206     {
207         return showPercent.isSet(field_1_formatFlags);
208     }
209
210     /**
211      * Sets the label as percentage field value.
212      * show category label/value as percentage (pie charts only)
213      */

214     public void setLabelAsPercentage(boolean value)
215     {
216         field_1_formatFlags = labelAsPercentage.setShortBoolean(field_1_formatFlags, value);
217     }
218
219     /**
220      * show category label/value as percentage (pie charts only)
221      * @return the label as percentage field value.
222      */

223     public boolean isLabelAsPercentage()
224     {
225         return labelAsPercentage.isSet(field_1_formatFlags);
226     }
227
228     /**
229      * Sets the smoothed line field value.
230      * show smooth line
231      */

232     public void setSmoothedLine(boolean value)
233     {
234         field_1_formatFlags = smoothedLine.setShortBoolean(field_1_formatFlags, value);
235     }
236
237     /**
238      * show smooth line
239      * @return the smoothed line field value.
240      */

241     public boolean isSmoothedLine()
242     {
243         return smoothedLine.isSet(field_1_formatFlags);
244     }
245
246     /**
247      * Sets the show label field value.
248      * display category label
249      */

250     public void setShowLabel(boolean value)
251     {
252         field_1_formatFlags = showLabel.setShortBoolean(field_1_formatFlags, value);
253     }
254
255     /**
256      * display category label
257      * @return the show label field value.
258      */

259     public boolean isShowLabel()
260     {
261         return showLabel.isSet(field_1_formatFlags);
262     }
263
264     /**
265      * Sets the show bubble sizes field value.
266      * ??
267      */

268     public void setShowBubbleSizes(boolean value)
269     {
270         field_1_formatFlags = showBubbleSizes.setShortBoolean(field_1_formatFlags, value);
271     }
272
273     /**
274      * ??
275      * @return the show bubble sizes field value.
276      */

277     public boolean isShowBubbleSizes()
278     {
279         return showBubbleSizes.isSet(field_1_formatFlags);
280     }
281
282
283 } // END OF CLASS
284

285
286
287
288
Popular Tags