Source Code Cross Referenced for TableColumn.java in  » Graphic-Library » fop » org » apache » fop » fo » flow » 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 » Graphic Library » fop » org.apache.fop.fo.flow 
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:        /* $Id: TableColumn.java 488960 2006-12-20 08:34:28Z spepping $ */
019:
020:        package org.apache.fop.fo.flow;
021:
022:        // XML
023:        import org.xml.sax.Locator;
024:
025:        import org.apache.fop.apps.FOPException;
026:        import org.apache.fop.datatypes.Length;
027:        import org.apache.fop.fo.FONode;
028:        import org.apache.fop.fo.PropertyList;
029:        import org.apache.fop.fo.ValidationException;
030:        import org.apache.fop.fo.expr.PropertyException;
031:        import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
032:        import org.apache.fop.fo.properties.Property;
033:        import org.apache.fop.fo.properties.TableColLength;
034:
035:        /**
036:         * Class modelling the fo:table-column object.
037:         */
038:        public class TableColumn extends TableFObj {
039:            // The value of properties relevant for fo:table-column.
040:            private CommonBorderPaddingBackground commonBorderPaddingBackground;
041:            private int columnNumber;
042:            private Length columnWidth;
043:            private int numberColumnsRepeated;
044:            private int numberColumnsSpanned;
045:            // Unused but valid items, commented out for performance:
046:            //     private int visibility;
047:            // End of property values
048:
049:            private boolean defaultColumn;
050:            private PropertyList pList = null;
051:
052:            /**
053:             * @param parent FONode that is the parent of this object
054:             */
055:            public TableColumn(FONode parent) {
056:                this (parent, false);
057:            }
058:
059:            /**
060:             * @param parent FONode that is the parent of this object
061:             * @param defaultColumn true if this table-column has been manually created as a default column
062:             */
063:            public TableColumn(FONode parent, boolean defaultColumn) {
064:                super (parent);
065:                this .defaultColumn = defaultColumn;
066:            }
067:
068:            /**
069:             * @see org.apache.fop.fo.FObj#bind(PropertyList)
070:             */
071:            public void bind(PropertyList pList) throws FOPException {
072:                commonBorderPaddingBackground = pList
073:                        .getBorderPaddingBackgroundProps();
074:                columnNumber = pList.get(PR_COLUMN_NUMBER).getNumeric()
075:                        .getValue();
076:                columnWidth = pList.get(PR_COLUMN_WIDTH).getLength();
077:                numberColumnsRepeated = pList.get(PR_NUMBER_COLUMNS_REPEATED)
078:                        .getNumeric().getValue();
079:                numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED)
080:                        .getNumeric().getValue();
081:                super .bind(pList);
082:
083:                if (numberColumnsRepeated <= 0) {
084:                    throw new PropertyException(
085:                            "number-columns-repeated must be 1 or bigger, "
086:                                    + "but got " + numberColumnsRepeated);
087:                }
088:                if (numberColumnsSpanned <= 0) {
089:                    throw new PropertyException(
090:                            "number-columns-spanned must be 1 or bigger, "
091:                                    + "but got " + numberColumnsSpanned);
092:                }
093:
094:                /* check for unspecified width and replace with default of 
095:                 * proportional-column-width(1), in case of fixed table-layout
096:                 * warn only for explicit columns 
097:                 */
098:                if (columnWidth.getEnum() == EN_AUTO) {
099:                    if (!this .defaultColumn && !getTable().isAutoLayout()) {
100:                        log
101:                                .warn("table-layout=\"fixed\" and column-width unspecified "
102:                                        + "=> falling back to proportional-column-width(1)");
103:                    }
104:                    columnWidth = new TableColLength(1.0, this );
105:                }
106:
107:                /* in case of explicit columns, from-table-column()
108:                 * can be used on descendants of the table-cells, so
109:                 * we need a reference to the column's property list
110:                 * (cleared in Table.endOfNode())
111:                 */
112:                if (!this .defaultColumn) {
113:                    this .pList = pList;
114:                }
115:            }
116:
117:            /**
118:             * @see org.apache.fop.fo.FONode#startOfNode()
119:             */
120:            protected void startOfNode() throws FOPException {
121:                getFOEventHandler().startColumn(this );
122:            }
123:
124:            /**
125:             * @see org.apache.fop.fo.FONode#endOfNode
126:             */
127:            protected void endOfNode() throws FOPException {
128:                getFOEventHandler().endColumn(this );
129:            }
130:
131:            /**
132:             * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
133:             * XSL Content Model: empty
134:             */
135:            protected void validateChildNode(Locator loc, String nsURI,
136:                    String localName) throws ValidationException {
137:                invalidChildError(loc, nsURI, localName);
138:            }
139:
140:            /**
141:             * @return the Common Border, Padding, and Background Properties.
142:             */
143:            public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
144:                return commonBorderPaddingBackground;
145:            }
146:
147:            /**
148:             * @return the "column-width" property.
149:             */
150:            public Length getColumnWidth() {
151:                return columnWidth;
152:            }
153:
154:            /**
155:             * Sets the column width.
156:             * @param columnWidth the column width
157:             */
158:            public void setColumnWidth(Length columnWidth) {
159:                this .columnWidth = columnWidth;
160:            }
161:
162:            /**
163:             * @return the "column-number" property.
164:             */
165:            public int getColumnNumber() {
166:                return columnNumber;
167:            }
168:
169:            /**
170:             * Used for setting the column-number for an implicit column
171:             * @param columnNumber
172:             */
173:            protected void setColumnNumber(int columnNumber) {
174:                this .columnNumber = columnNumber;
175:            }
176:
177:            /** @return value for number-columns-repeated. */
178:            public int getNumberColumnsRepeated() {
179:                return numberColumnsRepeated;
180:            }
181:
182:            /** @return value for number-columns-spanned. */
183:            public int getNumberColumnsSpanned() {
184:                return numberColumnsSpanned;
185:            }
186:
187:            /** @see org.apache.fop.fo.FONode#getLocalName() */
188:            public String getLocalName() {
189:                return "table-column";
190:            }
191:
192:            /** @see org.apache.fop.fo.FObj#getNameId() */
193:            public int getNameId() {
194:                return FO_TABLE_COLUMN;
195:            }
196:
197:            /**
198:             * Indicates whether this table-column has been created as 
199:             * default column for this table in case no table-columns 
200:             * have been defined. 
201:             * Note that this only used to provide better
202:             * user feedback (see ColumnSetup).
203:             * @return true if this table-column has been created as default column
204:             */
205:            public boolean isDefaultColumn() {
206:                return defaultColumn;
207:            }
208:
209:            /** @see java.lang.Object#toString() */
210:            public String toString() {
211:                StringBuffer sb = new StringBuffer("fo:table-column");
212:                sb.append(" column-number=").append(getColumnNumber());
213:                if (getNumberColumnsRepeated() > 1) {
214:                    sb.append(" number-columns-repeated=").append(
215:                            getNumberColumnsRepeated());
216:                }
217:                if (getNumberColumnsSpanned() > 1) {
218:                    sb.append(" number-columns-spanned=").append(
219:                            getNumberColumnsSpanned());
220:                }
221:                sb.append(" column-width=").append(getColumnWidth());
222:                return sb.toString();
223:            }
224:
225:            /**
226:             * Retrieve a property value through its Id; used by 
227:             * from-table-column() function
228:             * 
229:             * @param propId    the id for the property to retrieve
230:             * @return the requested Property
231:             * @throws PropertyException
232:             */
233:            public Property getProperty(int propId) throws PropertyException {
234:                return this .pList.get(propId);
235:            }
236:
237:            /**
238:             * Clear the reference to the PropertyList (retained for 
239:             * from-table-column())
240:             */
241:            protected void releasePropertyList() {
242:                this.pList = null;
243:            }
244:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.