Source Code Cross Referenced for EPStyleRegion.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » components » elementprocessor » impl » poi » hssf » elements » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements 
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.cocoon.components.elementprocessor.impl.poi.hssf.elements;
019:
020:        import java.util.Hashtable;
021:
022:        import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
023:        import org.apache.cocoon.components.elementprocessor.types.NumericResult;
024:        import org.apache.cocoon.components.elementprocessor.ElementProcessor;
025:        import org.apache.cocoon.components.elementprocessor.types.Attribute;
026:
027:        import org.apache.poi.hssf.usermodel.HSSFCellStyle;
028:        import org.apache.poi.hssf.util.Region;
029:
030:        import java.io.IOException;
031:
032:        /**
033:         * No-op implementation of ElementProcessor to handle the
034:         * "StyleRegion" tag
035:         *
036:         * This element is a container of other elements and has four
037:         * attributes that define the boundaries of the region.
038:         *
039:         * @author Marc Johnson (marc_johnson27591@hotmail.com)
040:         * @author Andrew C. Oliver (acoliver2@users.sourceforge.net)
041:         * @version CVS $Id: EPStyleRegion.java 433543 2006-08-22 06:22:54Z crossley $
042:         */
043:        public class EPStyleRegion extends BaseElementProcessor {
044:            private static final String _start_col_attribute = "startCol";
045:            private static final String _start_row_attribute = "startRow";
046:            private static final String _end_col_attribute = "endCol";
047:            private static final String _end_row_attribute = "endRow";
048:            private NumericResult _start_col;
049:            private NumericResult _start_row;
050:            private NumericResult _end_col;
051:            private NumericResult _end_row;
052:
053:            private HSSFCellStyle _style;
054:            private Hashtable colorhash;
055:
056:            private boolean invalid;
057:
058:            //kludge constant to fix gnumeric's love of declaring large stlye regions
059:            //for the blank sections of the sheet w/no apparent purpose that we can
060:            //
061:            private int MAX_AREA = 2001;
062:
063:            /**
064:             * constructor
065:             */
066:            public EPStyleRegion() {
067:                super (null);
068:                _start_col = null;
069:                _start_row = null;
070:                _end_col = null;
071:                _end_row = null;
072:            }
073:
074:            /**
075:             * Override of Initialize() implementation
076:             * @param attributes the array of Attribute instances; may be empty, will
077:             *                  never be null
078:             * @param parent the parent ElementProcessor; may be null
079:             * @exception IOException if anything is wrong
080:             */
081:            public void initialize(final Attribute[] attributes,
082:                    final ElementProcessor parent) throws IOException {
083:                super .initialize(attributes, parent);
084:
085:                Region region = new Region(getStartRow(),
086:                        (short) getStartCol(), getEndRow(), (short) getEndCol());
087:
088:                //        if (region.getRowFrom() == 0 &&
089:                //            region.getColumnFrom() ==0)
090:                //            getLogger().debug("got 0,0");
091:
092:                getLogger().debug("region area is " + region.getArea());
093:                if (region.getArea() < MAX_AREA) {
094:                    //protect against stupid mega regions
095:                    //of generally NOTHING and no real
096:                    //puprose created by gnumeric
097:                    getLogger().debug("region added");
098:                    _style = getSheet().addStyleRegion(region); //test
099:                } else {
100:                    invalid = true;
101:                }
102:                colorhash = ((EPStyles) parent).getColorHash();
103:            }
104:
105:            /**
106:             * @return start row
107:             * @exception IOException
108:             */
109:            public int getStartRow() throws IOException {
110:                if (_start_row == null) {
111:                    _start_row = NumericConverter
112:                            .extractNonNegativeInteger(getValue(_start_row_attribute));
113:                }
114:                return _start_row.intValue();
115:            }
116:
117:            /**
118:             * @return start column
119:             * @exception IOException
120:             */
121:            public int getStartCol() throws IOException {
122:                if (_start_col == null) {
123:                    _start_col = NumericConverter
124:                            .extractNonNegativeInteger(getValue(_start_col_attribute));
125:                }
126:                return _start_col.intValue();
127:            }
128:
129:            /**
130:             * @return end row
131:             * @exception IOException
132:             */
133:            public int getEndRow() throws IOException {
134:                if (_end_row == null) {
135:                    _end_row = NumericConverter
136:                            .extractNonNegativeInteger(getValue(_end_row_attribute));
137:                }
138:                return _end_row.intValue();
139:            }
140:
141:            /**
142:             * @return end column
143:             * @exception IOException
144:             */
145:            public int getEndCol() throws IOException {
146:                if (_end_col == null) {
147:                    _end_col = NumericConverter
148:                            .extractNonNegativeInteger(getValue(_end_col_attribute));
149:                }
150:                return _end_col.intValue();
151:            }
152:
153:            /**
154:             * @return HSSFCellStyle associated with this style region.
155:             */
156:            public HSSFCellStyle getStyle() {
157:                return _style;
158:            }
159:
160:            /**
161:             * @return instance created in the EPStyles instance from
162:             *             HSSFColor.getTripletHash();
163:             * @see org.apache.poi.hssf.util.HSSFColor#getTripletHash()
164:             */
165:            public Hashtable getColorHash() {
166:                return colorhash;
167:            }
168:
169:            /**
170:             * @return validity (used to determine whether this is a big wasteful
171:             *             region with no purpose (gnumeric does this
172:             */
173:            public boolean isValid() {
174:                return (!invalid);
175:            }
176:
177:        } // end public class EPStyleRegion
w__w_w_.__j___ava2___s__.c__o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.