diff options
author | Finn Bock <bckfnn@apache.org> | 2004-10-19 08:53:51 +0000 |
---|---|---|
committer | Finn Bock <bckfnn@apache.org> | 2004-10-19 08:53:51 +0000 |
commit | b0839fa1f93f128c6dd271930209e59228bb0472 (patch) | |
tree | f3ed77c6f9d3f58314beb64e7557eaf117f2d6aa /src/java/org/apache/fop/fo/pagination/Flow.java | |
parent | 85506764aad78e6aa4b675838aaed1f6fd23883a (diff) | |
download | xmlgraphics-fop-b0839fa1f93f128c6dd271930209e59228bb0472.tar.gz xmlgraphics-fop-b0839fa1f93f128c6dd271930209e59228bb0472.zip |
First phase of performance improvement. Added bind() and startOfNode()
methods to the FO nodes, unused for now.
PR: 31699
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198054 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination/Flow.java')
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Flow.java | 77 |
1 files changed, 64 insertions, 13 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java index aa751a9a6..09cafb357 100644 --- a/src/java/org/apache/fop/fo/pagination/Flow.java +++ b/src/java/org/apache/fop/fo/pagination/Flow.java @@ -30,6 +30,7 @@ import org.xml.sax.SAXParseException; // FOP import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; +import org.apache.fop.fo.PropertyList; import org.apache.fop.layoutmgr.FlowLayoutManager; /** @@ -37,7 +38,10 @@ import org.apache.fop.layoutmgr.FlowLayoutManager; * @todo check need for markerSnapshot, contentWidth */ public class Flow extends FObj { - + // The value of properties relevant for fo:flow. + private String flowName; + // End of property values + /** * ArrayList to store snapshot */ @@ -59,6 +63,58 @@ public class Flow extends FObj { } /** + * @see org.apache.fop.fo.FObj#bind(PropertyList) + */ + public void bind(PropertyList pList) { + flowName = pList.get(PR_FLOW_NAME).getString(); + } + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws SAXParseException { + if (!parent.getName().equals("fo:page-sequence")) { + throw new SAXParseException("flow must be child of " + + "page-sequence, not " + parent.getName(), locator); + } + + if (flowName == null || flowName.equals("")) { + missingPropertyError("flow-name"); + } + + // according to communication from Paul Grosso (XSL-List, + // 001228, Number 406), confusion in spec section 6.4.5 about + // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) + // fo:flow per fo:page-sequence only. + + /* if (pageSequence.isFlowSet()) { + if (this.name.equals("fo:flow")) { + throw new FOPException("Only a single fo:flow permitted" + + " per fo:page-sequence"); + } else { + throw new FOPException(this.name + + " not allowed after fo:flow"); + } + } + */ + // Now done in addChild of page-sequence + //pageSequence.addFlow(this); + getFOEventHandler().startFlow(this); + } + + /** + * Make sure content model satisfied, if so then tell the + * FOEventHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws SAXParseException { + if (!blockItemFound) { + missingChildElementError("marker* (%block;)+"); + } + getFOEventHandler().endFlow(this); + } + + /** * @see org.apache.fop.fo.FObj#addProperties */ protected void addProperties(Attributes attlist) throws SAXParseException { @@ -92,18 +148,6 @@ public class Flow extends FObj { } /** - * Make sure content model satisfied, if so then tell the - * FOEventHandler that we are at the end of the flow. - * @see org.apache.fop.fo.FONode#endOfNode - */ - protected void endOfNode() throws SAXParseException { - if (!blockItemFound) { - missingChildElementError("marker* (%block;)+"); - } - getFOEventHandler().endFlow(this); - } - - /** * @param contentWidth content width of this flow, in millipoints (??) */ protected void setContentWidth(int contentWidth) { @@ -126,6 +170,13 @@ public class Flow extends FObj { } /** + * @return the name of this flow + */ + public String getFlowName() { + return flowName; + } + + /** * @see org.apache.fop.fo.FONode#addLayoutManager(List) */ public void addLayoutManager(List list) { |