Source Code Cross Referenced for TableCaptionLayoutManager.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: TableCaptionLayoutManager.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020:        package org.apache.fop.layoutmgr.table;
021:
022:        import org.apache.fop.fo.flow.TableCaption;
023:        import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
024:        import org.apache.fop.layoutmgr.LayoutContext;
025:        import org.apache.fop.layoutmgr.PositionIterator;
026:        import org.apache.fop.layoutmgr.Position;
027:        import org.apache.fop.area.Area;
028:        import org.apache.fop.area.Block;
029:
030:        /**
031:         * LayoutManager for a table-caption FO.
032:         * The table caption contains blocks that are placed beside the
033:         * table.
034:         * @todo Implement getNextKnuthElements()
035:         */
036:        public class TableCaptionLayoutManager extends
037:                BlockStackingLayoutManager {
038:            private TableCaption fobj;
039:
040:            private Block curBlockArea;
041:
042:            //private List childBreaks = new ArrayList();
043:
044:            /**
045:             * Create a new Caption layout manager.
046:             * @param node table-caption FO
047:             */
048:            public TableCaptionLayoutManager(TableCaption node) {
049:                super (node);
050:                fobj = node;
051:            }
052:
053:            /**
054:             * Get the next break position for the caption.
055:             *
056:             * @param context the layout context for finding breaks
057:             * @return the next break possibility
058:             */
059:            /*
060:            public BreakPoss getNextBreakPoss(LayoutContext context) {
061:                LayoutManager curLM; // currently active LM
062:
063:                MinOptMax stackSize = new MinOptMax();
064:                // if starting add space before
065:                // stackSize.add(spaceBefore);
066:                BreakPoss lastPos = null;
067:
068:                // if there is a caption then get the side and work out when
069:                // to handle it
070:
071:                while ((curLM = getChildLM()) != null) {
072:                    // Make break positions and return blocks!
073:                    // Set up a LayoutContext
074:                    int ipd = context.getRefIPD();
075:                    BreakPoss bp;
076:
077:                    LayoutContext childLC = new LayoutContext(0);
078:                    // if line layout manager then set stack limit to ipd
079:                    // line LM actually generates a LineArea which is a block
080:                    childLC.setStackLimit(
081:                          MinOptMax.subtract(context.getStackLimit(),
082:                                             stackSize));
083:                    childLC.setRefIPD(ipd);
084:
085:                    boolean over = false;
086:
087:                    while (!curLM.isFinished()) {
088:                        if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
089:                            if (stackSize.opt + bp.getStackingSize().opt > context.getStackLimit().max) {
090:                                // reset to last break
091:                                if (lastPos != null) {
092:                                    LayoutManager lm = lastPos.getLayoutManager();
093:                                    lm.resetPosition(lastPos.getPosition());
094:                                    if (lm != curLM) {
095:                                        curLM.resetPosition(null);
096:                                    }
097:                                } else {
098:                                    curLM.resetPosition(null);
099:                                }
100:                                over = true;
101:                                break;
102:                            }
103:                            stackSize.add(bp.getStackingSize());
104:                            lastPos = bp;
105:                            childBreaks.add(bp);
106:
107:                            if (bp.nextBreakOverflows()) {
108:                                over = true;
109:                                break;
110:                            }
111:
112:                            childLC.setStackLimit(MinOptMax.subtract(
113:                                                     context.getStackLimit(), stackSize));
114:                        }
115:                    }
116:                    BreakPoss breakPoss = new BreakPoss(
117:                                            new LeafPosition(this, childBreaks.size() - 1));
118:                    if (over) {
119:                        breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
120:                    }
121:                    breakPoss.setStackingSize(stackSize);
122:                    return breakPoss;
123:                }
124:                setFinished(true);
125:                return null;
126:            }*/
127:
128:            /**
129:             * Add the areas to the parent.
130:             *
131:             * @param parentIter the position iterator of the breaks
132:             * @param layoutContext the layout context for adding areas
133:             */
134:            public void addAreas(PositionIterator parentIter,
135:                    LayoutContext layoutContext) {
136:                getParentArea(null);
137:                getPSLM().addIDToPage(fobj.getId());
138:
139:                /* TODO: Reimplement using Knuth approach
140:                LayoutManager childLM;
141:                int iStartPos = 0;
142:                LayoutContext lc = new LayoutContext(0);
143:                while (parentIter.hasNext()) {
144:                    LeafPosition lfp = (LeafPosition) parentIter.next();
145:                    // Add the block areas to Area
146:                    PositionIterator breakPosIter = new BreakPossPosIter(
147:                            childBreaks, iStartPos, lfp.getLeafPos() + 1);
148:                    iStartPos = lfp.getLeafPos() + 1;
149:                    while ((childLM = breakPosIter.getNextChildLM()) != null) {
150:                        childLM.addAreas(breakPosIter, lc);
151:                    }
152:                }*/
153:
154:                flush();
155:
156:                //childBreaks.clear();
157:                curBlockArea = null;
158:            }
159:
160:            /**
161:             * Return an Area which can contain the passed childArea. The childArea
162:             * may not yet have any content, but it has essential traits set.
163:             * In general, if the LayoutManager already has an Area it simply returns
164:             * it. Otherwise, it makes a new Area of the appropriate class.
165:             * It gets a parent area for its area by calling its parent LM.
166:             * Finally, based on the dimensions of the parent area, it initializes
167:             * its own area. This includes setting the content IPD and the maximum
168:             * BPD.
169:             *
170:             * @param childArea the child area
171:             * @return the parent area from this caption
172:             */
173:            public Area getParentArea(Area childArea) {
174:                if (curBlockArea == null) {
175:                    curBlockArea = new Block();
176:                    // Set up dimensions
177:                    // Must get dimensions from parent area
178:                    Area parentArea = parentLM.getParentArea(curBlockArea);
179:                    int referenceIPD = parentArea.getIPD();
180:                    curBlockArea.setIPD(referenceIPD);
181:                    // Get reference IPD from parentArea
182:                    setCurrentArea(curBlockArea); // ??? for generic operations
183:                }
184:                return curBlockArea;
185:            }
186:
187:            /**
188:             * Add the child to the caption area.
189:             *
190:             * @param childArea the child area to add
191:             */
192:            public void addChildArea(Area childArea) {
193:                if (curBlockArea != null) {
194:                    curBlockArea.addBlock((Block) childArea);
195:                }
196:            }
197:
198:            /**
199:             * Reset the layout position.
200:             *
201:             * @param resetPos the position to reset to
202:             */
203:            public void resetPosition(Position resetPos) {
204:                if (resetPos == null) {
205:                    reset(null);
206:                }
207:            }
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.