KickJava   Java API By Example, From Geeks To Geeks.

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


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 line format record defines the axis type details.
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 AxisLineFormatRecord
34     extends Record
35 {
36     public final static short sid = 0x1021;
37     private short field_1_axisType;
38     public final static short AXIS_TYPE_AXIS_LINE = 0;
39     public final static short AXIS_TYPE_MAJOR_GRID_LINE = 1;
40     public final static short AXIS_TYPE_MINOR_GRID_LINE = 2;
41     public final static short AXIS_TYPE_WALLS_OR_FLOOR = 3;
42
43
44     public AxisLineFormatRecord()
45     {
46
47     }
48
49     /**
50      * Constructs a AxisLineFormat record and sets its fields appropriately.
51      *
52      * @param id id must be 0x1021 or an exception
53      * will be throw upon validation
54      * @param size size the size of the data area of the record
55      * @param data data of the record (should not contain sid/len)
56      */

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

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

85     protected void validateSid(short id)
86     {
87         if (id != sid)
88         {
89             throw new RecordFormatException("Not a AxisLineFormat record");
90         }
91     }
92
93     protected void fillFields(byte [] data, short size, int offset)
94     {
95
96         int pos = 0;
97         field_1_axisType = LittleEndian.getShort(data, pos + 0x0 + offset);
98
99     }
100
101     public String JavaDoc toString()
102     {
103         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
104
105         buffer.append("[AXISLINEFORMAT]\n");
106         buffer.append(" .axisType = ")
107             .append("0x").append(HexDump.toHex( getAxisType ()))
108             .append(" (").append( getAxisType() ).append(" )");
109         buffer.append(System.getProperty("line.separator"));
110
111         buffer.append("[/AXISLINEFORMAT]\n");
112         return buffer.toString();
113     }
114
115     public int serialize(int offset, byte[] data)
116     {
117         int pos = 0;
118
119         LittleEndian.putShort(data, 0 + offset, sid);
120         LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
121
122         LittleEndian.putShort(data, 4 + offset + pos, field_1_axisType);
123
124         return getRecordSize();
125     }
126
127     /**
128      * Size of record (exluding 4 byte header)
129      */

130     public int getRecordSize()
131     {
132         return 4 + 2;
133     }
134
135     public short getSid()
136     {
137         return this.sid;
138     }
139
140     public Object JavaDoc clone() {
141         AxisLineFormatRecord rec = new AxisLineFormatRecord();
142     
143         rec.field_1_axisType = field_1_axisType;
144         return rec;
145     }
146
147
148
149
150     /**
151      * Get the axis type field for the AxisLineFormat record.
152      *
153      * @return One of
154      * AXIS_TYPE_AXIS_LINE
155      * AXIS_TYPE_MAJOR_GRID_LINE
156      * AXIS_TYPE_MINOR_GRID_LINE
157      * AXIS_TYPE_WALLS_OR_FLOOR
158      */

159     public short getAxisType()
160     {
161         return field_1_axisType;
162     }
163
164     /**
165      * Set the axis type field for the AxisLineFormat record.
166      *
167      * @param field_1_axisType
168      * One of
169      * AXIS_TYPE_AXIS_LINE
170      * AXIS_TYPE_MAJOR_GRID_LINE
171      * AXIS_TYPE_MINOR_GRID_LINE
172      * AXIS_TYPE_WALLS_OR_FLOOR
173      */

174     public void setAxisType(short field_1_axisType)
175     {
176         this.field_1_axisType = field_1_axisType;
177     }
178
179
180 } // END OF CLASS
181

182
183
184
185
Popular Tags