You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2005/03/11 08:23:44 UTC
cvs commit: xml-fop/src/java/org/apache/fop/render/xml XMLRenderer.java
gmazza 2005/03/10 23:23:43
Modified: src/java/org/apache/fop/area BeforeFloat.java
BodyRegion.java Footnote.java MainReference.java
Span.java
src/java/org/apache/fop/layoutmgr LeaderLayoutManager.java
LeafNodeLayoutManager.java
PageSequenceLayoutManager.java
src/java/org/apache/fop/layoutmgr/list
ListBlockLayoutManager.java
src/java/org/apache/fop/render AbstractRenderer.java
src/java/org/apache/fop/render/xml XMLRenderer.java
Added: src/java/org/apache/fop/area NormalFlow.java
Removed: src/java/org/apache/fop/area Flow.java
Log:
1.) More commenting, some simplifications in the Area classes and PSLM.
2.) Renamed Area.Flow to NormalFlow, uglier but more in conformance with the Recommendation (normal-flow-reference-area) and more specific/easier to understand.
Revision Changes Path
1.4 +3 -3 xml-fop/src/java/org/apache/fop/area/BeforeFloat.java
Index: BeforeFloat.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/BeforeFloat.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BeforeFloat.java 22 Sep 2004 08:18:41 -0000 1.3
+++ BeforeFloat.java 11 Mar 2005 07:23:43 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
package org.apache.fop.area;
/**
- * The before float area.
- * This is used to place the before float areas.
+ * The before-float-reference-area optionally generated by an fo:region-body.
* It has an optional separator and before float block children.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class BeforeFloat extends BlockParent {
// this is an optional block area that will be rendered
1.10 +7 -6 xml-fop/src/java/org/apache/fop/area/BodyRegion.java
Index: BodyRegion.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/BodyRegion.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BodyRegion.java 5 Mar 2005 19:53:13 -0000 1.9
+++ BodyRegion.java 11 Mar 2005 07:23:43 -0000 1.10
@@ -21,14 +21,15 @@
import org.apache.fop.fo.Constants;
/**
- * The body region area.
- * This area contains a main reference area and optionally a
- * before float and footnote area.
+ * This class is a container for all areas that may be generated by
+ * an fo:region-body. It extends the RegionReference that is used
+ * directly by the other region classes.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class BodyRegion extends RegionReference {
- private BeforeFloat beforeFloat;
- private MainReference mainReference;
- private Footnote footnote;
+ private BeforeFloat beforeFloat; // optional
+ private MainReference mainReference; // mandatory
+ private Footnote footnote; // optional
private int columnGap;
private int columnCount;
1.3 +3 -2 xml-fop/src/java/org/apache/fop/area/Footnote.java
Index: Footnote.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Footnote.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Footnote.java 27 Feb 2004 17:41:26 -0000 1.2
+++ Footnote.java 11 Mar 2005 07:23:43 -0000 1.3
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,9 @@
// may combine with before float into a conditional area
/**
- * Footnote reference area.
+ * The footnote-reference-area optionally generated by an fo:region-body.
* This areas holds footnote areas and an optional separator area.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class Footnote extends BlockParent {
private Block separator = null;
1.5 +7 -5 xml-fop/src/java/org/apache/fop/area/MainReference.java
Index: MainReference.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/MainReference.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MainReference.java 5 Mar 2005 00:32:25 -0000 1.4
+++ MainReference.java 11 Mar 2005 07:23:43 -0000 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,8 +22,10 @@
import java.util.Iterator;
/**
- * The main body reference area.
- * This area that contains the flow via the span areas.
+ * The main-reference-area generated by an fo:region-body
+ * This object holds one or more span-reference-areas (block-areas
+ * stacked in the block progression direction)
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class MainReference extends Area {
private List spanAreas = new java.util.ArrayList();
@@ -69,7 +71,7 @@
for (Iterator spaniter = spanAreas.iterator(); spaniter.hasNext(); ) {
Span spanArea = (Span) spaniter.next();
for (int i = 0; i < spanArea.getColumnCount(); i++) {
- Flow flow = spanArea.getFlow(i);
+ NormalFlow flow = spanArea.getNormalFlow(i);
if (flow != null) {
if (flow.getChildAreas() != null) {
areaCount += flow.getChildAreas().size();
@@ -87,7 +89,7 @@
/**
* Get the column gap in millipoints.
*
- * @return the column gap in millioints
+ * @return the column gap in millipoints
*/
public int getColumnGap() {
return columnGap;
1.4 +29 -15 xml-fop/src/java/org/apache/fop/area/Span.java
Index: Span.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Span.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Span.java 5 Mar 2005 19:53:13 -0000 1.3
+++ Span.java 11 Mar 2005 07:23:43 -0000 1.4
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,18 @@
import java.util.List;
/**
- * The span reference area.
- * This is a reference area block area with 0 border and padding
- * The span reference areas are stacked inside the main reference area.
+ * The span-reference-area.
+ * This is a block-area with 0 border and padding that is stacked
+ * within the main-reference-area
+ * This object holds one or more normal-flow-reference-area children
+ * based on the column-count trait in effect for this span.
+ * See fo:region-body definition in the XSL Rec for more information.
*/
public class Span extends Area {
// the list of flow reference areas in this span area
private List flowAreas;
private int height;
+ private int columnCount;
/**
* Create a span area with the number of columns for this span area.
@@ -37,25 +41,26 @@
*/
public Span(int cols) {
flowAreas = new java.util.ArrayList(cols);
+ columnCount = cols;
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
/**
- * Add a flow area to this span area.
+ * Add a normal-flow-reference-area to this span-reference-area.
*
- * @param flow the flow area to add
+ * @param flow the normal-flow-reference-area to add
*/
- public void addFlow(Flow flow) {
+ public void addNormalFlow(NormalFlow flow) {
flowAreas.add(flow);
}
/**
- * Create a new flow and add it to this span area
+ * Create a new normal flow and add it to this span area
*
- * @return the newly made Flow object
+ * @return the newly made NormalFlow object
*/
- public Flow addNewFlow() {
- Flow newFlow = new Flow();
+ public NormalFlow addNewNormalFlow() {
+ NormalFlow newFlow = new NormalFlow();
newFlow.setIPD(getIPD());
flowAreas.add(newFlow);
return newFlow;
@@ -64,9 +69,18 @@
/**
* Get the column count for this span area.
*
- * @return the number of columns in this span area
+ * @return the number of columns defined for this span area
*/
public int getColumnCount() {
+ return columnCount;
+ }
+
+ /**
+ * Get the count of normal flows for this span area.
+ *
+ * @return the number of normal flows attached to this span
+ */
+ public int getNormalFlowCount() {
return flowAreas.size();
}
@@ -80,13 +94,13 @@
}
/**
- * Get the flow area for a particular column.
+ * Get the normal flow area for a particular column.
*
* @param count the column number for the flow
* @return the flow area for the requested column
*/
- public Flow getFlow(int count) {
- return (Flow) flowAreas.get(count);
+ public NormalFlow getNormalFlow(int columnNumber) {
+ return (NormalFlow) flowAreas.get(columnNumber);
}
}
1.1 xml-fop/src/java/org/apache/fop/area/NormalFlow.java
Index: NormalFlow.java
===================================================================
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id: NormalFlow.java,v 1.1 2005/03/11 07:23:43 gmazza Exp $ */
package org.apache.fop.area;
/**
* The normal-flow-reference-area class.
* Each span-reference-area contains one or more of these objects
* See fo:region-body definition in the XSL Rec for more information.
*/
public class NormalFlow extends BlockParent {
/**
* Constructor.
*/
public NormalFlow() {
addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
}
}
1.15 +2 -2 xml-fop/src/java/org/apache/fop/layoutmgr/LeaderLayoutManager.java
Index: LeaderLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LeaderLayoutManager.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- LeaderLayoutManager.java 10 Dec 2004 10:12:21 -0000 1.14
+++ LeaderLayoutManager.java 11 Mar 2005 07:23:43 -0000 1.15
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
1.13 +1 -1 xml-fop/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
Index: LeafNodeLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- LeafNodeLayoutManager.java 24 Nov 2004 21:07:30 -0000 1.12
+++ LeafNodeLayoutManager.java 11 Mar 2005 07:23:43 -0000 1.13
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
1.41 +15 -19 xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
Index: PageSequenceLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- PageSequenceLayoutManager.java 5 Mar 2005 19:53:13 -0000 1.40
+++ PageSequenceLayoutManager.java 11 Mar 2005 07:23:43 -0000 1.41
@@ -25,7 +25,7 @@
import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.Flow;
+import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.Page;
import org.apache.fop.area.RegionViewport;
@@ -89,11 +89,8 @@
/** Current span being filled */
private Span curSpan;
- /** Number of columns in current span area. */
- private int curSpanColumns;
-
- /** Current flow-reference-area (column) being filled. */
- private Flow curFlow;
+ /** Current normal-flow-reference-area being filled. */
+ private NormalFlow curFlow;
private int flowBPD = 0;
private int flowIPD = 0;
@@ -400,14 +397,14 @@
return;
}
if (childArea.getAreaClass() == Area.CLASS_NORMAL) {
- placeFlowRefArea(childArea);
+ placeNormalFlowRefArea(childArea);
} else {
// todo: all the others!
}
}
/**
- * Place a FlowReferenceArea into the current span. The FlowLM is
+ * Place a normal-flow-reference-area into the current span. The FlowLM is
* responsible for making sure that it will actually fit in the
* current span area. In fact the area has already been added to the
* current span, so we are just checking to see if the span is "full",
@@ -415,7 +412,7 @@
*
* @param area the area to place
*/
- protected void placeFlowRefArea(Area area) {
+ protected void placeNormalFlowRefArea(Area area) {
// assert (curSpan != null);
// assert (area == curFlow);
// assert (curFlow == curSpan.getFlow(curSpan.getColumnCount()-1));
@@ -434,7 +431,7 @@
// ":" + curSpan.getMaxBPD().min);
/*if (area.getAllocationBPD().max >= curSpan.getMaxBPD().min) {
// Consider it filled
- if (curSpan.getColumnCount() == curSpanColumns) {
+ if (curSpan.getColumnCount() == curSpan.getNormalFlowCount()) {
finishPage();
} else
curFlow = null; // Create new flow on next getParentArea()
@@ -588,9 +585,9 @@
if (curSpan == null) {
createBodyMainReferenceArea();
bNeedSpan = true;
- } else if (numCols != curSpanColumns) {
+ } else if (numCols != curSpan.getNormalFlowCount()) {
// todo: BALANCE EXISTING COLUMNS
- if (curSpanColumns > 1) {
+ if (curSpan.getNormalFlowCount() > 1) {
// balanceColumns();
}
bNeedSpan = true;
@@ -599,7 +596,7 @@
// Make a new span and the first flow
createSpan(numCols);
} else if (curFlow == null) {
- curFlow = curSpan.addNewFlow();
+ curFlow = curSpan.addNewNormalFlow();
}
return curFlow;
} else {
@@ -636,10 +633,10 @@
*/
private void handleBreak(int breakVal) {
if (breakVal == Constants.EN_COLUMN) {
- if (curSpan != null
- && curSpan.getColumnCount() != curSpanColumns) {
+ if (curSpan != null // TODO: change below to < or <=
+ && curSpan.getNormalFlowCount() != curSpan.getColumnCount()) {
// Move to next column
- curFlow = curSpan.addNewFlow();
+ curFlow = curSpan.addNewNormalFlow();
return;
}
// else need new page
@@ -717,7 +714,6 @@
//}
//else newpos = new MinOptMax();
curSpan = new Span(numCols);
- curSpanColumns = numCols;
// get Width or Height as IPD for span
RegionViewport rv = curPage.getPage().getRegionViewport(FO_REGION_BODY);
@@ -727,7 +723,7 @@
curSpan.setIPD(ipdWidth);
//curSpan.setPosition(BPD, newpos);
curBody.getMainReference().addSpan(curSpan);
- curFlow = curSpan.addNewFlow();
+ curFlow = curSpan.addNewNormalFlow();
}
private PageViewport createPageAreas(SimplePageMaster spm) {
1.11 +1 -1 xml-fop/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
Index: ListBlockLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ListBlockLayoutManager.java 28 Jan 2005 16:59:28 -0000 1.10
+++ ListBlockLayoutManager.java 11 Mar 2005 07:23:43 -0000 1.11
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
1.43 +3 -3 xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java
Index: AbstractRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/AbstractRenderer.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- AbstractRenderer.java 7 Feb 2005 11:00:19 -0000 1.42
+++ AbstractRenderer.java 11 Mar 2005 07:23:43 -0000 1.43
@@ -37,7 +37,7 @@
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BodyRegion;
import org.apache.fop.area.CTM;
-import org.apache.fop.area.Flow;
+import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.Footnote;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.MainReference;
@@ -380,7 +380,7 @@
- (span.getColumnCount() - 1) * mr.getColumnGap())
/ span.getColumnCount() + mr.getColumnGap();
for (int c = 0; c < span.getColumnCount(); c++) {
- Flow flow = (Flow) span.getFlow(c);
+ NormalFlow flow = (NormalFlow) span.getNormalFlow(c);
renderFlow(flow);
currentIPPosition += offset;
@@ -395,7 +395,7 @@
*
* @param flow The flow reference area
*/
- protected void renderFlow(Flow flow) {
+ protected void renderFlow(NormalFlow flow) {
// the normal flow reference area contains stacked blocks
List blocks = flow.getChildAreas();
if (blocks != null) {
1.44 +3 -3 xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java
Index: XMLRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/xml/XMLRenderer.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- XMLRenderer.java 6 Feb 2005 20:48:48 -0000 1.43
+++ XMLRenderer.java 11 Mar 2005 07:23:43 -0000 1.44
@@ -47,7 +47,7 @@
import org.apache.fop.area.Block;
import org.apache.fop.area.BlockViewport;
import org.apache.fop.area.BodyRegion;
-import org.apache.fop.area.Flow;
+import org.apache.fop.area.NormalFlow;
import org.apache.fop.area.Footnote;
import org.apache.fop.area.LineArea;
import org.apache.fop.area.MainReference;
@@ -445,7 +445,7 @@
addTraitAttributes(span);
startElement("span", atts);
for (int c = 0; c < span.getColumnCount(); c++) {
- Flow flow = (Flow) span.getFlow(c);
+ NormalFlow flow = (NormalFlow) span.getNormalFlow(c);
renderFlow(flow);
}
@@ -457,7 +457,7 @@
/**
* @see org.apache.fop.render.AbstractRenderer#renderFlow(Flow)
*/
- protected void renderFlow(Flow flow) {
+ protected void renderFlow(NormalFlow flow) {
// the normal flow reference area contains stacked blocks
atts.clear();
addAreaAttributes(flow);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org