From 8f3f8d05fc2ba1404a63d0bcf94959e34221e981 Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Fri, 2 May 2008 16:58:26 +0000 Subject: Cleanup/Correction after r657673 -> added missing file FObj.java -> pushed retrieve-class-name upwards to AbstractRetrieveMarker as a common property -> corrected use of property-name "retrieve-class-name" in source and testcase -> improved consistency in code-style git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@652821 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FObj.java | 49 ++++++++++---------- .../apache/fop/fo/flow/AbstractRetrieveMarker.java | 34 ++++++++++++-- .../org/apache/fop/fo/flow/RetrieveMarker.java | 53 ++++++++-------------- .../apache/fop/fo/flow/RetrieveTableMarker.java | 18 ++++---- 4 files changed, 80 insertions(+), 74 deletions(-) (limited to 'src/java/org/apache') diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index a2b09640b..79b04c4d7 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -427,12 +427,12 @@ public abstract class FObj extends FONode implements Constants { */ protected boolean isBlockItem(String nsURI, String lName) { return (FO_URI.equals(nsURI) - && (lName.equals("block") - || lName.equals("table") - || lName.equals("table-and-caption") - || lName.equals("block-container") - || lName.equals("list-block") - || lName.equals("float") + && ("block".equals(lName) + || "table".equals(lName) + || "table-and-caption".equals(lName) + || "block-container".equals(lName) + || "list-block".equals(lName) + || "float".equals(lName) || isNeutralItem(nsURI, lName))); } @@ -446,21 +446,21 @@ public abstract class FObj extends FONode implements Constants { */ protected boolean isInlineItem(String nsURI, String lName) { return (FO_URI.equals(nsURI) - && (lName.equals("bidi-override") - || lName.equals("character") - || lName.equals("external-graphic") - || lName.equals("instream-foreign-object") - || lName.equals("inline") - || lName.equals("inline-container") - || lName.equals("leader") - || lName.equals("page-number") - || lName.equals("page-number-citation") - || lName.equals("page-number-citation-last") - || lName.equals("basic-link") - || (lName.equals("multi-toggle") + && ("bidi-override".equals(lName) + || "character".equals(lName) + || "external-graphic".equals(lName) + || "instream-foreign-object".equals(lName) + || "inline".equals(lName) + || "inline-container".equals(lName) + || "leader".equals(lName) + || "page-number".equals(lName) + || "page-number-citation".equals(lName) + || "page-number-citation-last".equals(lName) + || "basic-link".equals(lName) + || ("multi-toggle".equals(lName) && (getNameId() == FO_MULTI_CASE || findAncestor(FO_MULTI_CASE) > 0)) - || (lName.equals("footnote") + || ("footnote".equals(lName) && !isOutOfLineFODescendant) || isNeutralItem(nsURI, lName))); } @@ -487,11 +487,12 @@ public abstract class FObj extends FONode implements Constants { */ boolean isNeutralItem(String nsURI, String lName) { return (FO_URI.equals(nsURI) - && (lName.equals("multi-switch") - || lName.equals("multi-properties") - || lName.equals("wrapper") - || (!isOutOfLineFODescendant && lName.equals("float")) - || lName.equals("retrieve-marker"))); + && ("multi-switch".equals(lName) + || "multi-properties".equals(lName) + || "wrapper".equals(lName) + || (!isOutOfLineFODescendant && "float".equals(lName)) + || "retrieve-marker".equals(lName) + || "retrieve-table-marker".equals(lName))); } /** diff --git a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java b/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java index 334f98e2f..9e4585d32 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java @@ -18,14 +18,11 @@ /* $Id$ */ package org.apache.fop.fo.flow; -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FOText; -import org.apache.fop.fo.FObj; -import org.apache.fop.fo.FObjMixed; -import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.*; import org.apache.fop.fo.flow.table.TableFObj; import org.apache.fop.fo.flow.table.Table; import org.apache.fop.apps.FOPException; +import org.xml.sax.Locator; import java.util.Iterator; @@ -40,6 +37,8 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { private PropertyList propertyList; + private String retrieveClassName; + /** * Create a new AbstractRetrieveMarker instance that * is a child of the given {@link FONode} @@ -50,6 +49,17 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { super(parent); } + /** + * {@inheritDoc} + *

XSL Content Model: empty + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws ValidationException { + if (FO_URI.equals(nsURI)) { + invalidChildError(loc, nsURI, localName); + } + } + /** * {@inheritDoc} * Store a reference to the parent {@link PropertyList} @@ -57,6 +67,10 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { */ public void bind(PropertyList pList) throws FOPException { super.bind(pList); + this.retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString(); + if (retrieveClassName == null || retrieveClassName.equals("")) { + missingPropertyError("retrieve-class-name"); + } this.propertyList = pList.getParentPropertyList(); } @@ -169,4 +183,14 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { } } + /** + * Return the value for the retrieve-class-name + * property + * + * @return the value for retrieve-class-name + */ + public String getRetrieveClassName() { + return this.retrieveClassName; + } + } diff --git a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java index b75e14664..c696d3d14 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveMarker.java @@ -19,12 +19,9 @@ package org.apache.fop.fo.flow; -import java.util.Iterator; - import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.ValidationException; import org.xml.sax.Locator; import org.xml.sax.Attributes; @@ -37,7 +34,6 @@ import org.xml.sax.Attributes; public class RetrieveMarker extends AbstractRetrieveMarker { // The value of properties relevant for fo:retrieve-marker. - private String retrieveClassName; private int retrievePosition; private int retrieveBoundary; // End of property values @@ -46,7 +42,7 @@ public class RetrieveMarker extends AbstractRetrieveMarker { * Create a new RetrieveMarker instance that is a * child of the given {@link FONode}. * - * @param parent {@link FONode} that is the parent of this object + * @param parent the parent {@link FONode} */ public RetrieveMarker(FONode parent) { super(parent); @@ -72,47 +68,34 @@ public class RetrieveMarker extends AbstractRetrieveMarker { /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { - - retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString(); - retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum(); - retrieveBoundary = pList.get(PR_RETRIEVE_BOUNDARY).getEnum(); - - if (retrieveClassName == null || retrieveClassName.equals("")) { - missingPropertyError("retrieve-class-name"); - } super.bind(pList); + this.retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum(); + this.retrieveBoundary = pList.get(PR_RETRIEVE_BOUNDARY).getEnum(); } /** - * {@inheritDoc} - * XSL Content Model: empty - */ - protected void validateChildNode(Locator loc, String nsURI, String localName) - throws ValidationException { - if (FO_URI.equals(nsURI)) { - invalidChildError(loc, nsURI, localName); - } - } - - /** - * @return the "retrieve-class-name" property. - */ - public String getRetrieveClassName() { - return retrieveClassName; - } - - /** - * @return the "retrieve-position" property (enum value). + * Return the value for the retrieve-position + * property + * @return the value for retrieve-position-within-table; one of + * {@link org.apache.fop.fo.Constants#EN_FSWP}, + * {@link org.apache.fop.fo.Constants#EN_FIC}, + * {@link org.apache.fop.fo.Constants#EN_LSWP}, + * {@link org.apache.fop.fo.Constants#EN_LEWP}. */ public int getRetrievePosition() { - return retrievePosition; + return this.retrievePosition; } /** - * @return the "retrieve-boundary" property (enum value). + * Return the value for the retrieve-boundary + * property + * @return the value for retrieve-boundary-within-table; one of + * {@link org.apache.fop.fo.Constants#EN_PAGE}, + * {@link org.apache.fop.fo.Constants#EN_PAGE_SEQUENCE}, + * {@link org.apache.fop.fo.Constants#EN_DOCUMENT}. */ public int getRetrieveBoundary() { - return retrieveBoundary; + return this.retrieveBoundary; } /** {@inheritDoc} */ diff --git a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java index 4a7b8af0d..9d04e308d 100644 --- a/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java +++ b/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java @@ -15,7 +15,7 @@ * limitations under the License. */ -/* $Id:$ */ +/* $Id$ */ package org.apache.fop.fo.flow; import org.apache.fop.fo.FONode; @@ -30,8 +30,7 @@ import org.xml.sax.Attributes; */ public class RetrieveTableMarker extends AbstractRetrieveMarker { - // The value of properties relevant for fo:retrieve-marker. - private String retrieveClassName; + // The value of properties relevant for fo:retrieve-table-marker. private int retrievePositionWithinTable; private int retrieveBoundaryWithinTable; // end property values @@ -46,7 +45,11 @@ public class RetrieveTableMarker extends AbstractRetrieveMarker { super(parent); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + * NOTE: An fo:retrieve-table-marker is only permitted as a descendant + * of an fo:table-header or an fo:table-footer. + */ public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException { if (findAncestor(FO_TABLE_HEADER) < 0 && findAncestor(FO_TABLE_FOOTER) < 0) { @@ -59,18 +62,13 @@ public class RetrieveTableMarker extends AbstractRetrieveMarker { /** {@inheritDoc} */ public void bind(PropertyList pList) throws FOPException { - this.retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString(); + super.bind(pList); this.retrievePositionWithinTable = pList.get(PR_RETRIEVE_POSITION_WITHIN_TABLE).getEnum(); this.retrieveBoundaryWithinTable = pList.get(PR_RETRIEVE_BOUNDARY_WITHIN_TABLE).getEnum(); } - /** {@inheritDoc} */ - public String getRetrieveClassName() { - return this.retrieveClassName; - } - /** * Return the value for the retrieve-position-within-table * property -- cgit v1.2.3