Source Code Cross Referenced for BlankRecord.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:        /*
019:         * BlankRecord.java
020:         *
021:         * Created on December 10, 2001, 12:07 PM
022:         */
023:        package org.apache.poi.hssf.record;
024:
025:        import org.apache.poi.util.LittleEndian;
026:
027:        /**
028:         * Title:        Blank cell record <P>
029:         * Description:  Represents a column in a row with no value but with styling.<P>
030:         * REFERENCE:  PG 287 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
031:         * @author Andrew C. Oliver (acoliver at apache dot org)
032:         * @author Jason Height (jheight at chariot dot net dot au)
033:         * @version 2.0-pre
034:         */
035:
036:        public class BlankRecord extends Record implements 
037:                CellValueRecordInterface, Comparable {
038:            public final static short sid = 0x201;
039:            //private short             field_1_row;
040:            private int field_1_row;
041:            private short field_2_col;
042:            private short field_3_xf;
043:
044:            /** Creates a new instance of BlankRecord */
045:
046:            public BlankRecord() {
047:            }
048:
049:            /**
050:             * Constructs a BlankRecord and sets its fields appropriately
051:             * @param in the RecordInputstream to read the record from
052:             */
053:
054:            public BlankRecord(RecordInputStream in) {
055:                super (in);
056:            }
057:
058:            protected void fillFields(RecordInputStream in) {
059:                //field_1_row = LittleEndian.getShort(data, 0 + offset);
060:                field_1_row = in.readUShort();
061:                field_2_col = in.readShort();
062:                field_3_xf = in.readShort();
063:            }
064:
065:            /**
066:             * called by constructor, should throw runtime exception in the event of a
067:             * record passed with a differing ID.
068:             *
069:             * @param id alleged id for this record
070:             */
071:
072:            protected void validateSid(short id) {
073:                if (id != sid) {
074:                    throw new RecordFormatException("NOT A BLANKRECORD!");
075:                }
076:            }
077:
078:            /**
079:             * set the row this cell occurs on
080:             * @param row the row this cell occurs within
081:             */
082:
083:            //public void setRow(short row)
084:            public void setRow(int row) {
085:                field_1_row = row;
086:            }
087:
088:            /**
089:             * get the row this cell occurs on
090:             *
091:             * @return the row
092:             */
093:
094:            //public short getRow()
095:            public int getRow() {
096:                return field_1_row;
097:            }
098:
099:            /**
100:             * get the column this cell defines within the row
101:             *
102:             * @return the column
103:             */
104:
105:            public short getColumn() {
106:                return field_2_col;
107:            }
108:
109:            /**
110:             * set the index of the extended format record to style this cell with
111:             *
112:             * @param xf - the 0-based index of the extended format
113:             * @see org.apache.poi.hssf.record.ExtendedFormatRecord
114:             */
115:
116:            public void setXFIndex(short xf) {
117:                field_3_xf = xf;
118:            }
119:
120:            /**
121:             * get the index of the extended format record to style this cell with
122:             *
123:             * @return extended format index
124:             */
125:
126:            public short getXFIndex() {
127:                return field_3_xf;
128:            }
129:
130:            /**
131:             * set the column this cell defines within the row
132:             *
133:             * @param col the column this cell defines
134:             */
135:
136:            public void setColumn(short col) {
137:                field_2_col = col;
138:            }
139:
140:            public boolean isBefore(CellValueRecordInterface i) {
141:                if (this .getRow() > i.getRow()) {
142:                    return false;
143:                }
144:                if ((this .getRow() == i.getRow())
145:                        && (this .getColumn() > i.getColumn())) {
146:                    return false;
147:                }
148:                if ((this .getRow() == i.getRow())
149:                        && (this .getColumn() == i.getColumn())) {
150:                    return false;
151:                }
152:                return true;
153:            }
154:
155:            public boolean isAfter(CellValueRecordInterface i) {
156:                if (this .getRow() < i.getRow()) {
157:                    return false;
158:                }
159:                if ((this .getRow() == i.getRow())
160:                        && (this .getColumn() < i.getColumn())) {
161:                    return false;
162:                }
163:                if ((this .getRow() == i.getRow())
164:                        && (this .getColumn() == i.getColumn())) {
165:                    return false;
166:                }
167:                return true;
168:            }
169:
170:            public boolean isEqual(CellValueRecordInterface i) {
171:                return ((this .getRow() == i.getRow()) && (this .getColumn() == i
172:                        .getColumn()));
173:            }
174:
175:            public boolean isInValueSection() {
176:                return true;
177:            }
178:
179:            public boolean isValue() {
180:                return true;
181:            }
182:
183:            /**
184:             * return the non static version of the id for this record.
185:             */
186:
187:            public short getSid() {
188:                return sid;
189:            }
190:
191:            public String toString() {
192:                StringBuffer buffer = new StringBuffer();
193:
194:                buffer.append("[BLANK]\n");
195:                buffer.append("row       = ").append(
196:                        Integer.toHexString(getRow())).append("\n");
197:                buffer.append("col       = ").append(
198:                        Integer.toHexString(getColumn())).append("\n");
199:                buffer.append("xf        = ").append(
200:                        Integer.toHexString(getXFIndex())).append("\n");
201:                buffer.append("[/BLANK]\n");
202:                return buffer.toString();
203:            }
204:
205:            /**
206:             * called by the class that is responsible for writing this sucker.
207:             * Subclasses should implement this so that their data is passed back in a
208:             * byte array.
209:             *
210:             * @return byte array containing instance data
211:             */
212:
213:            public int serialize(int offset, byte[] data) {
214:                LittleEndian.putShort(data, 0 + offset, sid);
215:                LittleEndian.putShort(data, 2 + offset, (short) 6);
216:                //LittleEndian.putShort(data, 4 + offset, getRow());
217:                LittleEndian.putShort(data, 4 + offset, (short) getRow());
218:                LittleEndian.putShort(data, 6 + offset, getColumn());
219:                LittleEndian.putShort(data, 8 + offset, getXFIndex());
220:                return getRecordSize();
221:            }
222:
223:            public int getRecordSize() {
224:                return 10;
225:            }
226:
227:            public int compareTo(Object obj) {
228:                CellValueRecordInterface loc = (CellValueRecordInterface) obj;
229:
230:                if ((this .getRow() == loc.getRow())
231:                        && (this .getColumn() == loc.getColumn())) {
232:                    return 0;
233:                }
234:                if (this .getRow() < loc.getRow()) {
235:                    return -1;
236:                }
237:                if (this .getRow() > loc.getRow()) {
238:                    return 1;
239:                }
240:                if (this .getColumn() < loc.getColumn()) {
241:                    return -1;
242:                }
243:                if (this .getColumn() > loc.getColumn()) {
244:                    return 1;
245:                }
246:                return -1;
247:            }
248:
249:            public boolean equals(Object obj) {
250:                if (!(obj instanceof  CellValueRecordInterface)) {
251:                    return false;
252:                }
253:                CellValueRecordInterface loc = (CellValueRecordInterface) obj;
254:
255:                if ((this .getRow() == loc.getRow())
256:                        && (this .getColumn() == loc.getColumn())) {
257:                    return true;
258:                }
259:                return false;
260:            }
261:
262:            public Object clone() {
263:                BlankRecord rec = new BlankRecord();
264:                rec.field_1_row = field_1_row;
265:                rec.field_2_col = field_2_col;
266:                rec.field_3_xf = field_3_xf;
267:                return rec;
268:            }
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.