KickJava   Java API By Example, From Geeks To Geeks.

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


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  * This record refers to a category or series axis and is used to specify label/tickmark frequency.
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 CategorySeriesAxisRecord
34     extends Record
35 {
36     public final static short sid = 0x1020;
37     private short field_1_crossingPoint;
38     private short field_2_labelFrequency;
39     private short field_3_tickMarkFrequency;
40     private short field_4_options;
41     private BitField valueAxisCrossing = new BitField(0x1);
42     private BitField crossesFarRight = new BitField(0x2);
43     private BitField reversed = new BitField(0x4);
44
45
46     public CategorySeriesAxisRecord()
47     {
48
49     }
50
51     /**
52      * Constructs a CategorySeriesAxis record and sets its fields appropriately.
53      *
54      * @param id id must be 0x1020 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 CategorySeriesAxisRecord(short id, short size, byte [] data)
61     {
62         super(id, size, data);
63     
64     }
65
66     /**
67      * Constructs a CategorySeriesAxis record and sets its fields appropriately.
68      *
69      * @param id id must be 0x1020 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 CategorySeriesAxisRecord(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 CategorySeriesAxis record");
92         }
93     }
94
95     protected void fillFields(byte [] data, short size, int offset)
96     {
97
98         int pos = 0;
99         field_1_crossingPoint = LittleEndian.getShort(data, pos + 0x0 + offset);
100         field_2_labelFrequency = LittleEndian.getShort(data, pos + 0x2 + offset);
101         field_3_tickMarkFrequency = LittleEndian.getShort(data, pos + 0x4 + offset);
102         field_4_options = LittleEndian.getShort(data, pos + 0x6 + offset);
103
104     }
105
106     public String JavaDoc toString()
107     {
108         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
109
110         buffer.append("[CATSERRANGE]\n");
111         buffer.append(" .crossingPoint = ")
112             .append("0x").append(HexDump.toHex( getCrossingPoint ()))
113             .append(" (").append( getCrossingPoint() ).append(" )");
114         buffer.append(System.getProperty("line.separator"));
115         buffer.append(" .labelFrequency = ")
116             .append("0x").append(HexDump.toHex( getLabelFrequency ()))
117             .append(" (").append( getLabelFrequency() ).append(" )");
118         buffer.append(System.getProperty("line.separator"));
119         buffer.append(" .tickMarkFrequency = ")
120             .append("0x").append(HexDump.toHex( getTickMarkFrequency ()))
121             .append(" (").append( getTickMarkFrequency() ).append(" )");
122         buffer.append(System.getProperty("line.separator"));
123         buffer.append(" .options = ")
124             .append("0x").append(HexDump.toHex( getOptions ()))
125             .append(" (").append( getOptions() ).append(" )");
126         buffer.append(System.getProperty("line.separator"));
127         buffer.append(" .valueAxisCrossing = ").append(isValueAxisCrossing()).append('\n');
128         buffer.append(" .crossesFarRight = ").append(isCrossesFarRight()).append('\n');
129         buffer.append(" .reversed = ").append(isReversed()).append('\n');
130
131         buffer.append("[/CATSERRANGE]\n");
132         return buffer.toString();
133     }
134
135     public int serialize(int offset, byte[] data)
136     {
137         int pos = 0;
138
139         LittleEndian.putShort(data, 0 + offset, sid);
140         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
141
142         LittleEndian.putShort(data, 4 + offset + pos, field_1_crossingPoint);
143         LittleEndian.putShort(data, 6 + offset + pos, field_2_labelFrequency);
144         LittleEndian.putShort(data, 8 + offset + pos, field_3_tickMarkFrequency);
145         LittleEndian.putShort(data, 10 + offset + pos, field_4_options);
146
147         return getRecordSize();
148     }
149
150     /**
151      * Size of record (exluding 4 byte header)
152      */

153     public int getRecordSize()
154     {
155         return 4 + 2 + 2 + 2 + 2;
156     }
157
158     public short getSid()
159     {
160         return this.sid;
161     }
162
163     public Object JavaDoc clone() {
164         CategorySeriesAxisRecord rec = new CategorySeriesAxisRecord();
165     
166         rec.field_1_crossingPoint = field_1_crossingPoint;
167         rec.field_2_labelFrequency = field_2_labelFrequency;
168         rec.field_3_tickMarkFrequency = field_3_tickMarkFrequency;
169         rec.field_4_options = field_4_options;
170         return rec;
171     }
172
173
174
175
176     /**
177      * Get the crossing point field for the CategorySeriesAxis record.
178      */

179     public short getCrossingPoint()
180     {
181         return field_1_crossingPoint;
182     }
183
184     /**
185      * Set the crossing point field for the CategorySeriesAxis record.
186      */

187     public void setCrossingPoint(short field_1_crossingPoint)
188     {
189         this.field_1_crossingPoint = field_1_crossingPoint;
190     }
191
192     /**
193      * Get the label frequency field for the CategorySeriesAxis record.
194      */

195     public short getLabelFrequency()
196     {
197         return field_2_labelFrequency;
198     }
199
200     /**
201      * Set the label frequency field for the CategorySeriesAxis record.
202      */

203     public void setLabelFrequency(short field_2_labelFrequency)
204     {
205         this.field_2_labelFrequency = field_2_labelFrequency;
206     }
207
208     /**
209      * Get the tick mark frequency field for the CategorySeriesAxis record.
210      */

211     public short getTickMarkFrequency()
212     {
213         return field_3_tickMarkFrequency;
214     }
215
216     /**
217      * Set the tick mark frequency field for the CategorySeriesAxis record.
218      */

219     public void setTickMarkFrequency(short field_3_tickMarkFrequency)
220     {
221         this.field_3_tickMarkFrequency = field_3_tickMarkFrequency;
222     }
223
224     /**
225      * Get the options field for the CategorySeriesAxis record.
226      */

227     public short getOptions()
228     {
229         return field_4_options;
230     }
231
232     /**
233      * Set the options field for the CategorySeriesAxis record.
234      */

235     public void setOptions(short field_4_options)
236     {
237         this.field_4_options = field_4_options;
238     }
239
240     /**
241      * Sets the value axis crossing field value.
242      * set true to indicate axis crosses between categories and false to cross axis midway
243      */

244     public void setValueAxisCrossing(boolean value)
245     {
246         field_4_options = valueAxisCrossing.setShortBoolean(field_4_options, value);
247     }
248
249     /**
250      * set true to indicate axis crosses between categories and false to cross axis midway
251      * @return the value axis crossing field value.
252      */

253     public boolean isValueAxisCrossing()
254     {
255         return valueAxisCrossing.isSet(field_4_options);
256     }
257
258     /**
259      * Sets the crosses far right field value.
260      * axis crosses at the far right
261      */

262     public void setCrossesFarRight(boolean value)
263     {
264         field_4_options = crossesFarRight.setShortBoolean(field_4_options, value);
265     }
266
267     /**
268      * axis crosses at the far right
269      * @return the crosses far right field value.
270      */

271     public boolean isCrossesFarRight()
272     {
273         return crossesFarRight.isSet(field_4_options);
274     }
275
276     /**
277      * Sets the reversed field value.
278      * categories are displayed in reverse order
279      */

280     public void setReversed(boolean value)
281     {
282         field_4_options = reversed.setShortBoolean(field_4_options, value);
283     }
284
285     /**
286      * categories are displayed in reverse order
287      * @return the reversed field value.
288      */

289     public boolean isReversed()
290     {
291         return reversed.isSet(field_4_options);
292     }
293
294
295 } // END OF CLASS
296

297
298
299
300
Popular Tags