Source Code Cross Referenced for DimensionsRecord.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:        Dimensions Record<P>
024:         * Description:  provides the minumum and maximum bounds
025:         *               of a sheet.<P>
026:         * REFERENCE:  PG 303 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 DimensionsRecord extends Record {
033:            public final static short sid = 0x200;
034:            private int field_1_first_row;
035:            private int field_2_last_row; // plus 1
036:            private short field_3_first_col;
037:            private short field_4_last_col;
038:            private short field_5_zero; // must be 0 (reserved)
039:
040:            public DimensionsRecord() {
041:            }
042:
043:            /**
044:             * Constructs a Dimensions record and sets its fields appropriately.
045:             * @param in the RecordInputstream to read the record from
046:             */
047:
048:            public DimensionsRecord(RecordInputStream in) {
049:                super (in);
050:            }
051:
052:            protected void validateSid(short id) {
053:                if (id != sid) {
054:                    throw new RecordFormatException(
055:                            "NOT A valid DIMENSIONS RECORD");
056:                }
057:            }
058:
059:            protected void fillFields(RecordInputStream in) {
060:                field_1_first_row = in.readInt();
061:                field_2_last_row = in.readInt();
062:                field_3_first_col = in.readShort();
063:                field_4_last_col = in.readShort();
064:                field_5_zero = in.readShort();
065:            }
066:
067:            /**
068:             * set the first row number for the sheet
069:             * @param row - first row on the sheet
070:             */
071:
072:            public void setFirstRow(int row) {
073:                field_1_first_row = row;
074:            }
075:
076:            /**
077:             * set the last row number for the sheet
078:             * @param row - last row on the sheet
079:             */
080:
081:            public void setLastRow(int row) {
082:                field_2_last_row = row;
083:            }
084:
085:            /**
086:             * set the first column number for the sheet
087:             * @param col  first column on the sheet
088:             */
089:
090:            public void setFirstCol(short col) {
091:                field_3_first_col = col;
092:            }
093:
094:            /**
095:             * set the last col number for the sheet
096:             * @param col  last column on the sheet
097:             */
098:
099:            public void setLastCol(short col) {
100:                field_4_last_col = col;
101:            }
102:
103:            /**
104:             * get the first row number for the sheet
105:             * @return row - first row on the sheet
106:             */
107:
108:            public int getFirstRow() {
109:                return field_1_first_row;
110:            }
111:
112:            /**
113:             * get the last row number for the sheet
114:             * @return row - last row on the sheet
115:             */
116:
117:            public int getLastRow() {
118:                return field_2_last_row;
119:            }
120:
121:            /**
122:             * get the first column number for the sheet
123:             * @return column - first column on the sheet
124:             */
125:
126:            public short getFirstCol() {
127:                return field_3_first_col;
128:            }
129:
130:            /**
131:             * get the last col number for the sheet
132:             * @return column - last column on the sheet
133:             */
134:
135:            public short getLastCol() {
136:                return field_4_last_col;
137:            }
138:
139:            public String toString() {
140:                StringBuffer buffer = new StringBuffer();
141:
142:                buffer.append("[DIMENSIONS]\n");
143:                buffer.append("    .firstrow       = ").append(
144:                        Integer.toHexString(getFirstRow())).append("\n");
145:                buffer.append("    .lastrow        = ").append(
146:                        Integer.toHexString(getLastRow())).append("\n");
147:                buffer.append("    .firstcol       = ").append(
148:                        Integer.toHexString(getFirstCol())).append("\n");
149:                buffer.append("    .lastcol        = ").append(
150:                        Integer.toHexString(getLastCol())).append("\n");
151:                buffer.append("    .zero           = ").append(
152:                        Integer.toHexString(field_5_zero)).append("\n");
153:                buffer.append("[/DIMENSIONS]\n");
154:                return buffer.toString();
155:            }
156:
157:            public int serialize(int offset, byte[] data) {
158:                LittleEndian.putShort(data, 0 + offset, sid);
159:                LittleEndian.putShort(data, 2 + offset, (short) 14);
160:                LittleEndian.putInt(data, 4 + offset, getFirstRow());
161:                LittleEndian.putInt(data, 8 + offset, getLastRow());
162:                LittleEndian.putShort(data, 12 + offset, getFirstCol());
163:                LittleEndian.putShort(data, 14 + offset, getLastCol());
164:                LittleEndian.putShort(data, 16 + offset, (short) 0);
165:                return getRecordSize();
166:            }
167:
168:            public int getRecordSize() {
169:                return 18;
170:            }
171:
172:            public short getSid() {
173:                return sid;
174:            }
175:
176:            public Object clone() {
177:                DimensionsRecord rec = new DimensionsRecord();
178:                rec.field_1_first_row = field_1_first_row;
179:                rec.field_2_last_row = field_2_last_row;
180:                rec.field_3_first_col = field_3_first_col;
181:                rec.field_4_last_col = field_4_last_col;
182:                rec.field_5_zero = field_5_zero;
183:                return rec;
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.