Source Code Cross Referenced for EffRow.java in  » Graphic-Library » fop » org » apache » fop » layoutmgr » table » 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.layoutmgr.table 
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: EffRow.java 478928 2006-11-24 17:32:48Z vhennebert $ */
019:
020:        package org.apache.fop.layoutmgr.table;
021:
022:        import java.util.Iterator;
023:        import java.util.List;
024:
025:        import org.apache.fop.fo.flow.TableRow;
026:        import org.apache.fop.traits.MinOptMax;
027:
028:        /**
029:         * This class represents an effective row in a table and holds a list of grid units occupying
030:         * the row as well as some additional values.
031:         */
032:        class EffRow {
033:
034:            /** Indicates that the row is the first in a table-body */
035:            public static final int FIRST_IN_PART = GridUnit.FIRST_IN_PART;
036:            /** Indicates that the row is the last in a table-body */
037:            public static final int LAST_IN_PART = GridUnit.LAST_IN_PART;
038:
039:            private List gridUnits = new java.util.ArrayList();
040:            private int index;
041:            /** One of HEADER, FOOTER, BODY */
042:            private int bodyType;
043:            private MinOptMax height;
044:            private MinOptMax explicitHeight;
045:
046:            /**
047:             * Creates a new effective row instance.
048:             * @param index index of the row
049:             * @param bodyType type of body (one of HEADER, FOOTER, BODY as found on TableRowIterator)
050:             */
051:            public EffRow(int index, int bodyType) {
052:                this .index = index;
053:                this .bodyType = bodyType;
054:            }
055:
056:            /** @return the index of the EffRow in the sequence of rows */
057:            public int getIndex() {
058:                return this .index;
059:            }
060:
061:            /**
062:             * @return an indicator what type of body this EffRow is in (one of HEADER, FOOTER, BODY 
063:             * as found on TableRowIterator)
064:             */
065:            public int getBodyType() {
066:                return this .bodyType;
067:            }
068:
069:            /** @return the table-row FO for this EffRow, or null if there is no table-row. */
070:            public TableRow getTableRow() {
071:                return getGridUnit(0).getRow();
072:            }
073:
074:            /** @return the calculated height for this EffRow. */
075:            public MinOptMax getHeight() {
076:                return this .height;
077:            }
078:
079:            /**
080:             * Sets the calculated height for this EffRow.
081:             * @param mom the calculated height
082:             */
083:            public void setHeight(MinOptMax mom) {
084:                this .height = mom;
085:            }
086:
087:            /** @return the explicit height of the EffRow (as specified through properties) */
088:            public MinOptMax getExplicitHeight() {
089:                return this .explicitHeight;
090:            }
091:
092:            /**
093:             * Sets the height for this row that resulted from the explicit height properties specified
094:             * by the user.
095:             * @param mom the height
096:             */
097:            public void setExplicitHeight(MinOptMax mom) {
098:                this .explicitHeight = mom;
099:            }
100:
101:            /** @return the list of GridUnits for this EffRow */
102:            public List getGridUnits() {
103:                return gridUnits;
104:            }
105:
106:            /**
107:             * Returns the grid unit at a given position.
108:             * @param column index of the grid unit in the row (zero based)
109:             * @return the requested grid unit.
110:             */
111:            public GridUnit getGridUnit(int column) {
112:                return (GridUnit) gridUnits.get(column);
113:            }
114:
115:            /**
116:             * Returns the grid unit at a given position. In contrast to getGridUnit() this 
117:             * method returns null if there's no grid unit at the given position. The number of
118:             * grid units for row x can be smaller than the number of grid units for row x-1.
119:             * @param column index of the grid unit in the row (zero based)
120:             * @return the requested grid unit or null if there's no grid unit at this position.
121:             */
122:            public GridUnit safelyGetGridUnit(int column) {
123:                if (column < gridUnits.size()) {
124:                    return (GridUnit) gridUnits.get(column);
125:                } else {
126:                    return null;
127:                }
128:            }
129:
130:            /**
131:             * Sets a flag on all grid units of this effective row.
132:             * @param flag which flag to set (on of the GridUnit.* constants)
133:             * @param value new value for the flag
134:             */
135:            public void setFlagForAllGridUnits(int flag, boolean value) {
136:                Iterator iter = gridUnits.iterator();
137:                while (iter.hasNext()) {
138:                    GridUnit gu = (GridUnit) iter.next();
139:                    gu.setFlag(flag, value);
140:                }
141:            }
142:
143:            /**
144:             * Returns a flag for this effective row. Only a subset of the flags on GridUnit is supported.
145:             * The flag is determined by inspecting flags on the EffRow's GridUnits.
146:             * @param which the requested flag (one of {@link EffRow#FIRST_IN_PART} or {@link
147:             * EffRow#LAST_IN_PART})
148:             * @return true if the flag is set
149:             */
150:            public boolean getFlag(int which) {
151:                if (which == FIRST_IN_PART) {
152:                    return getGridUnit(0).getFlag(GridUnit.FIRST_IN_PART);
153:                } else if (which == LAST_IN_PART) {
154:                    return getGridUnit(0).getFlag(GridUnit.LAST_IN_PART);
155:                } else {
156:                    throw new IllegalArgumentException("Illegal flag queried: "
157:                            + which);
158:                }
159:            }
160:
161:            /** @see java.lang.Object#toString() */
162:            public String toString() {
163:                StringBuffer sb = new StringBuffer("EffRow {");
164:                sb.append(index);
165:                if (getBodyType() == TableRowIterator.BODY) {
166:                    sb.append(" in body");
167:                } else if (getBodyType() == TableRowIterator.HEADER) {
168:                    sb.append(" in header");
169:                } else {
170:                    sb.append(" in footer");
171:                }
172:                sb.append(", ").append(height);
173:                sb.append(", ").append(explicitHeight);
174:                sb.append(", ").append(gridUnits.size()).append(" gu");
175:                sb.append("}");
176:                return sb.toString();
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.