aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorAndreas L. Delmelle <adelmelle@apache.org>2008-04-25 08:59:56 +0000
committerAndreas L. Delmelle <adelmelle@apache.org>2008-04-25 08:59:56 +0000
commita6d5390ee3682016f82a5344f5a20b77596abaf7 (patch)
tree5cccdfc2bdbcb6acea3baab4e490cad8ad6edb9a /src/java/org/apache
parenta33539b1533bd7f1c1a110f9c435d283660de257 (diff)
downloadxmlgraphics-fop-a6d5390ee3682016f82a5344f5a20b77596abaf7.tar.gz
xmlgraphics-fop-a6d5390ee3682016f82a5344f5a20b77596abaf7.zip
Removed TODO: New validation event to generate an error in case an fo:marker appears as a child of an fo:block-container with absolutely positioned areas.
Additionally: some javadoc updates in BlockContainer.java git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@651543 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/events/EventFormatter.xml1
-rw-r--r--src/java/org/apache/fop/fo/FOValidationEventProducer.java9
-rw-r--r--src/java/org/apache/fop/fo/flow/BlockContainer.java87
3 files changed, 45 insertions, 52 deletions
diff --git a/src/java/org/apache/fop/events/EventFormatter.xml b/src/java/org/apache/fop/events/EventFormatter.xml
index f17da1161..f5e4609e9 100644
--- a/src/java/org/apache/fop/events/EventFormatter.xml
+++ b/src/java/org/apache/fop/events/EventFormatter.xml
@@ -33,6 +33,7 @@ Required content model: {contentModel}]{{locator}}</message>
<message key="org.apache.fop.fo.FOValidationEventProducer.missingProperty">Element "{elementName}" is missing required property "{propertyName}"!{{locator}}</message>
<message key="org.apache.fop.fo.FOValidationEventProducer.idNotUnique">Property ID "{id}" (found on "{elementName}") previously used; ID values must be unique within a document!{severity,equals,EventSeverity:FATAL,,
Any reference to it will be considered a reference to the first occurrence in the document.}{{locator}}</message>
+ <message key="org.apache.fop.fo.FOValidationEventProducer.markerBlockContainerAbsolutePosition">Only an fo:block-container that does not generate absolutely positioned areas may have one or more fo:markers as its initial children.{{locator}}</message>
<message key="org.apache.fop.fo.FOValidationEventProducer.markerNotInitialChild">fo:marker must be an initial child: {mcname}{{locator}}</message>
<message key="org.apache.fop.fo.FOValidationEventProducer.markerNotUniqueForSameParent">fo:marker "marker-class-name" must be unique for same parent: {mcname}{{locator}}</message>
<message key="org.apache.fop.fo.FOValidationEventProducer.invalidProperty">Invalid property encountered on "{elementName}": {attr}{{locator}}</message>
diff --git a/src/java/org/apache/fop/fo/FOValidationEventProducer.java b/src/java/org/apache/fop/fo/FOValidationEventProducer.java
index aa7b14941..61bd68340 100644
--- a/src/java/org/apache/fop/fo/FOValidationEventProducer.java
+++ b/src/java/org/apache/fop/fo/FOValidationEventProducer.java
@@ -150,6 +150,15 @@ public interface FOValidationEventProducer extends EventProducer {
Locator loc) throws ValidationException;
/**
+ * An fo:marker appears as initial descendant in an fo:block-container
+ * that generates absolutely positioned areas
+ * @param source the event source
+ * @param loc the location of the error (possibly null)
+ * @event.severity ERROR
+ */
+ void markerBlockContainerAbsolutePosition(Object source, Locator loc);
+
+ /**
* A marker is not an initial child on a node.
* @param source the event source
* @param elementName the name of the context node
diff --git a/src/java/org/apache/fop/fo/flow/BlockContainer.java b/src/java/org/apache/fop/fo/flow/BlockContainer.java
index f1180ac16..5e8957299 100644
--- a/src/java/org/apache/fop/fo/flow/BlockContainer.java
+++ b/src/java/org/apache/fop/fo/flow/BlockContainer.java
@@ -35,7 +35,8 @@ import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
/**
- * Class modelling the fo:block-container object.
+ * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_block-container">
+ * <code>fo:block-container</code></a> object.
*/
public class BlockContainer extends FObj {
// The value of properties relevant for fo:block-container.
@@ -66,15 +67,16 @@ public class BlockContainer extends FObj {
private boolean blockItemFound = false;
/**
- * @param parent FONode that is the parent of this object
+ * Creates a new BlockContainer instance as a child of
+ * the given {@link FONode}.
+ *
+ * @param parent {@link FONode} that is the parent of this object
*/
public BlockContainer(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
commonAbsolutePosition = pList.getAbsolutePositionProps();
@@ -97,9 +99,7 @@ public class BlockContainer extends FObj {
writingMode = pList.get(PR_WRITING_MODE).getEnum();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
getFOEventHandler().startBlockContainer(this);
@@ -107,30 +107,34 @@ public class BlockContainer extends FObj {
/**
* {@inheritDoc}
- * XSL Content Model: marker* (%block;)+
- * But: "In addition an fo:block-container that does not generate an
+ * <br>XSL Content Model: marker* (%block;)+
+ * <br><i><b>BUT</b>: "In addition an fo:block-container that does not generate an
* absolutely positioned area may have a sequence of zero or more
* fo:markers as its initial children."
- * @todo - implement above restriction if possible
+ * The latter refers to block-containers with absolute-position="absolute"
+ * or absolute-position="fixed".
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
if (FO_URI.equals(nsURI)) {
- if (localName.equals("marker")) {
+ if ("marker".equals(localName)) {
+ if (commonAbsolutePosition.absolutePosition == EN_ABSOLUTE
+ || commonAbsolutePosition.absolutePosition == EN_FIXED) {
+ getFOValidationEventProducer()
+ .markerBlockContainerAbsolutePosition(this, locator);
+ }
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
}
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
+ } else if (!isBlockItem(FO_URI, localName)) {
+ invalidChildError(loc, FO_URI, localName);
} else {
blockItemFound = true;
}
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void endOfNode() throws FOPException {
if (!blockItemFound) {
missingChildElementError("marker* (%block;)+");
@@ -139,30 +143,22 @@ public class BlockContainer extends FObj {
getFOEventHandler().endBlockContainer(this);
}
- /**
- * @return true (BlockContainer can generate Reference Areas)
- */
+ /** @return <code>true</code> (BlockContainer can generate Reference Areas) */
public boolean generatesReferenceAreas() {
return true;
}
- /**
- * @return the Common Absolute Position Properties.
- */
+ /** @return the {@link CommonAbsolutePosition} */
public CommonAbsolutePosition getCommonAbsolutePosition() {
return commonAbsolutePosition;
}
- /**
- * @return the Common Margin Properties-Block.
- */
+ /** @return the {@link CommonMarginBlock} */
public CommonMarginBlock getCommonMarginBlock() {
return commonMarginBlock;
}
- /**
- * @return the Common Border, Padding, and Background Properties.
- */
+ /** @return the {@link CommonBorderPaddingBackground} */
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}
@@ -174,7 +170,7 @@ public class BlockContainer extends FObj {
return blockProgressionDimension;
}
- /** @return the display-align property. */
+ /** @return the "display-align" property. */
public int getDisplayAlign() {
return displayAlign;
}
@@ -204,51 +200,37 @@ public class BlockContainer extends FObj {
return keepTogether;
}
- /**
- * @return the "inline-progression-dimension" property.
- */
+ /** @return the "inline-progression-dimension" property */
public LengthRangeProperty getInlineProgressionDimension() {
return inlineProgressionDimension;
}
- /**
- * @return the "overflow" property.
- */
+ /** @return the "overflow" property */
public int getOverflow() {
return overflow;
}
- /**
- * @return the "reference-orientation" property.
- */
+ /** @return the "reference-orientation" property */
public int getReferenceOrientation() {
return referenceOrientation.getValue();
}
- /**
- * @return the "span" property.
- */
+ /** @return the "span" property */
public int getSpan() {
return this.span;
}
- /**
- * @return the "writing-mode" property.
- */
+ /** @return the "writing-mode" property */
public int getWritingMode() {
return writingMode;
}
- /**
- * @return the width property
- */
+ /** @return the "width" property */
public Length getWidth() {
return width;
}
- /**
- * @return the height property
- */
+ /** @return the "height" property */
public Length getHeight() {
return height;
}
@@ -260,6 +242,7 @@ public class BlockContainer extends FObj {
/**
* {@inheritDoc}
+ * @return {@link org.apache.fop.fo.Constants#FO_BLOCK_CONTAINER}
*/
public int getNameId() {
return FO_BLOCK_CONTAINER;