Source Code Cross Referenced for GutsRecord.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:        Guts Record <P>
024:         * Description:  Row/column gutter sizes <P>
025:         * REFERENCE:  PG 320 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
026:         * @author Andrew C. Oliver (acoliver at apache dot org)
027:         * @author Jason Height (jheight at chariot dot net dot au)
028:         * @version 2.0-pre
029:         */
030:
031:        public class GutsRecord extends Record {
032:            public final static short sid = 0x80;
033:            private short field_1_left_row_gutter; // size of the row gutter to the left of the rows
034:            private short field_2_top_col_gutter; // size of the column gutter above the columns
035:            private short field_3_row_level_max; // maximum outline level for row gutters
036:            private short field_4_col_level_max; // maximum outline level for column gutters
037:
038:            public GutsRecord() {
039:            }
040:
041:            /**
042:             * Constructs a Guts record and sets its fields appropriately.
043:             * @param in the RecordInputstream to read the record from
044:             */
045:
046:            public GutsRecord(RecordInputStream in) {
047:                super (in);
048:            }
049:
050:            protected void validateSid(short id) {
051:                if (id != sid) {
052:                    throw new RecordFormatException("NOT A Guts RECORD");
053:                }
054:            }
055:
056:            protected void fillFields(RecordInputStream in) {
057:                field_1_left_row_gutter = in.readShort();
058:                field_2_top_col_gutter = in.readShort();
059:                field_3_row_level_max = in.readShort();
060:                field_4_col_level_max = in.readShort();
061:            }
062:
063:            /**
064:             * set the size of the gutter that appears at the left of the rows
065:             *
066:             * @param gut  gutter size in screen units
067:             */
068:
069:            public void setLeftRowGutter(short gut) {
070:                field_1_left_row_gutter = gut;
071:            }
072:
073:            /**
074:             * set the size of the gutter that appears at the above the columns
075:             *
076:             * @param gut  gutter size in screen units
077:             */
078:
079:            public void setTopColGutter(short gut) {
080:                field_2_top_col_gutter = gut;
081:            }
082:
083:            /**
084:             * set the maximum outline level for the row gutter.
085:             *
086:             * @param max  maximum outline level
087:             */
088:
089:            public void setRowLevelMax(short max) {
090:                field_3_row_level_max = max;
091:            }
092:
093:            /**
094:             * set the maximum outline level for the col gutter.
095:             *
096:             * @param max  maximum outline level
097:             */
098:
099:            public void setColLevelMax(short max) {
100:                field_4_col_level_max = max;
101:            }
102:
103:            /**
104:             * get the size of the gutter that appears at the left of the rows
105:             *
106:             * @return gutter size in screen units
107:             */
108:
109:            public short getLeftRowGutter() {
110:                return field_1_left_row_gutter;
111:            }
112:
113:            /**
114:             * get the size of the gutter that appears at the above the columns
115:             *
116:             * @return gutter size in screen units
117:             */
118:
119:            public short getTopColGutter() {
120:                return field_2_top_col_gutter;
121:            }
122:
123:            /**
124:             * get the maximum outline level for the row gutter.
125:             *
126:             * @return maximum outline level
127:             */
128:
129:            public short getRowLevelMax() {
130:                return field_3_row_level_max;
131:            }
132:
133:            /**
134:             * get the maximum outline level for the col gutter.
135:             *
136:             * @return maximum outline level
137:             */
138:
139:            public short getColLevelMax() {
140:                return field_4_col_level_max;
141:            }
142:
143:            public String toString() {
144:                StringBuffer buffer = new StringBuffer();
145:
146:                buffer.append("[GUTS]\n");
147:                buffer.append("    .leftgutter     = ").append(
148:                        Integer.toHexString(getLeftRowGutter())).append("\n");
149:                buffer.append("    .topgutter      = ").append(
150:                        Integer.toHexString(getTopColGutter())).append("\n");
151:                buffer.append("    .rowlevelmax    = ").append(
152:                        Integer.toHexString(getRowLevelMax())).append("\n");
153:                buffer.append("    .collevelmax    = ").append(
154:                        Integer.toHexString(getColLevelMax())).append("\n");
155:                buffer.append("[/GUTS]\n");
156:                return buffer.toString();
157:            }
158:
159:            public int serialize(int offset, byte[] data) {
160:                LittleEndian.putShort(data, 0 + offset, sid);
161:                LittleEndian.putShort(data, 2 + offset, (short) 0x8);
162:                LittleEndian.putShort(data, 4 + offset, getLeftRowGutter());
163:                LittleEndian.putShort(data, 6 + offset, getTopColGutter());
164:                LittleEndian.putShort(data, 8 + offset, getRowLevelMax());
165:                LittleEndian.putShort(data, 10 + offset, getColLevelMax());
166:                return getRecordSize();
167:            }
168:
169:            public int getRecordSize() {
170:                return 12;
171:            }
172:
173:            public short getSid() {
174:                return sid;
175:            }
176:
177:            public Object clone() {
178:                GutsRecord rec = new GutsRecord();
179:                rec.field_1_left_row_gutter = field_1_left_row_gutter;
180:                rec.field_2_top_col_gutter = field_2_top_col_gutter;
181:                rec.field_3_row_level_max = field_3_row_level_max;
182:                rec.field_4_col_level_max = field_4_col_level_max;
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.