KickJava   Java API By Example, From Geeks To Geeks.

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


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 default data label text properties record identifies the text characteristics of the preceeding text 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 DefaultDataLabelTextPropertiesRecord
34     extends Record
35 {
36     public final static short sid = 0x1024;
37     private short field_1_categoryDataType;
38     public final static short CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC = 0;
39     public final static short CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC = 1;
40     public final static short CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC = 2;
41
42
43     public DefaultDataLabelTextPropertiesRecord()
44     {
45
46     }
47
48     /**
49      * Constructs a DefaultDataLabelTextProperties record and sets its fields appropriately.
50      *
51      * @param id id must be 0x1024 or an exception
52      * will be throw upon validation
53      * @param size size the size of the data area of the record
54      * @param data data of the record (should not contain sid/len)
55      */

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

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

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

129     public int getRecordSize()
130     {
131         return 4 + 2;
132     }
133
134     public short getSid()
135     {
136         return this.sid;
137     }
138
139     public Object JavaDoc clone() {
140         DefaultDataLabelTextPropertiesRecord rec = new DefaultDataLabelTextPropertiesRecord();
141     
142         rec.field_1_categoryDataType = field_1_categoryDataType;
143         return rec;
144     }
145
146
147
148
149     /**
150      * Get the category data type field for the DefaultDataLabelTextProperties record.
151      *
152      * @return One of
153      * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC
154      * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC
155      * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC
156      */

157     public short getCategoryDataType()
158     {
159         return field_1_categoryDataType;
160     }
161
162     /**
163      * Set the category data type field for the DefaultDataLabelTextProperties record.
164      *
165      * @param field_1_categoryDataType
166      * One of
167      * CATEGORY_DATA_TYPE_SHOW_LABELS_CHARACTERISTIC
168      * CATEGORY_DATA_TYPE_VALUE_AND_PERCENTAGE_CHARACTERISTIC
169      * CATEGORY_DATA_TYPE_ALL_TEXT_CHARACTERISTIC
170      */

171     public void setCategoryDataType(short field_1_categoryDataType)
172     {
173         this.field_1_categoryDataType = field_1_categoryDataType;
174     }
175
176
177 } // END OF CLASS
178

179
180
181
182
Popular Tags