You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2008/05/01 23:34:22 UTC
svn commit: r652673 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/events/ src/java/org/apache/fop/fo/
src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/layoutmgr/
test/fotree/testcases/
Author: adelmelle
Date: Thu May 1 14:34:19 2008
New Revision: 652673
URL: http://svn.apache.org/viewvc?rev=652673&view=rev
Log:
First steps towards fo:retrieve-table-marker
Added:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java (with props)
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java (with props)
xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo (with props)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventFormatter.xml
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/Constants.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOElementMapping.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventFormatter.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventFormatter.xml?rev=652673&r1=652672&r2=652673&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventFormatter.xml (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/events/EventFormatter.xml Thu May 1 14:34:19 2008
@@ -19,7 +19,8 @@
<catalogue xml:lang="en">
<message key="locator">[ (See position {loc})| (See {#gatherContextInfo})| (No context info available)]</message>
<message key="rule.markerDescendantOfFlow">An fo:marker is permitted only as the descendant of an fo:flow.</message>
- <message key="rule.retrieveMarkerDescendatOfStaticContent">An fo:retrieve-marker is permitted only as the descendant of an fo:static-content.</message>
+ <message key="rule.retrieveMarkerDescendantOfStaticContent">An fo:retrieve-marker is permitted only as the descendant of an fo:static-content.</message>
+ <message key="rule.retrieveTableMarkerDescendantOfHeaderOrFooter">An fo:retrieve-table-marker is permitted only as the descendant of an fo:table-header or an fo:table-footer.</message>
<message key="rule.bidiOverrideContent">An fo:bidi-override that is a descendant of an fo:leader or of the fo:inline child of an fo:footnote may not have block-level children, unless it has a nearer ancestor that is an fo:inline-container.</message>
<message key="rule.inlineContent">An fo:inline that is a descendant of an fo:leader or fo:footnote may not have block-level children, unless it has a nearer ancestor that is an fo:inline-container.</message>
<message key="rule.childOfSPM">The element must be a child of fo:simple-page-master.</message>
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/Constants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/Constants.java?rev=652673&r1=652672&r2=652673&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/Constants.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/Constants.java Thu May 1 14:34:19 2008
@@ -159,8 +159,10 @@
int FO_PAGE_SEQUENCE_WRAPPER = 60;
/** FO element constant - XSL 1.1 */
int FO_PAGE_NUMBER_CITATION_LAST = 61;
+ /** FO element constant - XSL 1.1 */
+ int FO_RETRIEVE_TABLE_MARKER = 62;
/** Number of FO element constants defined */
- int FRM_OBJ_COUNT = 61;
+ int FRM_OBJ_COUNT = 62;
// Masks
/**
@@ -688,8 +690,12 @@
int PR_X_WIDOW_CONTENT_LIMIT = 252;
/** Property constant - FOP proprietary: limit for orphan content in lists and tables */
int PR_X_ORPHAN_CONTENT_LIMIT = 253;
+ /** Property constant */
+ int PR_RETRIEVE_POSITION_WITHIN_TABLE = 254;
+ /** Property constant */
+ int PR_RETRIEVE_BOUNDARY_WITHIN_TABLE = 255;
/** Number of property constants defined */
- int PROPERTY_COUNT = 253;
+ int PROPERTY_COUNT = 255;
// compound property constants
@@ -1097,6 +1103,16 @@
int EN_REPLACE = 189;
/** Enumeration constant -- for fo:basic-link show-destination */
int EN_NEW = 190;
+ /** Enumeration constant -- for fo:retrieve-table-marker */
+ int EN_FIRST_STARTING = 191;
+ /** Enumeration constant -- for fo:retrieve-table-marker */
+ int EN_LAST_STARTING = 192;
+ /** Enumeration constant -- for fo:retrieve-table-marker */
+ int EN_LAST_ENDING = 193;
+ /** Enumeration constant -- for fo:retrieve-table-marker */
+ int EN_TABLE = 194;
+ /** Enumeration constant -- for fo:retrieve-table-marker */
+ int EN_TABLE_FRAGMENT = 195;
/** Number of enumeration constants defined */
- int ENUM_COUNT = 190;
+ int ENUM_COUNT = 195;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOElementMapping.java?rev=652673&r1=652672&r2=652673&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOElementMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOElementMapping.java Thu May 1 14:34:19 2008
@@ -135,6 +135,7 @@
foObjs.put("wrapper", new WrapperMaker());
foObjs.put("marker", new MarkerMaker());
foObjs.put("retrieve-marker", new RetrieveMarkerMaker());
+ foObjs.put("retrieve-table-marker", new RetrieveTableMarkerMaker());
}
}
@@ -514,4 +515,9 @@
}
}
+ static class RetrieveTableMarkerMaker extends ElementMapping.Maker {
+ public FONode make(FONode parent) {
+ return new org.apache.fop.fo.flow.RetrieveTableMarker(parent);
+ }
+ }
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=652673&r1=652672&r2=652673&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/FOPropertyMapping.java Thu May 1 14:34:19 2008
@@ -2097,6 +2097,25 @@
m.addEnum("document", getEnumProperty(EN_DOCUMENT, "DOCUMENT"));
m.setDefault("page-sequence");
addPropertyMaker("retrieve-boundary", m);
+
+ // retrieve-position-within-table
+ m = new EnumProperty.Maker(PR_RETRIEVE_POSITION_WITHIN_TABLE);
+ m.setInherited(false);
+ m.addEnum("first-starting", getEnumProperty(EN_FIRST_STARTING, "FIRST_STARTING"));
+ m.addEnum("first-including-carryover", getEnumProperty(EN_FIC, "FIC"));
+ m.addEnum("last-starting", getEnumProperty(EN_LAST_STARTING, "LAST_STARTING"));
+ m.addEnum("last-ending", getEnumProperty(EN_LAST_ENDING, "LAST_ENDING"));
+ m.setDefault("first-starting");
+ addPropertyMaker("retrieve-position-within-table", m);
+
+ // retrieve-boundary-within-table
+ m = new EnumProperty.Maker(PR_RETRIEVE_BOUNDARY_WITHIN_TABLE);
+ m.setInherited(false);
+ m.addEnum("table", getEnumProperty(EN_TABLE, "TABLE"));
+ m.addEnum("table-fragment", getEnumProperty(EN_TABLE_FRAGMENT, "TABLE_FRAGMENT"));
+ m.addEnum("page", getEnumProperty(EN_DOCUMENT, "PAGE"));
+ m.setDefault("table");
+ addPropertyMaker("retrieve-boundary-within-table", m);
}
private void createNumberToStringProperties() {
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java?rev=652673&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java Thu May 1 14:34:19 2008
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id:$ */
+package org.apache.fop.fo.flow;
+
+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 java.util.Iterator;
+
+/**
+ * Abstract base class for the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-marker">
+ * <code>fo:retrieve-marker</code></a> and
+ * <a href="http://www.w3.org/TR/xsl/#fo_retrieve-table-marker">
+ * <code>fo:retrieve-table-marker</code></a> formatting objects.
+
+ */
+public abstract class AbstractRetrieveMarker extends FObjMixed {
+
+ private PropertyList propertyList;
+
+ /**
+ * Create a new AbstractRetrieveMarker instance that
+ * is a child of the given {@link FONode}
+ *
+ * @param parent the parent {@link FONode}
+ */
+ public AbstractRetrieveMarker(FONode parent) {
+ super(parent);
+ }
+
+ /**
+ * {@inheritDoc}
+ * Store a reference to the parent {@link PropertyList}
+ * to be used when the retrieve-marker is resolved.
+ */
+ public void bind(PropertyList pList) throws FOPException {
+ super.bind(pList);
+ this.propertyList = pList.getParentPropertyList();
+ }
+
+ private PropertyList createPropertyListFor(FObj fo, PropertyList parent) {
+ return getFOEventHandler().getPropertyListMaker().make(fo, parent);
+ }
+
+ private void cloneSingleNode(FONode child, FONode newParent,
+ Marker marker, PropertyList parentPropertyList)
+ throws FOPException {
+
+ if (child != null) {
+ FONode newChild = child.clone(newParent, true);
+ if (child instanceof FObj) {
+ Marker.MarkerPropertyList pList;
+ PropertyList newPropertyList = createPropertyListFor(
+ (FObj) newChild, parentPropertyList);
+
+ pList = marker.getPropertyListFor(child);
+ newChild.processNode(
+ child.getLocalName(),
+ getLocator(),
+ pList,
+ newPropertyList);
+ if (newChild instanceof TableFObj) {
+ // TODO calling startOfNode (and endOfNode, below) on other fobjs may
+ // have undesirable side-effects. This is really ugly and will need to
+ // be addressed sooner or later
+ ((TableFObj) newChild).startOfNode();
+ }
+ addChildTo(newChild, (FObj) newParent);
+ if (newChild.getNameId() == FO_TABLE) {
+ Table t = (Table) child;
+ cloneSubtree(t.getColumns().listIterator(),
+ newChild, marker, newPropertyList);
+ cloneSingleNode(t.getTableHeader(),
+ newChild, marker, newPropertyList);
+ cloneSingleNode(t.getTableFooter(),
+ newChild, marker, newPropertyList);
+ }
+ cloneSubtree(child.getChildNodes(), newChild,
+ marker, newPropertyList);
+ if (newChild instanceof TableFObj) {
+ // TODO this is ugly
+ ((TableFObj) newChild).endOfNode();
+ }
+ } else if (child instanceof FOText) {
+ FOText ft = (FOText) newChild;
+ ft.bind(parentPropertyList);
+ addChildTo(newChild, (FObj) newParent);
+ }
+ if (newChild instanceof FObjMixed) {
+ handleWhiteSpaceFor((FObjMixed) newChild);
+ }
+ }
+ }
+
+ /**
+ * Clone the FO nodes in the parent iterator,
+ * attach the new nodes to the new parent,
+ * and map the new nodes to the existing property lists.
+ * FOText nodes are also in the new map, with a null value.
+ * Clone the subtree by a recursive call to this method.
+ * @param parentIter the iterator over the children of the old parent
+ * @param newParent the new parent for the cloned nodes
+ * @param marker the marker that contains the old property list mapping
+ * @param parentPropertyList the parent PropertyList
+ * @throws FOPException in case there was an error
+ */
+ private void cloneSubtree(Iterator parentIter, FONode newParent,
+ Marker marker, PropertyList parentPropertyList)
+ throws FOPException {
+ if (parentIter != null) {
+ FONode child;
+ while (parentIter.hasNext()) {
+ child = (FONode) parentIter.next();
+ cloneSingleNode(child, newParent,
+ marker, parentPropertyList);
+ }
+ }
+ }
+
+ private void cloneFromMarker(Marker marker)
+ throws FOPException {
+ // clean up remnants from a possible earlier layout
+ if (firstChild != null) {
+ currentTextNode = null;
+ firstChild = null;
+ }
+ cloneSubtree(marker.getChildNodes(), this,
+ marker, propertyList);
+ handleWhiteSpaceFor(this);
+ }
+
+ /**
+ * Clone the subtree of the given marker
+ *
+ * @param marker the marker that is to be cloned
+ */
+ public void bindMarker(Marker marker) {
+ if (marker.getChildNodes() != null) {
+ try {
+ cloneFromMarker(marker);
+ } catch (FOPException exc) {
+ getFOValidationEventProducer().markerCloningFailed(this,
+ marker.getMarkerClassName(), exc, getLocator());
+ }
+ } else if (log.isDebugEnabled()) {
+ log.debug("Empty marker retrieved...");
+ }
+ }
+
+}
Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java?rev=652673&r1=652672&r2=652673&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Thu May 1 14:34:19 2008
@@ -23,29 +23,25 @@
import org.apache.fop.apps.FOPException;
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.ValidationException;
-import org.apache.fop.fo.flow.table.Table;
-import org.apache.fop.fo.flow.table.TableFObj;
import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
/**
- * Class modelling the fo:retrieve-marker object.
+ * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-marker">
+ * <code>fo:retrieve-marker</code></a> formatting object.
* This will create a layout manager that will retrieve
* a marker based on the information.
*/
-public class RetrieveMarker extends FObjMixed {
+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
- private PropertyList propertyList;
-
/**
* Create a new RetrieveMarker instance that is a
* child of the given {@link FONode}.
@@ -56,12 +52,26 @@
super(parent);
}
- /** {@inheritDoc} */
- public void bind(PropertyList pList) throws FOPException {
+ /**
+ * {@inheritDoc}
+ * <i>NOTE: An <code>fo:retrieve-marker</code> is only permitted as a descendant
+ * of an <code>fo:static-content</code>.</i>
+ */
+ public void processNode(String elementName,
+ Locator locator,
+ Attributes attlist,
+ PropertyList pList)
+ throws FOPException {
if (findAncestor(FO_STATIC_CONTENT) < 0) {
invalidChildError(locator, getParent().getName(), FO_URI, getName(),
- "rule.retrieveMarkerDescendatOfStaticContent");
+ "rule.retrieveMarkerDescendantOfStaticContent");
+ } else {
+ super.processNode(elementName, locator, attlist, pList);
}
+ }
+
+ /** {@inheritDoc} */
+ public void bind(PropertyList pList) throws FOPException {
retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString();
retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum();
@@ -70,8 +80,6 @@
if (retrieveClassName == null || retrieveClassName.equals("")) {
missingPropertyError("retrieve-class-name");
}
-
- propertyList = pList.getParentPropertyList();
super.bind(pList);
}
@@ -107,115 +115,6 @@
return retrieveBoundary;
}
- private PropertyList createPropertyListFor(FObj fo, PropertyList parent) {
- return getFOEventHandler().getPropertyListMaker().make(fo, parent);
- }
-
- private void cloneSingleNode(FONode child, FONode newParent,
- Marker marker, PropertyList parentPropertyList)
- throws FOPException {
-
- if (child != null) {
- FONode newChild = child.clone(newParent, true);
- if (child instanceof FObj) {
- Marker.MarkerPropertyList pList;
- PropertyList newPropertyList = createPropertyListFor(
- (FObj) newChild, parentPropertyList);
-
- pList = marker.getPropertyListFor(child);
- newChild.processNode(
- child.getLocalName(),
- getLocator(),
- pList,
- newPropertyList);
- if (newChild instanceof TableFObj) {
- // TODO calling startOfNode (and endOfNode, below) on other fobjs may
- // have undesirable side-effects. This is really ugly and will need to
- // be addressed sooner or later
- ((TableFObj) newChild).startOfNode();
- }
- addChildTo(newChild, (FObj) newParent);
- if (newChild.getNameId() == FO_TABLE) {
- Table t = (Table) child;
- cloneSubtree(t.getColumns().listIterator(),
- newChild, marker, newPropertyList);
- cloneSingleNode(t.getTableHeader(),
- newChild, marker, newPropertyList);
- cloneSingleNode(t.getTableFooter(),
- newChild, marker, newPropertyList);
- }
- cloneSubtree(child.getChildNodes(), newChild,
- marker, newPropertyList);
- if (newChild instanceof TableFObj) {
- // TODO this is ugly
- ((TableFObj) newChild).endOfNode();
- }
- } else if (child instanceof FOText) {
- FOText ft = (FOText) newChild;
- ft.bind(parentPropertyList);
- addChildTo(newChild, (FObj) newParent);
- }
- if (newChild instanceof FObjMixed) {
- handleWhiteSpaceFor((FObjMixed) newChild);
- }
- }
- }
-
- /**
- * Clone the FO nodes in the parent iterator,
- * attach the new nodes to the new parent,
- * and map the new nodes to the existing property lists.
- * FOText nodes are also in the new map, with a null value.
- * Clone the subtree by a recursive call to this method.
- * @param parentIter the iterator over the children of the old parent
- * @param newParent the new parent for the cloned nodes
- * @param marker the marker that contains the old property list mapping
- * @param descPLists the map of the new nodes to property lists
- */
- private void cloneSubtree(Iterator parentIter, FONode newParent,
- Marker marker, PropertyList parentPropertyList)
- throws FOPException {
- if (parentIter != null) {
- FONode child;
- while (parentIter.hasNext()) {
- child = (FONode) parentIter.next();
- cloneSingleNode(child, newParent,
- marker, parentPropertyList);
- }
- }
- }
-
- private void cloneFromMarker(Marker marker)
- throws FOPException {
- // clean up remnants from a possible earlier layout
- if (firstChild != null) {
- currentTextNode = null;
- firstChild = null;
- }
- cloneSubtree(marker.getChildNodes(), this,
- marker, propertyList);
- handleWhiteSpaceFor(this);
- }
-
- /**
- * Clone the subtree of the given marker
- *
- * @param marker the marker that is to be cloned
- */
- public void bindMarker(Marker marker) {
- if (marker.getChildNodes() != null) {
- try {
- cloneFromMarker(marker);
- } catch (FOPException exc) {
- getFOValidationEventProducer().markerCloningFailed(this,
- marker.getMarkerClassName(), exc, getLocator());
- return;
- }
- } else if (log.isDebugEnabled()) {
- log.debug("Empty marker retrieved...");
- }
- }
-
/** {@inheritDoc} */
public String getLocalName() {
return "retrieve-marker";
Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java?rev=652673&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java Thu May 1 14:34:19 2008
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id:$ */
+package org.apache.fop.fo.flow;
+
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.apps.FOPException;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+
+/**
+ * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-table-marker">
+ * <code>fo:retrieve-table-marker</code></a> formatting object.
+ */
+public class RetrieveTableMarker extends AbstractRetrieveMarker {
+
+ // The value of properties relevant for fo:retrieve-marker.
+ private String retrieveClassName;
+ private int retrievePositionWithinTable;
+ private int retrieveBoundaryWithinTable;
+ // end property values
+
+ /**
+ * Create a new RetrieveTableMarker instance that is
+ * a child of the given {@link FONode}.
+ *
+ * @param parent the parent {@link FONode}
+ */
+ public RetrieveTableMarker(FONode parent) {
+ super(parent);
+ }
+
+ /** {@inheritDoc} */
+ public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException {
+ if (findAncestor(FO_TABLE_HEADER) < 0
+ && findAncestor(FO_TABLE_FOOTER) < 0) {
+ invalidChildError(locator, getParent().getName(), FO_URI, getName(),
+ "rule.retrieveTableMarkerDescendantOfHeaderOrFooter");
+ } else {
+ super.processNode(elementName, locator, attlist, pList);
+ }
+ }
+
+ /** {@inheritDoc} */
+ public void bind(PropertyList pList) throws FOPException {
+ this.retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString();
+ 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
+ * @return the value for retrieve-position-within-table; one of
+ * {@link org.apache.fop.fo.Constants#EN_FIRST_STARTING},
+ * {@link org.apache.fop.fo.Constants#EN_FIC},
+ * {@link org.apache.fop.fo.Constants#EN_LAST_STARTING},
+ * {@link org.apache.fop.fo.Constants#EN_LAST_ENDING}.
+ */
+ public int getRetrievePositionWithinTable() {
+ return this.retrievePositionWithinTable;
+ }
+
+ /**
+ * Return the value for the <code>retrieve-boundary-within-table</code>
+ * property
+ * @return the value for retrieve-boundary-within-table; one of
+ * {@link org.apache.fop.fo.Constants#EN_TABLE},
+ * {@link org.apache.fop.fo.Constants#EN_TABLE_FRAGMENT},
+ * {@link org.apache.fop.fo.Constants#EN_PAGE}.
+ */
+ public int getRetrieveBoundaryWithinTable() {
+ return this.retrieveBoundaryWithinTable;
+ }
+
+ /** {@inheritDoc} */
+ public String getLocalName() {
+ return "retrieve-table-marker";
+ }
+
+ /**
+ * {@inheritDoc}
+ * @return {@link org.apache.fop.fo.Constants#FO_RETRIEVE_TABLE_MARKER}
+ */
+ public int getNameId() {
+ return FO_RETRIEVE_TABLE_MARKER;
+ }
+}
Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java?rev=652673&r1=652672&r2=652673&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/LayoutManagerMapping.java Thu May 1 14:34:19 2008
@@ -51,6 +51,7 @@
import org.apache.fop.fo.flow.PageNumberCitation;
import org.apache.fop.fo.flow.PageNumberCitationLast;
import org.apache.fop.fo.flow.RetrieveMarker;
+import org.apache.fop.fo.flow.RetrieveTableMarker;
import org.apache.fop.fo.flow.Wrapper;
import org.apache.fop.fo.flow.table.Table;
import org.apache.fop.fo.flow.table.TableBody;
@@ -117,6 +118,7 @@
makers.put(Block.class, new BlockLayoutManagerMaker());
makers.put(Leader.class, new LeaderLayoutManagerMaker());
makers.put(RetrieveMarker.class, new RetrieveMarkerLayoutManagerMaker());
+ makers.put(RetrieveTableMarker.class, new Maker());
makers.put(Character.class, new CharacterLayoutManagerMaker());
makers.put(ExternalGraphic.class,
new ExternalGraphicLayoutManagerMaker());
@@ -207,9 +209,7 @@
return new StaticContentLayoutManager(pslm, sc, reg);
}
- /*
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public StaticContentLayoutManager makeStaticContentLayoutManager(
PageSequenceLayoutManager pslm, StaticContent sc, org.apache.fop.area.Block block) {
return new StaticContentLayoutManager(pslm, sc, block);
@@ -218,7 +218,6 @@
public static class Maker {
public void make(FONode node, List lms) {
// no layout manager
- return;
}
}
@@ -231,18 +230,6 @@
}
}
- /*
- public static class FObjMixedLayoutManagerMaker extends Maker {
- public void make(FONode node, List lms) {
- if (node.getChildNodes() != null) {
- InlineStackingLayoutManager lm;
- lm = new InlineStackingLayoutManager((FObjMixed) node);
- lms.add(lm);
- }
- }
- }
- */
-
public static class BidiOverrideLayoutManagerMaker extends Maker {
// public static class BidiOverrideLayoutManagerMaker extends FObjMixedLayoutManagerMaker {
public void make(BidiOverride node, List lms) {
Added: xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo?rev=652673&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo (added)
+++ xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo Thu May 1 14:34:19 2008
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<!-- This test checks the processing of the initial values for properties on
+ fo:table-retrieve-marker -->
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:test="http://xmlgraphics.apache.org/fop/test">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="A4">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table table-layout="fixed" border-collapse="separate" border-spacing="5pt 2pt">
+ <test:assert property="border-separation.inline-progression-direction" expected="5000mpt"/>
+ <test:assert property="border-separation.block-progression-direction" expected="2000mpt"/>
+ <fo:table-column column-width="160pt"/>
+ <fo:table-column column-width="160pt"/>
+ <fo:table-header>
+ <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" />
+ <test:assert property="retrieve-position-within-table" expected="FIRST_STARTING" />
+ <test:assert property="retrieve-boundary-within-table" expected="TABLE" />
+ </fo:retrieve-table-marker>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-header>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell border="solid 5pt black">
+ <fo:block>cell2</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ <fo:table-row>
+ <fo:table-cell border="solid 5pt">
+ <fo:block>cell3</fo:block>
+ </fo:table-cell>
+ <fo:table-cell height="20pt" border="solid 10pt red">
+ <fo:block>cell4</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>
Propchange: xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/trunk/test/fotree/testcases/table_retrieve-table-marker.fo
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org
Re: svn commit: r652673 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/events/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/layoutmgr/ test/fotree/testcases/
Posted by Andreas Delmelle <an...@telenet.be>.
On May 2, 2008, at 18:47, Adrian Cumiskey wrote:
> I'm guessing by "flaws and dirt" you are referring to the broken
> junit test in FOTreeTestSuite due to fo:retrieve-table-marker being
> a child of fo:block in test/fotree/testcases/table_retrieve-table-
> marker.fo.
Indeed. The reason is I forgot to commit a small change to FObj to
recognize the retrieve-table-marker as a 'neutral' item.
Other flaws include the use of marker-class-name, where the actual
property is retrieve-class-name... :/
Anyway, should be corrected after r652821.
>
> Spec states: "An fo:retrieve-table-marker is only permitted as the
> descendant of an fo:table-header or fo:table-footer or as a child
> of fo:table in a position where fo:table-header or fo:table-footer
> is permitted."
Currently, only the latter part is not yet implemented. The
implementation will cause an error if you use a fo:retrieve-table-
marker outside of fo:table-header or fo:table-footer.
>
> It seems FOP is enforcing this. Would be good if you could fix
> this as I am ready to commit some of my own work to trunk but
> ideally would like to have a clean junit run before doing so.
Should be possible now.
Cheers
Andreas
Re: svn commit: r652673 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/events/
src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/layoutmgr/
test/fotree/testcases/
Posted by Adrian Cumiskey <ad...@gmail.com>.
Hi Andreas,
I'm guessing by "flaws and dirt" you are referring to the broken junit test in FOTreeTestSuite due
to fo:retrieve-table-marker being a child of fo:block in
test/fotree/testcases/table_retrieve-table-marker.fo.
Spec states: "An fo:retrieve-table-marker is only permitted as the descendant of an fo:table-header
or fo:table-footer or as a child of fo:table in a position where fo:table-header or fo:table-footer
is permitted."
It seems FOP is enforcing this. Would be good if you could fix this as I am ready to commit some of
my own work to trunk but ideally would like to have a clean junit run before doing so.
Adrian.
Andreas Delmelle wrote:
> On May 1, 2008, at 23:34, adelmelle@apache.org wrote:
>> Author: adelmelle
>> Date: Thu May 1 14:34:19 2008
>> New Revision: 652673
>>
>> URL: http://svn.apache.org/viewvc?rev=652673&view=rev
>> Log:
>> First steps towards fo:retrieve-table-marker
>>
>
> FWIW: I decided to finally look into this, as I've been noticing
> increasing demands for a port of 0.20.5's table-continuation extension.
>
> I already noticed some flaws and dirt in what I committed earlier;
> cleanup to follow as soon as SVN commit is restored.
>
> After this commit, the node is completely implemented on the fo-tree
> side, but still lacks a backing implementation in the layout engine. It
> does not yet generate any LayoutManagers (see modification to
> LayoutManagerMapping.java)
> In theory, everything is in place for the RetrieveTableMarker to behave
> in exactly the same way as a RetrieveMarker.
>
> Currently, a RetrieveMarker is intercepted and resolved in
> AbstractLayoutManager.createChildLMs().
> I'm not sure yet if this suffices for a RetrieveTableMarker. Probably
> not...
>
> Resolution for regular RetrieveMarkers is ultimately triggered by
> StaticContentLM.getNextKnuthElements(), which in turn is called when
> finishing a page.
> At that point, the areas for the region-body's content will all have
> been added to the page, together with any associated fo:markers.
>
> It seems that, at least for retrieve-position-within-table="page",
> communication/interaction with the PageBreaker/PageSequenceLM is necessary.
>
> Any thoughts?
>
>
> Cheers
>
> Andreas
>
Re: svn commit: r652673 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/events/ src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/flow/ src/java/org/apache/fop/layoutmgr/ test/fotree/testcases/
Posted by Andreas Delmelle <an...@telenet.be>.
On May 1, 2008, at 23:34, adelmelle@apache.org wrote:
> Author: adelmelle
> Date: Thu May 1 14:34:19 2008
> New Revision: 652673
>
> URL: http://svn.apache.org/viewvc?rev=652673&view=rev
> Log:
> First steps towards fo:retrieve-table-marker
>
FWIW: I decided to finally look into this, as I've been noticing
increasing demands for a port of 0.20.5's table-continuation extension.
I already noticed some flaws and dirt in what I committed earlier;
cleanup to follow as soon as SVN commit is restored.
After this commit, the node is completely implemented on the fo-tree
side, but still lacks a backing implementation in the layout engine.
It does not yet generate any LayoutManagers (see modification to
LayoutManagerMapping.java)
In theory, everything is in place for the RetrieveTableMarker to
behave in exactly the same way as a RetrieveMarker.
Currently, a RetrieveMarker is intercepted and resolved in
AbstractLayoutManager.createChildLMs().
I'm not sure yet if this suffices for a RetrieveTableMarker. Probably
not...
Resolution for regular RetrieveMarkers is ultimately triggered by
StaticContentLM.getNextKnuthElements(), which in turn is called when
finishing a page.
At that point, the areas for the region-body's content will all have
been added to the page, together with any associated fo:markers.
It seems that, at least for retrieve-position-within-table="page",
communication/interaction with the PageBreaker/PageSequenceLM is
necessary.
Any thoughts?
Cheers
Andreas