KickJava   Java API By Example, From Geeks To Geeks.

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


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 axis options record provides unit information and other various tidbits about the axis.
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 Andrew C. Oliver(acoliver at apache.org)
32  */

33 public class AxisOptionsRecord
34     extends Record
35 {
36     public final static short sid = 0x1062;
37     private short field_1_minimumCategory;
38     private short field_2_maximumCategory;
39     private short field_3_majorUnitValue;
40     private short field_4_majorUnit;
41     private short field_5_minorUnitValue;
42     private short field_6_minorUnit;
43     private short field_7_baseUnit;
44     private short field_8_crossingPoint;
45     private short field_9_options;
46     private BitField defaultMinimum = new BitField(0x1);
47     private BitField defaultMaximum = new BitField(0x2);
48     private BitField defaultMajor = new BitField(0x4);
49     private BitField defaultMinorUnit = new BitField(0x8);
50     private BitField isDate = new BitField(0x10);
51     private BitField defaultBase = new BitField(0x20);
52     private BitField defaultCross = new BitField(0x40);
53     private BitField defaultDateSettings = new BitField(0x80);
54
55
56     public AxisOptionsRecord()
57     {
58
59     }
60
61     /**
62      * Constructs a AxisOptions record and sets its fields appropriately.
63      *
64      * @param id id must be 0x1062 or an exception
65      * will be throw upon validation
66      * @param size size the size of the data area of the record
67      * @param data data of the record (should not contain sid/len)
68      */

69
70     public AxisOptionsRecord(short id, short size, byte [] data)
71     {
72         super(id, size, data);
73     
74     }
75
76     /**
77      * Constructs a AxisOptions record and sets its fields appropriately.
78      *
79      * @param id id must be 0x1062 or an exception
80      * will be throw upon validation
81      * @param size size the size of the data area of the record
82      * @param data data of the record (should not contain sid/len)
83      * @param offset of the record's data
84      */

85
86     public AxisOptionsRecord(short id, short size, byte [] data, int offset)
87     {
88         super(id, size, data, offset);
89     
90     }
91
92     /**
93      * Checks the sid matches the expected side for this record
94      *
95      * @param id the expected sid.
96      */

97     protected void validateSid(short id)
98     {
99         if (id != sid)
100         {
101             throw new RecordFormatException("Not a AxisOptions record");
102         }
103     }
104
105     protected void fillFields(byte [] data, short size, int offset)
106     {
107
108         int pos = 0;
109         field_1_minimumCategory = LittleEndian.getShort(data, pos + 0x0 + offset);
110         field_2_maximumCategory = LittleEndian.getShort(data, pos + 0x2 + offset);
111         field_3_majorUnitValue = LittleEndian.getShort(data, pos + 0x4 + offset);
112         field_4_majorUnit = LittleEndian.getShort(data, pos + 0x6 + offset);
113         field_5_minorUnitValue = LittleEndian.getShort(data, pos + 0x8 + offset);
114         field_6_minorUnit = LittleEndian.getShort(data, pos + 0xa + offset);
115         field_7_baseUnit = LittleEndian.getShort(data, pos + 0xc + offset);
116         field_8_crossingPoint = LittleEndian.getShort(data, pos + 0xe + offset);
117         field_9_options = LittleEndian.getShort(data, pos + 0x10 + offset);
118
119     }
120
121     public String JavaDoc toString()
122     {
123         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
124
125         buffer.append("[AXCEXT]\n");
126         buffer.append(" .minimumCategory = ")
127             .append("0x").append(HexDump.toHex( getMinimumCategory ()))
128             .append(" (").append( getMinimumCategory() ).append(" )");
129         buffer.append(System.getProperty("line.separator"));
130         buffer.append(" .maximumCategory = ")
131             .append("0x").append(HexDump.toHex( getMaximumCategory ()))
132             .append(" (").append( getMaximumCategory() ).append(" )");
133         buffer.append(System.getProperty("line.separator"));
134         buffer.append(" .majorUnitValue = ")
135             .append("0x").append(HexDump.toHex( getMajorUnitValue ()))
136             .append(" (").append( getMajorUnitValue() ).append(" )");
137         buffer.append(System.getProperty("line.separator"));
138         buffer.append(" .majorUnit = ")
139             .append("0x").append(HexDump.toHex( getMajorUnit ()))
140             .append(" (").append( getMajorUnit() ).append(" )");
141         buffer.append(System.getProperty("line.separator"));
142         buffer.append(" .minorUnitValue = ")
143             .append("0x").append(HexDump.toHex( getMinorUnitValue ()))
144             .append(" (").append( getMinorUnitValue() ).append(" )");
145         buffer.append(System.getProperty("line.separator"));
146         buffer.append(" .minorUnit = ")
147             .append("0x").append(HexDump.toHex( getMinorUnit ()))
148             .append(" (").append( getMinorUnit() ).append(" )");
149         buffer.append(System.getProperty("line.separator"));
150         buffer.append(" .baseUnit = ")
151             .append("0x").append(HexDump.toHex( getBaseUnit ()))
152             .append(" (").append( getBaseUnit() ).append(" )");
153         buffer.append(System.getProperty("line.separator"));
154         buffer.append(" .crossingPoint = ")
155             .append("0x").append(HexDump.toHex( getCrossingPoint ()))
156             .append(" (").append( getCrossingPoint() ).append(" )");
157         buffer.append(System.getProperty("line.separator"));
158         buffer.append(" .options = ")
159             .append("0x").append(HexDump.toHex( getOptions ()))
160             .append(" (").append( getOptions() ).append(" )");
161         buffer.append(System.getProperty("line.separator"));
162         buffer.append(" .defaultMinimum = ").append(isDefaultMinimum()).append('\n');
163         buffer.append(" .defaultMaximum = ").append(isDefaultMaximum()).append('\n');
164         buffer.append(" .defaultMajor = ").append(isDefaultMajor()).append('\n');
165         buffer.append(" .defaultMinorUnit = ").append(isDefaultMinorUnit()).append('\n');
166         buffer.append(" .isDate = ").append(isIsDate()).append('\n');
167         buffer.append(" .defaultBase = ").append(isDefaultBase()).append('\n');
168         buffer.append(" .defaultCross = ").append(isDefaultCross()).append('\n');
169         buffer.append(" .defaultDateSettings = ").append(isDefaultDateSettings()).append('\n');
170
171         buffer.append("[/AXCEXT]\n");
172         return buffer.toString();
173     }
174
175     public int serialize(int offset, byte[] data)
176     {
177         int pos = 0;
178
179         LittleEndian.putShort(data, 0 + offset, sid);
180         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
181
182         LittleEndian.putShort(data, 4 + offset + pos, field_1_minimumCategory);
183         LittleEndian.putShort(data, 6 + offset + pos, field_2_maximumCategory);
184         LittleEndian.putShort(data, 8 + offset + pos, field_3_majorUnitValue);
185         LittleEndian.putShort(data, 10 + offset + pos, field_4_majorUnit);
186         LittleEndian.putShort(data, 12 + offset + pos, field_5_minorUnitValue);
187         LittleEndian.putShort(data, 14 + offset + pos, field_6_minorUnit);
188         LittleEndian.putShort(data, 16 + offset + pos, field_7_baseUnit);
189         LittleEndian.putShort(data, 18 + offset + pos, field_8_crossingPoint);
190         LittleEndian.putShort(data, 20 + offset + pos, field_9_options);
191
192         return getRecordSize();
193     }
194
195     /**
196      * Size of record (exluding 4 byte header)
197      */

198     public int getRecordSize()
199     {
200         return 4 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
201     }
202
203     public short getSid()
204     {
205         return this.sid;
206     }
207
208     public Object JavaDoc clone() {
209         AxisOptionsRecord rec = new AxisOptionsRecord();
210     
211         rec.field_1_minimumCategory = field_1_minimumCategory;
212         rec.field_2_maximumCategory = field_2_maximumCategory;
213         rec.field_3_majorUnitValue = field_3_majorUnitValue;
214         rec.field_4_majorUnit = field_4_majorUnit;
215         rec.field_5_minorUnitValue = field_5_minorUnitValue;
216         rec.field_6_minorUnit = field_6_minorUnit;
217         rec.field_7_baseUnit = field_7_baseUnit;
218         rec.field_8_crossingPoint = field_8_crossingPoint;
219         rec.field_9_options = field_9_options;
220         return rec;
221     }
222
223
224
225
226     /**
227      * Get the minimum category field for the AxisOptions record.
228      */

229     public short getMinimumCategory()
230     {
231         return field_1_minimumCategory;
232     }
233
234     /**
235      * Set the minimum category field for the AxisOptions record.
236      */

237     public void setMinimumCategory(short field_1_minimumCategory)
238     {
239         this.field_1_minimumCategory = field_1_minimumCategory;
240     }
241
242     /**
243      * Get the maximum category field for the AxisOptions record.
244      */

245     public short getMaximumCategory()
246     {
247         return field_2_maximumCategory;
248     }
249
250     /**
251      * Set the maximum category field for the AxisOptions record.
252      */

253     public void setMaximumCategory(short field_2_maximumCategory)
254     {
255         this.field_2_maximumCategory = field_2_maximumCategory;
256     }
257
258     /**
259      * Get the major unit value field for the AxisOptions record.
260      */

261     public short getMajorUnitValue()
262     {
263         return field_3_majorUnitValue;
264     }
265
266     /**
267      * Set the major unit value field for the AxisOptions record.
268      */

269     public void setMajorUnitValue(short field_3_majorUnitValue)
270     {
271         this.field_3_majorUnitValue = field_3_majorUnitValue;
272     }
273
274     /**
275      * Get the major unit field for the AxisOptions record.
276      */

277     public short getMajorUnit()
278     {
279         return field_4_majorUnit;
280     }
281
282     /**
283      * Set the major unit field for the AxisOptions record.
284      */

285     public void setMajorUnit(short field_4_majorUnit)
286     {
287         this.field_4_majorUnit = field_4_majorUnit;
288     }
289
290     /**
291      * Get the minor unit value field for the AxisOptions record.
292      */

293     public short getMinorUnitValue()
294     {
295         return field_5_minorUnitValue;
296     }
297
298     /**
299      * Set the minor unit value field for the AxisOptions record.
300      */

301     public void setMinorUnitValue(short field_5_minorUnitValue)
302     {
303         this.field_5_minorUnitValue = field_5_minorUnitValue;
304     }
305
306     /**
307      * Get the minor unit field for the AxisOptions record.
308      */

309     public short getMinorUnit()
310     {
311         return field_6_minorUnit;
312     }
313
314     /**
315      * Set the minor unit field for the AxisOptions record.
316      */

317     public void setMinorUnit(short field_6_minorUnit)
318     {
319         this.field_6_minorUnit = field_6_minorUnit;
320     }
321
322     /**
323      * Get the base unit field for the AxisOptions record.
324      */

325     public short getBaseUnit()
326     {
327         return field_7_baseUnit;
328     }
329
330     /**
331      * Set the base unit field for the AxisOptions record.
332      */

333     public void setBaseUnit(short field_7_baseUnit)
334     {
335         this.field_7_baseUnit = field_7_baseUnit;
336     }
337
338     /**
339      * Get the crossing point field for the AxisOptions record.
340      */

341     public short getCrossingPoint()
342     {
343         return field_8_crossingPoint;
344     }
345
346     /**
347      * Set the crossing point field for the AxisOptions record.
348      */

349     public void setCrossingPoint(short field_8_crossingPoint)
350     {
351         this.field_8_crossingPoint = field_8_crossingPoint;
352     }
353
354     /**
355      * Get the options field for the AxisOptions record.
356      */

357     public short getOptions()
358     {
359         return field_9_options;
360     }
361
362     /**
363      * Set the options field for the AxisOptions record.
364      */

365     public void setOptions(short field_9_options)
366     {
367         this.field_9_options = field_9_options;
368     }
369
370     /**
371      * Sets the default minimum field value.
372      * use the default minimum category
373      */

374     public void setDefaultMinimum(boolean value)
375     {
376         field_9_options = defaultMinimum.setShortBoolean(field_9_options, value);
377     }
378
379     /**
380      * use the default minimum category
381      * @return the default minimum field value.
382      */

383     public boolean isDefaultMinimum()
384     {
385         return defaultMinimum.isSet(field_9_options);
386     }
387
388     /**
389      * Sets the default maximum field value.
390      * use the default maximum category
391      */

392     public void setDefaultMaximum(boolean value)
393     {
394         field_9_options = defaultMaximum.setShortBoolean(field_9_options, value);
395     }
396
397     /**
398      * use the default maximum category
399      * @return the default maximum field value.
400      */

401     public boolean isDefaultMaximum()
402     {
403         return defaultMaximum.isSet(field_9_options);
404     }
405
406     /**
407      * Sets the default major field value.
408      * use the default major unit
409      */

410     public void setDefaultMajor(boolean value)
411     {
412         field_9_options = defaultMajor.setShortBoolean(field_9_options, value);
413     }
414
415     /**
416      * use the default major unit
417      * @return the default major field value.
418      */

419     public boolean isDefaultMajor()
420     {
421         return defaultMajor.isSet(field_9_options);
422     }
423
424     /**
425      * Sets the default minor unit field value.
426      * use the default minor unit
427      */

428     public void setDefaultMinorUnit(boolean value)
429     {
430         field_9_options = defaultMinorUnit.setShortBoolean(field_9_options, value);
431     }
432
433     /**
434      * use the default minor unit
435      * @return the default minor unit field value.
436      */

437     public boolean isDefaultMinorUnit()
438     {
439         return defaultMinorUnit.isSet(field_9_options);
440     }
441
442     /**
443      * Sets the isDate field value.
444      * this is a date axis
445      */

446     public void setIsDate(boolean value)
447     {
448         field_9_options = isDate.setShortBoolean(field_9_options, value);
449     }
450
451     /**
452      * this is a date axis
453      * @return the isDate field value.
454      */

455     public boolean isIsDate()
456     {
457         return isDate.isSet(field_9_options);
458     }
459
460     /**
461      * Sets the default base field value.
462      * use the default base unit
463      */

464     public void setDefaultBase(boolean value)
465     {
466         field_9_options = defaultBase.setShortBoolean(field_9_options, value);
467     }
468
469     /**
470      * use the default base unit
471      * @return the default base field value.
472      */

473     public boolean isDefaultBase()
474     {
475         return defaultBase.isSet(field_9_options);
476     }
477
478     /**
479      * Sets the default cross field value.
480      * use the default crossing point
481      */

482     public void setDefaultCross(boolean value)
483     {
484         field_9_options = defaultCross.setShortBoolean(field_9_options, value);
485     }
486
487     /**
488      * use the default crossing point
489      * @return the default cross field value.
490      */

491     public boolean isDefaultCross()
492     {
493         return defaultCross.isSet(field_9_options);
494     }
495
496     /**
497      * Sets the default date settings field value.
498      * use default date setttings for this axis
499      */

500     public void setDefaultDateSettings(boolean value)
501     {
502         field_9_options = defaultDateSettings.setShortBoolean(field_9_options, value);
503     }
504
505     /**
506      * use default date setttings for this axis
507      * @return the default date settings field value.
508      */

509     public boolean isDefaultDateSettings()
510     {
511         return defaultDateSettings.isSet(field_9_options);
512     }
513
514
515 } // END OF CLASS
516

517
518
519
520
Popular Tags