diff options
author | Glen Mazza <gmazza@apache.org> | 2004-08-21 19:48:00 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2004-08-21 19:48:00 +0000 |
commit | 0dfca20664f84b449ad7ae33db1e9bcd3d709bb2 (patch) | |
tree | f34a69397b41712a559e622cbf2c27e9c4a093bf /src/java/org/apache/fop/fo | |
parent | 9729fe17d699d1d3816054dfb722369aba187d54 (diff) | |
download | xmlgraphics-fop-0dfca20664f84b449ad7ae33db1e9bcd3d709bb2.tar.gz xmlgraphics-fop-0dfca20664f84b449ad7ae33db1e9bcd3d709bb2.zip |
1.) validateChildNode() implemented for fo:multi-properties.
2.) fo:multi-properties disconnected from ToBeImplementedElement.
3.) increased usage of FObj.getPropString() throughout application.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197885 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo')
9 files changed, 66 insertions, 17 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Character.java b/src/java/org/apache/fop/fo/flow/Character.java index 32f9206cd..8ec5fdeed 100644 --- a/src/java/org/apache/fop/fo/flow/Character.java +++ b/src/java/org/apache/fop/fo/flow/Character.java @@ -83,7 +83,7 @@ public class Character extends FObj { * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { - String str = getProperty(PR_CHARACTER).getString(); + String str = getPropString(PR_CHARACTER); if (str.length() == 1) { CharacterLayoutManager lm = new CharacterLayoutManager(this); list.add(lm); diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index fd449e946..fac67bf5a 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -37,7 +37,6 @@ import org.apache.fop.layoutmgr.ExternalGraphicLayoutManager; * inline area that can be added to the area tree. */ public class ExternalGraphic extends FObj { - private String url; /** * Create a new External graphic node. @@ -63,19 +62,14 @@ public class ExternalGraphic extends FObj { */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - url = this.propertyList.get(PR_SRC).getString(); getFOInputHandler().image(this); } - public String getURL() { - return url; - } - /** * @see org.apache.fop.fo.FObj#addLayoutManager(List) */ public void addLayoutManager(List list) { - if (getURL() != null) { + if (getPropString(PR_SRC) != null) { ExternalGraphicLayoutManager lm = new ExternalGraphicLayoutManager(this); list.add(lm); } diff --git a/src/java/org/apache/fop/fo/flow/MultiCase.java b/src/java/org/apache/fop/fo/flow/MultiCase.java index 2a5b24e0f..1283d6901 100644 --- a/src/java/org/apache/fop/fo/flow/MultiCase.java +++ b/src/java/org/apache/fop/fo/flow/MultiCase.java @@ -35,6 +35,9 @@ public class MultiCase extends ToBeImplementedElement { super(parent); } + /** + * @see org.apache.fop.fo.FObj#getName() + */ public String getName() { return "fo:multi-case"; } diff --git a/src/java/org/apache/fop/fo/flow/MultiProperties.java b/src/java/org/apache/fop/fo/flow/MultiProperties.java index 130dda6f0..3e95defb7 100644 --- a/src/java/org/apache/fop/fo/flow/MultiProperties.java +++ b/src/java/org/apache/fop/fo/flow/MultiProperties.java @@ -18,23 +18,76 @@ package org.apache.fop.fo.flow; +// XML +import org.xml.sax.Attributes; +import org.xml.sax.Locator; +import org.xml.sax.SAXParseException; + // FOP import org.apache.fop.fo.FONode; -import org.apache.fop.fo.ToBeImplementedElement; +import org.apache.fop.fo.FObj; /** * Class modelling the fo:multi-properties object. See Sec. 6.9.6 of the XSL-FO * Standard. */ -public class MultiProperties extends ToBeImplementedElement { +public class MultiProperties extends FObj { + + static boolean notImplementedWarningGiven = false; + + // used for input FO validation + boolean hasMultiPropertySet = false; + boolean hasWrapper = false; /** * @param parent FONode that is the parent of this object */ public MultiProperties(FONode parent) { super(parent); + + if (!notImplementedWarningGiven) { + getLogger().warn("fo:multi-properties is not yet implemented."); + notImplementedWarningGiven = true; + } + } + + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL Content Model: (multi-property-set+, wrapper) + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws SAXParseException { + if (nsURI == FO_URI && localName.equals("multi-property-set")) { + if (hasWrapper) { + nodesOutOfOrderError(loc, "fo:multi-property-set", "fo:wrapper"); + } else { + hasMultiPropertySet = true; + } + } else if (nsURI == FO_URI && localName.equals("wrapper")) { + if (hasWrapper) { + tooManyNodesError(loc, "fo:wrapper"); + } else { + hasWrapper = true; + } + } else { + invalidChildError(loc, nsURI, localName); + } } + /** + * Make sure content model satisfied, if so then tell the + * FOInputHandler that we are at the end of the flow. + * @see org.apache.fop.fo.FONode#end + */ + protected void endOfNode() throws SAXParseException { + if (!hasMultiPropertySet || !hasWrapper) { + missingChildElementError("(multi-property-set+, wrapper)"); + } + } + + /** + * @see org.apache.fop.fo.FObj#getName() + */ public String getName() { return "fo:multi-properties"; } diff --git a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java index 57bb11d25..ff06b1b02 100644 --- a/src/java/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/java/org/apache/fop/fo/flow/PageNumberCitation.java @@ -81,7 +81,7 @@ public class PageNumberCitation extends FObj { this.blue = c.getBlue(); this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum(); - this.refId = this.propertyList.get(PR_REF_ID).getString(); + this.refId = getPropString(PR_REF_ID); if (this.refId.equals("")) { //throw new FOPException("page-number-citation must contain \"ref-id\""); diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index 041e0cff6..30526a7ac 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -57,8 +57,7 @@ public class RetrieveMarker extends FObjMixed { */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - this.retrieveClassName = - this.propertyList.get(PR_RETRIEVE_CLASS_NAME).getString(); + this.retrieveClassName = getPropString(PR_RETRIEVE_CLASS_NAME); this.retrievePosition = this.propertyList.get(PR_RETRIEVE_POSITION).getEnum(); this.retrieveBoundary = diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java index 5f1631ee3..9fbd12eba 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java @@ -242,7 +242,7 @@ public class PageSequence extends FObj { // we are now on the first page of the page sequence thisIsFirstPage = true; - ipnValue = this.propertyList.get(PR_INITIAL_PAGE_NUMBER).getString(); + ipnValue = getPropString(PR_INITIAL_PAGE_NUMBER); if (ipnValue.equals("auto")) { pageNumberType = AUTO; @@ -261,7 +261,7 @@ public class PageSequence extends FObj { } } - String masterName = this.propertyList.get(PR_MASTER_REFERENCE).getString(); + String masterName = getPropString(PR_MASTER_REFERENCE); this.simplePageMaster = this.layoutMasterSet.getSimplePageMaster(masterName); if (this.simplePageMaster == null) { diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java index 043ca8176..31629edf8 100644 --- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java +++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java @@ -95,7 +95,7 @@ public class PageSequenceMaster extends FObj { subSequenceSpecifiers = new java.util.ArrayList(); if (parent.getName().equals("fo:layout-master-set")) { this.layoutMasterSet = (LayoutMasterSet)parent; - masterName = this.propertyList.get(Constants.PR_MASTER_NAME).getString(); + masterName = getPropString(PR_MASTER_NAME); if (masterName == null) { getLogger().warn("page-sequence-master does not have " + "a master-name and so is being ignored"); diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java index 8f6ae241a..0e6223e54 100644 --- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java +++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java @@ -62,7 +62,7 @@ public class RepeatablePageMasterReference extends PageMasterReference */ protected void addProperties(Attributes attlist) throws SAXParseException { super.addProperties(attlist); - String mr = getProperty(PR_MAXIMUM_REPEATS).getString(); + String mr = getPropString(PR_MAXIMUM_REPEATS); if (mr.equals("no-limit")) { this.maximumRepeats = INFINITE; } else { |