Browse Source

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
tags/fop-1_0
Andreas L. Delmelle 16 years ago
parent
commit
8f3f8d05fc

+ 25
- 24
src/java/org/apache/fop/fo/FObj.java View File

@@ -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)));
}
/**

+ 29
- 5
src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java View File

@@ -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}
* <p>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 <code>retrieve-class-name</code>
* property
*
* @return the value for retrieve-class-name
*/
public String getRetrieveClassName() {
return this.retrieveClassName;
}

}

+ 18
- 35
src/java/org/apache/fop/fo/flow/RetrieveMarker.java View File

@@ -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 <code>retrieve-position</code>
* 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 <code>retrieve-boundary</code>
* 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} */

+ 8
- 10
src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java View File

@@ -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}
* <i>NOTE: An <code>fo:retrieve-table-marker</code> is only permitted as a descendant
* of an <code>fo:table-header</code> or an <code>fo:table-footer</code>.</i>
*/
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 <code>retrieve-position-within-table</code>
* property

+ 2
- 2
test/fotree/testcases/table_retrieve-table-marker.fo View File

@@ -35,8 +35,8 @@
<fo:table-row>
<fo:table-cell number-columns-spanned="2">
<fo:block>
<fo:retrieve-table-marker marker-class-name="mc1">
<test:assert property="marker-class-name" expected="mc1" />
<fo:retrieve-table-marker retrieve-class-name="mc1">
<test:assert property="retrieve-class-name" expected="mc1" />
<test:assert property="retrieve-position-within-table" expected="FIRST_STARTING" />
<test:assert property="retrieve-boundary-within-table" expected="TABLE" />
</fo:retrieve-table-marker>

Loading…
Cancel
Save