Source Code Cross Referenced for LabelSSTRecord.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hssf » record » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hssf.record 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:         Licensed to the Apache Software Foundation (ASF) under one or more
003:         contributor license agreements.  See the NOTICE file distributed with
004:         this work for additional information regarding copyright ownership.
005:         The ASF licenses this file to You under the Apache License, Version 2.0
006:         (the "License"); you may not use this file except in compliance with
007:         the License.  You may obtain a copy of the License at
008:
009:         http://www.apache.org/licenses/LICENSE-2.0
010:
011:         Unless required by applicable law or agreed to in writing, software
012:         distributed under the License is distributed on an "AS IS" BASIS,
013:         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         See the License for the specific language governing permissions and
015:         limitations under the License.
016:         ==================================================================== */
017:
018:        package org.apache.poi.hssf.record;
019:
020:        import org.apache.poi.util.LittleEndian;
021:
022:        /**
023:         * Title:        Label SST Record<P>
024:         * Description:  Refers to a string in the shared string table and is a column
025:         *               value.  <P>
026:         * REFERENCE:  PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
027:         * @author Andrew C. Oliver (acoliver at apache dot org)
028:         * @author Jason Height (jheight at chariot dot net dot au)
029:         * @version 2.0-pre
030:         */
031:
032:        public class LabelSSTRecord extends Record implements 
033:                CellValueRecordInterface, Comparable {
034:            public final static short sid = 0xfd;
035:            //private short             field_1_row;
036:            private int field_1_row;
037:            private short field_2_column;
038:            private short field_3_xf_index;
039:            private int field_4_sst_index;
040:
041:            public LabelSSTRecord() {
042:            }
043:
044:            /**
045:             * Constructs an LabelSST record and sets its fields appropriately.
046:             * @param in the RecordInputstream to read the record from
047:             */
048:
049:            public LabelSSTRecord(RecordInputStream in) {
050:                super (in);
051:            }
052:
053:            protected void validateSid(short id) {
054:                if (id != sid) {
055:                    throw new RecordFormatException(
056:                            "NOT A valid LabelSST RECORD");
057:                }
058:            }
059:
060:            protected void fillFields(RecordInputStream in) {
061:                //field_1_row       = LittleEndian.getShort(data, 0 + offset);
062:                field_1_row = in.readUShort();
063:                field_2_column = in.readShort();
064:                field_3_xf_index = in.readShort();
065:                field_4_sst_index = in.readInt();
066:            }
067:
068:            //public void setRow(short row)
069:            public void setRow(int row) {
070:                field_1_row = row;
071:            }
072:
073:            public void setColumn(short col) {
074:                field_2_column = col;
075:            }
076:
077:            /**
078:             * set the index to the extended format record
079:             *
080:             * @see org.apache.poi.hssf.record.ExtendedFormatRecord
081:             * @param index - the index to the XF record
082:             */
083:
084:            public void setXFIndex(short index) {
085:                field_3_xf_index = index;
086:            }
087:
088:            /**
089:             * set the index to the string in the SSTRecord
090:             *
091:             * @param index - of string in the SST Table
092:             * @see org.apache.poi.hssf.record.SSTRecord
093:             */
094:
095:            public void setSSTIndex(int index) {
096:                field_4_sst_index = index;
097:            }
098:
099:            //public short getRow()
100:            public int getRow() {
101:                return field_1_row;
102:            }
103:
104:            public short getColumn() {
105:                return field_2_column;
106:            }
107:
108:            /**
109:             * get the index to the extended format record
110:             *
111:             * @see org.apache.poi.hssf.record.ExtendedFormatRecord
112:             * @return the index to the XF record
113:             */
114:
115:            public short getXFIndex() {
116:                return field_3_xf_index;
117:            }
118:
119:            /**
120:             * get the index to the string in the SSTRecord
121:             *
122:             * @return index of string in the SST Table
123:             * @see org.apache.poi.hssf.record.SSTRecord
124:             */
125:
126:            public int getSSTIndex() {
127:                return field_4_sst_index;
128:            }
129:
130:            public String toString() {
131:                StringBuffer buffer = new StringBuffer();
132:
133:                buffer.append("[LABELSST]\n");
134:                buffer.append("    .row            = ").append(
135:                        Integer.toHexString(getRow())).append("\n");
136:                buffer.append("    .column         = ").append(
137:                        Integer.toHexString(getColumn())).append("\n");
138:                buffer.append("    .xfindex        = ").append(
139:                        Integer.toHexString(getXFIndex())).append("\n");
140:                buffer.append("    .sstindex       = ").append(
141:                        Integer.toHexString(getSSTIndex())).append("\n");
142:                buffer.append("[/LABELSST]\n");
143:                return buffer.toString();
144:            }
145:
146:            public int serialize(int offset, byte[] data) {
147:                LittleEndian.putShort(data, 0 + offset, sid);
148:                LittleEndian.putShort(data, 2 + offset, (short) 10);
149:                //LittleEndian.putShort(data, 4 + offset, getRow());
150:                LittleEndian.putShort(data, 4 + offset, (short) getRow());
151:                LittleEndian.putShort(data, 6 + offset, getColumn());
152:                LittleEndian.putShort(data, 8 + offset, getXFIndex());
153:                LittleEndian.putInt(data, 10 + offset, getSSTIndex());
154:                return getRecordSize();
155:            }
156:
157:            public int getRecordSize() {
158:                return 14;
159:            }
160:
161:            public short getSid() {
162:                return sid;
163:            }
164:
165:            public boolean isBefore(CellValueRecordInterface i) {
166:                if (this .getRow() > i.getRow()) {
167:                    return false;
168:                }
169:                if ((this .getRow() == i.getRow())
170:                        && (this .getColumn() > i.getColumn())) {
171:                    return false;
172:                }
173:                if ((this .getRow() == i.getRow())
174:                        && (this .getColumn() == i.getColumn())) {
175:                    return false;
176:                }
177:                return true;
178:            }
179:
180:            public boolean isAfter(CellValueRecordInterface i) {
181:                if (this .getRow() < i.getRow()) {
182:                    return false;
183:                }
184:                if ((this .getRow() == i.getRow())
185:                        && (this .getColumn() < i.getColumn())) {
186:                    return false;
187:                }
188:                if ((this .getRow() == i.getRow())
189:                        && (this .getColumn() == i.getColumn())) {
190:                    return false;
191:                }
192:                return true;
193:            }
194:
195:            public boolean isEqual(CellValueRecordInterface i) {
196:                return ((this .getRow() == i.getRow()) && (this .getColumn() == i
197:                        .getColumn()));
198:            }
199:
200:            public boolean isInValueSection() {
201:                return true;
202:            }
203:
204:            public boolean isValue() {
205:                return true;
206:            }
207:
208:            public int compareTo(Object obj) {
209:                CellValueRecordInterface loc = (CellValueRecordInterface) obj;
210:
211:                if ((this .getRow() == loc.getRow())
212:                        && (this .getColumn() == loc.getColumn())) {
213:                    return 0;
214:                }
215:                if (this .getRow() < loc.getRow()) {
216:                    return -1;
217:                }
218:                if (this .getRow() > loc.getRow()) {
219:                    return 1;
220:                }
221:                if (this .getColumn() < loc.getColumn()) {
222:                    return -1;
223:                }
224:                if (this .getColumn() > loc.getColumn()) {
225:                    return 1;
226:                }
227:                return -1;
228:            }
229:
230:            public boolean equals(Object obj) {
231:                if (!(obj instanceof  CellValueRecordInterface)) {
232:                    return false;
233:                }
234:                CellValueRecordInterface loc = (CellValueRecordInterface) obj;
235:
236:                if ((this .getRow() == loc.getRow())
237:                        && (this .getColumn() == loc.getColumn())) {
238:                    return true;
239:                }
240:                return false;
241:            }
242:
243:            public Object clone() {
244:                LabelSSTRecord rec = new LabelSSTRecord();
245:                rec.field_1_row = field_1_row;
246:                rec.field_2_column = field_2_column;
247:                rec.field_3_xf_index = field_3_xf_index;
248:                rec.field_4_sst_index = field_4_sst_index;
249:                return rec;
250:            }
251:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.