aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-10-19 08:53:51 +0000
committerFinn Bock <bckfnn@apache.org>2004-10-19 08:53:51 +0000
commitb0839fa1f93f128c6dd271930209e59228bb0472 (patch)
treef3ed77c6f9d3f58314beb64e7557eaf117f2d6aa /src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
parent85506764aad78e6aa4b675838aaed1f6fd23883a (diff)
downloadxmlgraphics-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/RepeatablePageMasterReference.java')
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java58
1 files changed, 51 insertions, 7 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
index 4ad7ab074..d01422500 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
@@ -26,6 +26,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.fo.properties.Property;
/**
@@ -36,10 +37,15 @@ import org.apache.fop.fo.properties.Property;
public class RepeatablePageMasterReference extends FObj
implements SubSequenceSpecifier {
+ // The value of properties relevant for fo:repeatable-page-master-reference.
+ private String masterReference;
+ private Property maximumRepeats;
+ // End of property values
+
private static final int INFINITE = -1;
private PageSequenceMaster pageSequenceMaster;
- private int maximumRepeats;
+ private int _maximumRepeats;
private int numberConsumed = 0;
/**
@@ -50,6 +56,27 @@ public class RepeatablePageMasterReference extends FObj
}
/**
+ * @see org.apache.fop.fo.FObj#bind(PropertyList)
+ */
+ public void bind(PropertyList pList) {
+ masterReference = pList.get(PR_MASTER_REFERENCE).getString();
+ maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#startOfNode
+ */
+ protected void startOfNode() throws SAXParseException {
+ PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
+
+ if (masterReference == null) {
+ missingPropertyError("master-reference");
+ } else {
+ pageSequenceMaster.addSubsequenceSpecifier(this);
+ }
+ }
+
+ /**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws SAXParseException {
@@ -66,13 +93,13 @@ public class RepeatablePageMasterReference extends FObj
Property mr = getProperty(PR_MAXIMUM_REPEATS);
if (mr.getEnum() == NO_LIMIT) {
- this.maximumRepeats = INFINITE;
+ this._maximumRepeats = INFINITE;
} else {
- this.maximumRepeats = mr.getNumber().intValue();
- if (this.maximumRepeats < 0) {
+ this._maximumRepeats = mr.getNumber().intValue();
+ if (this._maximumRepeats < 0) {
getLogger().debug("negative maximum-repeats: "
+ this.maximumRepeats);
- this.maximumRepeats = 0;
+ this._maximumRepeats = 0;
}
}
}
@@ -92,8 +119,8 @@ public class RepeatablePageMasterReference extends FObj
public String getNextPageMasterName(boolean isOddPage,
boolean isFirstPage,
boolean isEmptyPage) {
- if (maximumRepeats != INFINITE) {
- if (numberConsumed < maximumRepeats) {
+ if (_maximumRepeats != INFINITE) {
+ if (numberConsumed < _maximumRepeats) {
numberConsumed++;
} else {
return null;
@@ -103,6 +130,23 @@ public class RepeatablePageMasterReference extends FObj
}
/**
+ * Return the "maximum-repeats" property.
+ */
+ public int getMaximumRepeats() {
+ if (maximumRepeats.getEnum() == NO_LIMIT) {
+ return INFINITE;
+ } else {
+ int mr = maximumRepeats.getNumeric().getValue();
+ if (mr < 0) {
+ getLogger().debug("negative maximum-repeats: "
+ + this.maximumRepeats);
+ mr = 0;
+ }
+ return mr;
+ }
+ }
+
+ /**
* @see org.apache.fop.fo.pagination.SubSequenceSpecifier#reset()
*/
public void reset() {