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/05/16 04:54:19 UTC
cvs commit: xml-fop/src/java/org/apache/fop/area RegionReference.java PageViewport.java
gmazza 2005/05/15 19:54:19
Modified: src/java/org/apache/fop/layoutmgr
StaticContentLayoutManager.java
PageSequenceLayoutManager.java
LayoutManagerMapping.java LayoutManagerMaker.java
src/java/org/apache/fop/area RegionReference.java
PageViewport.java
Log:
Backtracked a bit with SCLM: switched to providing the Region FO
instead of the region-reference-area, the latter obtainable already
from getCurrentPV().
Switched to a tighter 3-param SCLM constructor, also new
convenience method in PV.
Revision Changes Path
1.11 +8 -21 xml-fop/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
Index: StaticContentLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- StaticContentLayoutManager.java 14 May 2005 05:22:16 -0000 1.10
+++ StaticContentLayoutManager.java 16 May 2005 02:54:19 -0000 1.11
@@ -22,7 +22,6 @@
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.datatypes.PercentBase;
-import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.traits.MinOptMax;
@@ -41,28 +40,17 @@
public class StaticContentLayoutManager extends BlockStackingLayoutManager {
private RegionReference targetRegion;
private List blockBreaks = new ArrayList();
+ private SideRegion regionFO;
- public StaticContentLayoutManager(StaticContent node) {
+ public StaticContentLayoutManager(PageSequenceLayoutManager pslm,
+ StaticContent node, SideRegion reg) {
super(node);
+ setParent(pslm);
+ regionFO = reg;
+ targetRegion = getCurrentPV().getRegionReference(regionFO.getNameId());
}
/**
- * Sets the region reference
- * @param region region reference
- */
- public void setTargetRegion(RegionReference targetRegion) {
- this.targetRegion = targetRegion;
- }
-
- /**
- * @return the region-reference-area that this
- * static content is directed to.
- */
- public RegionReference getTargetRegion() {
- return targetRegion;
- }
-
- /**
* @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(org.apache.fop.layoutmgr.LayoutContext, int)
*/
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
@@ -229,12 +217,11 @@
}
public void doLayout() {
- Region region = targetRegion.getRegionFO();
StaticContentBreaker breaker = new StaticContentBreaker(
- this, targetRegion.getIPD(), region.getDisplayAlign());
+ this, targetRegion.getIPD(), regionFO.getDisplayAlign());
breaker.doLayout(targetRegion.getBPD());
if (breaker.isOverflow()) {
- if (region.getOverflow() == EN_ERROR_IF_OVERFLOW) {
+ if (regionFO.getOverflow() == EN_ERROR_IF_OVERFLOW) {
//TODO throw layout exception
}
log.warn("static-content overflows the available area.");
1.55 +4 -8 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.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- PageSequenceLayoutManager.java 14 May 2005 19:28:32 -0000 1.54
+++ PageSequenceLayoutManager.java 16 May 2005 02:54:19 -0000 1.55
@@ -24,7 +24,6 @@
import org.apache.fop.area.AreaTreeModel;
import org.apache.fop.area.PageViewport;
import org.apache.fop.area.LineArea;
-import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.Resolvable;
import org.apache.fop.datatypes.PercentBase;
@@ -426,12 +425,9 @@
return;
}
- RegionViewport rv = curPV.getPage().getRegionViewport(regionID);
- StaticContentLayoutManager lm;
- lm = (StaticContentLayoutManager)
- getLayoutManagerMaker().makeLayoutManager(sc);
- lm.setTargetRegion(rv.getRegionReference());
- lm.setParent(this);
+ StaticContentLayoutManager lm = (StaticContentLayoutManager)
+ getLayoutManagerMaker().makeStaticContentLayoutManager(
+ this, sc, reg);
lm.doLayout();
lm.reset(null);
}
1.9 +10 -8 xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
Index: LayoutManagerMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LayoutManagerMapping.java 13 May 2005 19:16:51 -0000 1.8
+++ LayoutManagerMapping.java 16 May 2005 02:54:19 -0000 1.9
@@ -56,6 +56,7 @@
import org.apache.fop.fo.flow.Wrapper;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.fo.pagination.SideRegion;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.area.AreaTreeHandler;
@@ -118,7 +119,6 @@
makers.put(TableFooter.class, new /*TableBodyLayoutManager*/Maker());
makers.put(TableHeader.class, new /*TableBodyLayoutManager*/Maker());
makers.put(Flow.class, new FlowLayoutManagerMaker());
- makers.put(StaticContent.class, new StaticContentLayoutManagerMaker());
makers.put(Wrapper.class, new WrapperLayoutManagerMaker());
makers.put(Title.class, new InlineLayoutManagerMaker());
}
@@ -158,6 +158,14 @@
return new PageSequenceLayoutManager(ath, ps);
}
+ /*
+ * @see org.apache.fop.layoutmgr.LayoutManagerMaker#makeStaticContentLayoutManager(org.apache.fop.layoutmgr.PageSequenceLayoutManager, org.apache.fop.fo.pagination.StaticContent, org.apache.fop.fo.pagination.Region)
+ */
+ public StaticContentLayoutManager makeStaticContentLayoutManager(
+ PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg) {
+ return new StaticContentLayoutManager(pslm, sc, reg);
+ }
+
public static class Maker {
public void make(FONode node, List lms) {
// no layout manager
@@ -389,12 +397,6 @@
}
}
- public static class StaticContentLayoutManagerMaker extends Maker {
- public void make(FONode node, List lms) {
- lms.add(new StaticContentLayoutManager((StaticContent) node));
- }
- }
-
public class WrapperLayoutManagerMaker extends Maker {
public void make(FONode node, List lms) {
Iterator baseIter;
1.4 +14 -1 xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java
Index: LayoutManagerMaker.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LayoutManagerMaker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LayoutManagerMaker.java 13 May 2005 19:16:51 -0000 1.3
+++ LayoutManagerMaker.java 16 May 2005 02:54:19 -0000 1.4
@@ -20,6 +20,8 @@
import java.util.List;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.pagination.PageSequence;
+import org.apache.fop.fo.pagination.SideRegion;
+import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.area.AreaTreeHandler;
@@ -55,5 +57,16 @@
public PageSequenceLayoutManager makePageSequenceLayoutManager(
AreaTreeHandler ath, PageSequence ps);
+ /**
+ * Make a StaticContentLayoutManager object.
+ * @param pslm the parent PageSequenceLayoutManager object
+ * @param sc the fo:static-content object this SCLM will process
+ * @param reg the side region indicating where the static content
+ * needs to be processed.
+ * @return The created StaticContentLayoutManager object
+ */
+ public StaticContentLayoutManager makeStaticContentLayoutManager(
+ PageSequenceLayoutManager pslm, StaticContent sc, SideRegion reg);
+
}
1.9 +0 -10 xml-fop/src/java/org/apache/fop/area/RegionReference.java
Index: RegionReference.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/RegionReference.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- RegionReference.java 14 May 2005 05:22:16 -0000 1.8
+++ RegionReference.java 16 May 2005 02:54:19 -0000 1.9
@@ -98,16 +98,6 @@
}
/**
- * Return the Region FO which provides the
- * traits for this region.
- *
- * @return the region formatting object
- */
- public Region getRegionFO() {
- return regionFO;
- }
-
- /**
* Add a block area to this region reference area.
*
* @param block the block area to add
1.16 +15 -1 xml-fop/src/java/org/apache/fop/area/PageViewport.java
Index: PageViewport.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/PageViewport.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- PageViewport.java 14 May 2005 16:41:45 -0000 1.15
+++ PageViewport.java 16 May 2005 02:54:19 -0000 1.16
@@ -33,6 +33,7 @@
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.SimplePageMaster;
+import org.apache.fop.layoutmgr.StaticContentLayoutManager;
/**
* Page viewport that specifies the viewport area and holds the page contents.
@@ -470,5 +471,18 @@
*/
public NormalFlow moveToNextFlow() {
return getCurrentSpan().moveToNextFlow();
- }
+ }
+
+ /**
+ * Convenience method to return a given region-reference-area,
+ * keyed by the Constants class identifier for the corresponding
+ * formatting object (ie. Constants.FO_REGION_BODY, FO_REGION_START,
+ * etc.)
+ *
+ * @param id the Constants class identifier for the region.
+ * @return the corresponding region-reference-area for this page.
+ */
+ public RegionReference getRegionReference(int id) {
+ return getPage().getRegionViewport(id).getRegionReference();
+ }
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org