gmazza 2004/08/26 22:36:43
Modified: src/java/org/apache/fop/fo XMLObj.java
src/java/org/apache/fop/fo/pagination
RepeatablePageMasterReference.java
SinglePageMasterReference.java
Removed: src/java/org/apache/fop/fo/pagination
PageMasterReference.java
Log:
1.) Removed PageMasterReference.java, no longer needed.
2.) Added validateChildNode() to XMLOBJ.java to check that
the parent of an XSL FO is itself an XSL FO.
Revision Changes Path
1.16 +11 -1 xml-fop/src/java/org/apache/fop/fo/XMLObj.java
Index: XMLObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/XMLObj.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- XMLObj.java 4 Aug 2004 22:21:02 -0000 1.15
+++ XMLObj.java 27 Aug 2004 05:36:43 -0000 1.16
@@ -48,11 +48,21 @@
protected String name;
/**
- *
* @param parent the parent formatting object
*/
public XMLObj(FONode parent) {
super(parent);
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * here, blocks XSL FO's from having non-FO parents.
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ if (nsURI == FO_URI) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
/**
1.17 +27 -12
xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
Index: RepeatablePageMasterReference.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- RepeatablePageMasterReference.java 25 Aug 2004 05:03:06 -0000 1.16
+++ RepeatablePageMasterReference.java 27 Aug 2004 05:36:43 -0000 1.17
@@ -25,18 +25,19 @@
// FOP
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
/**
* A repeatable-page-master-reference formatting object.
* This handles a reference with a specified number of repeating
* instances of the referenced page master (may have no limit).
*/
-public class RepeatablePageMasterReference extends PageMasterReference {
+public class RepeatablePageMasterReference extends FObj
+ implements SubSequenceSpecifier {
private static final int INFINITE = -1;
private PageSequenceMaster pageSequenceMaster;
-
private int maximumRepeats;
private int numberConsumed = 0;
@@ -48,20 +49,22 @@
}
/**
- * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
- * XSL Content Model: empty
- */
- protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
- invalidChildError(loc, nsURI, localName);
- }
-
- /**
* @see org.apache.fop.fo.FObj#addProperties
+ * @todo need to
*/
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
+
+ PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
+
+ if (getPropString(PR_MASTER_REFERENCE) == null) {
+ missingPropertyError("master-reference");
+ } else {
+ pageSequenceMaster.addSubsequenceSpecifier(this);
+ }
+
String mr = getPropString(PR_MAXIMUM_REPEATS);
+
if (mr.equals("no-limit")) {
this.maximumRepeats = INFINITE;
} else {
@@ -80,6 +83,15 @@
}
/**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: empty
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ invalidChildError(loc, nsURI, localName);
+ }
+
+ /**
* @see org.apache.fop.fo.pagination.SubSequenceSpecifier
*/
public String getNextPageMasterName(boolean isOddPage,
@@ -92,7 +104,7 @@
return null;
}
}
- return getMasterName();
+ return getPropString(PR_MASTER_REFERENCE);
}
/**
@@ -102,6 +114,9 @@
this.numberConsumed = 0;
}
+ /**
+ * @see org.apache.fop.fo.FObj#getName()
+ */
public String getName() {
return "fo:repeatable-page-master-reference";
}
1.13 +18 -2
xml-fop/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
Index: SinglePageMasterReference.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SinglePageMasterReference.java 25 Aug 2004 05:03:06 -0000 1.12
+++ SinglePageMasterReference.java 27 Aug 2004 05:36:43 -0000 1.13
@@ -25,13 +25,15 @@
// FOP
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
/**
* A single-page-master-reference formatting object.
* This is a reference for a single page. It returns the
* master name only once until reset.
*/
-public class SinglePageMasterReference extends PageMasterReference {
+public class SinglePageMasterReference extends FObj
+ implements SubSequenceSpecifier {
private static final int FIRST = 0;
private static final int DONE = 1;
@@ -47,6 +49,20 @@
}
/**
+ * @see org.apache.fop.fo.FObj#addProperties
+ */
+ protected void addProperties(Attributes attlist) throws SAXParseException {
+ super.addProperties(attlist);
+
+ PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
+ if (getPropString(PR_MASTER_REFERENCE) == null) {
+ missingPropertyError("master-reference");
+ } else {
+ pageSequenceMaster.addSubsequenceSpecifier(this);
+ }
+ }
+
+ /**
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
* XSL Content Model: empty
*/
@@ -63,7 +79,7 @@
boolean isEmptyPage) {
if (this.state == FIRST) {
this.state = DONE;
- return getMasterName();
+ return getPropString(PR_MASTER_REFERENCE);
} else {
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]