aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/pagination
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination')
-rw-r--r--src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/ColorProfile.java21
-rw-r--r--src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java16
-rw-r--r--src/java/org/apache/fop/fo/pagination/Declarations.java21
-rw-r--r--src/java/org/apache/fop/fo/pagination/Flow.java39
-rw-r--r--src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java63
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequence.java28
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java38
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java19
-rw-r--r--src/java/org/apache/fop/fo/pagination/Region.java29
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionAfter.java14
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBA.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBefore.java15
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBody.java24
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionEnd.java18
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionSE.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionStart.java15
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java43
-rw-r--r--src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java20
-rw-r--r--src/java/org/apache/fop/fo/pagination/Root.java20
-rw-r--r--src/java/org/apache/fop/fo/pagination/SideRegion.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/SimplePageMaster.java130
-rw-r--r--src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java16
-rw-r--r--src/java/org/apache/fop/fo/pagination/StaticContent.java18
-rw-r--r--src/java/org/apache/fop/fo/pagination/Title.java19
-rw-r--r--src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java37
-rw-r--r--src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java17
-rw-r--r--src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java24
29 files changed, 333 insertions, 408 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java
index 70a09b720..578d74c4d 100644
--- a/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java
@@ -32,7 +32,9 @@ import org.apache.fop.fo.PropertyList;
public abstract class AbstractPageSequence extends FObj {
// The value of properties relevant for fo:page-sequence.
+ /** the initial-page-number value */
protected Numeric initialPageNumber;
+ /** the force-page-count value */
protected int forcePageCount;
private String format;
private int letterValue;
@@ -43,6 +45,7 @@ public abstract class AbstractPageSequence extends FObj {
private PageNumberGenerator pageNumberGenerator;
+ /** the first page number generated by the page sequence */
protected int startingPageNumber = 0;
/**
@@ -54,9 +57,7 @@ public abstract class AbstractPageSequence extends FObj {
super(parent);
}
- /**
- * @see org.apache.fop.fo.FObj#bind(PropertyList)
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
initialPageNumber = pList.get(PR_INITIAL_PAGE_NUMBER).getNumeric();
@@ -68,16 +69,14 @@ public abstract class AbstractPageSequence extends FObj {
referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
}
- /**
- * @see org.apache.fop.fo.FONode#startOfNode()
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
this.pageNumberGenerator = new PageNumberGenerator(
format, groupingSeparator, groupingSize, letterValue);
}
- /** @see org.apache.fop.fo.FONode#endOfNode() */
+ /** {@inheritDoc} */
protected void endOfNode() throws FOPException {
}
diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java
index 9318a8896..6067b55c5 100644
--- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java
+++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java
@@ -19,14 +19,14 @@
package org.apache.fop.fo.pagination;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.xml.sax.Locator;
-
/**
* The fo:color-profile formatting object.
* This loads the color profile when needed and resolves a requested color.
@@ -39,15 +39,15 @@ public class ColorProfile extends FObj {
// End of property values
/**
+ * Creates a new color-profile element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public ColorProfile(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
src = pList.get(PR_SRC).getString();
colorProfileName = pList.get(PR_COLOR_PROFILE_NAME).getString();
@@ -59,12 +59,15 @@ public class ColorProfile extends FObj {
XSL 1.0/FOP: EMPTY (no child nodes permitted)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
/**
* Return the "color-profile-name" property.
+ * @return the color-profile-name property
*/
public String getColorProfileName() {
return colorProfileName;
@@ -75,9 +78,7 @@ public class ColorProfile extends FObj {
return "color-profile";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_COLOR_PROFILE;
}
diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
index dfb4ba70b..a13808324 100644
--- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
@@ -45,15 +45,15 @@ public class ConditionalPageMasterReference extends FObj {
// End of property values
/**
+ * Creates a new conditional-page-master-reference element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public ConditionalPageMasterReference(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
pagePosition = pList.get(PR_PAGE_POSITION).getEnum();
@@ -65,9 +65,7 @@ public class ConditionalPageMasterReference extends FObj {
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
getConcreteParent().addConditionalPageMasterReference(this);
}
@@ -81,8 +79,10 @@ public class ConditionalPageMasterReference extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
/**
diff --git a/src/java/org/apache/fop/fo/pagination/Declarations.java b/src/java/org/apache/fop/fo/pagination/Declarations.java
index 9dc282d07..3eec2897a 100644
--- a/src/java/org/apache/fop/fo/pagination/Declarations.java
+++ b/src/java/org/apache/fop/fo/pagination/Declarations.java
@@ -42,6 +42,7 @@ public class Declarations extends FObj {
private Map colorProfiles = null;
/**
+ * Creates a new declarations element.
* @param parent FONode that is the parent of this object
*/
public Declarations(FONode parent) {
@@ -49,9 +50,7 @@ public class Declarations extends FObj {
((Root) parent).setDeclarations(this);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
// No properties defined for fo:declarations
}
@@ -73,6 +72,7 @@ public class Declarations extends FObj {
/**
* At the end of this element sort out the children into
* a hashmap of color profiles and a list of extension attachments.
+ * @throws FOPException if there's a problem during processing
*/
protected void endOfNode() throws FOPException {
if (firstChild != null) {
@@ -83,7 +83,8 @@ public class Declarations extends FObj {
if (!"".equals(cp.getColorProfileName())) {
addColorProfile(cp);
} else {
- log.warn("color-profile-name required for color profile");
+ getFOValidationEventProducer().missingProperty(this,
+ cp.getName(), "color-profile-name", locator);
}
} else {
log.debug("Ignoring element " + node.getName()
@@ -100,22 +101,18 @@ public class Declarations extends FObj {
}
if (colorProfiles.get(cp.getColorProfileName()) != null) {
// duplicate names
- log.warn("Duplicate fo:color-profile profile name: "
- + cp.getColorProfileName());
+ getFOValidationEventProducer().colorProfileNameNotUnique(this,
+ cp.getName(), cp.getColorProfileName(), locator);
}
colorProfiles.put(cp.getColorProfileName(), cp);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getLocalName() {
return "declarations";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_DECLARATIONS;
}
diff --git a/src/java/org/apache/fop/fo/pagination/Flow.java b/src/java/org/apache/fop/fo/pagination/Flow.java
index fc5d605cc..2ee77ff0a 100644
--- a/src/java/org/apache/fop/fo/pagination/Flow.java
+++ b/src/java/org/apache/fop/fo/pagination/Flow.java
@@ -45,16 +45,12 @@ public class Flow extends FObj {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
flowName = pList.get(PR_FLOW_NAME).getString();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
if (flowName == null || flowName.equals("")) {
missingPropertyError("flow-name");
@@ -80,10 +76,7 @@ public class Flow extends FObj {
getFOEventHandler().startFlow(this);
}
- /**
- * Make sure content model satisfied, if so then tell the
- * FOEventHandler that we are at the end of the flow.
- */
+ /** {@inheritDoc} */
protected void endOfNode() throws FOPException {
if (!blockItemFound) {
missingChildElementError("marker* (%block;)+");
@@ -96,21 +89,21 @@ public class Flow extends FObj {
* XSL Content Model: marker* (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ }
+ } else if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockItemFound = true;
}
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockItemFound = true;
}
}
- /**
- * @return true (Flow can generate reference areas)
- */
+ /** {@inheritDoc} */
public boolean generatesReferenceAreas() {
return true;
}
@@ -125,9 +118,7 @@ public class Flow extends FObj {
return "flow";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_FLOW;
}
diff --git a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
index 54eb29744..1b57be57d 100644
--- a/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
+++ b/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
@@ -46,31 +46,27 @@ public class LayoutMasterSet extends FObj {
private Map pageSequenceMasters;
/**
+ * Creates a new layout-master-set element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public LayoutMasterSet(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
// No properties in layout-master-set.
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
getRoot().setLayoutMasterSet(this);
simplePageMasters = new java.util.HashMap();
pageSequenceMasters = new java.util.HashMap();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void endOfNode() throws FOPException {
if (firstChild == null) {
missingChildElementError("(simple-page-master|page-sequence-master)+");
@@ -83,14 +79,12 @@ public class LayoutMasterSet extends FObj {
XSL/FOP: (simple-page-master|page-sequence-master)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
if (FO_URI.equals(nsURI)) {
if (!localName.equals("simple-page-master")
&& !localName.equals("page-sequence-master")) {
invalidChildError(loc, nsURI, localName);
}
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
@@ -104,23 +98,20 @@ public class LayoutMasterSet extends FObj {
Map allRegions = new java.util.HashMap();
for (Iterator spm = simplePageMasters.values().iterator();
spm.hasNext();) {
- SimplePageMaster simplePageMaster =
- (SimplePageMaster)spm.next();
+ SimplePageMaster simplePageMaster
+ = (SimplePageMaster)spm.next();
Map spmRegions = simplePageMaster.getRegions();
for (Iterator e = spmRegions.values().iterator();
e.hasNext();) {
Region region = (Region) e.next();
if (allRegions.containsKey(region.getRegionName())) {
- String defaultRegionName =
- (String) allRegions.get(region.getRegionName());
+ String defaultRegionName
+ = (String) allRegions.get(region.getRegionName());
if (!defaultRegionName.equals(region.getDefaultRegionName())) {
- throw new ValidationException("Region-name ("
- + region.getRegionName()
- + ") is being mapped to multiple "
- + "region-classes ("
- + defaultRegionName + " and "
- + region.getDefaultRegionName()
- + ")", locator);
+ getFOValidationEventProducer().regionNameMappedToMultipleRegionClasses(this,
+ region.getRegionName(),
+ defaultRegionName,
+ region.getDefaultRegionName(), getLocator());
}
}
allRegions.put(region.getRegionName(),
@@ -141,21 +132,16 @@ public class LayoutMasterSet extends FObj {
// check for duplication of master-name
String masterName = sPM.getMasterName();
if (existsName(masterName)) {
- throw new ValidationException("'master-name' ("
- + masterName
- + ") must be unique "
- + "across page-masters and page-sequence-masters", sPM.getLocator());
+ getFOValidationEventProducer().masterNameNotUnique(this,
+ getName(),
+ masterName, sPM.getLocator());
}
this.simplePageMasters.put(masterName, sPM);
}
private boolean existsName(String masterName) {
- if (simplePageMasters.containsKey(masterName)
- || pageSequenceMasters.containsKey(masterName)) {
- return true;
- } else {
- return false;
- }
+ return (simplePageMasters.containsKey(masterName)
+ || pageSequenceMasters.containsKey(masterName));
}
/**
@@ -181,10 +167,9 @@ public class LayoutMasterSet extends FObj {
throws ValidationException {
// check against duplication of master-name
if (existsName(masterName)) {
- throw new ValidationException("'master-name' ("
- + masterName
- + ") must be unique "
- + "across page-masters and page-sequence-masters", pSM.getLocator());
+ getFOValidationEventProducer().masterNameNotUnique(this,
+ getName(),
+ masterName, pSM.getLocator());
}
this.pageSequenceMasters.put(masterName, pSM);
}
@@ -220,9 +205,7 @@ public class LayoutMasterSet extends FObj {
return "layout-master-set";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_LAYOUT_MASTER_SET;
}
diff --git a/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java b/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java
index 4289076ea..50620f678 100644
--- a/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java
+++ b/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java
@@ -43,7 +43,7 @@ public class PageNumberGenerator {
private int minPadding = 0; // for decimal formats
// preloaded strings of zeros
- private String zeros[] = {
+ private String[] zeros = {
"", "0", "00", "000", "0000", "00000"
};
@@ -128,10 +128,10 @@ public class PageNumberGenerator {
}
private String makeRoman(int num) {
- int arabic[] = {
+ int[] arabic = {
1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1
};
- String roman[] = {
+ String[] roman = {
"m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv",
"i"
};
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java
index 91649fbc5..3d155a1da 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java
@@ -78,9 +78,7 @@ public class PageSequence extends AbstractPageSequence {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
country = pList.get(PR_COUNTRY).getString();
@@ -93,9 +91,7 @@ public class PageSequence extends AbstractPageSequence {
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
flowMap = new java.util.HashMap();
@@ -105,9 +101,8 @@ public class PageSequence extends AbstractPageSequence {
this.pageSequenceMaster
= getRoot().getLayoutMasterSet().getPageSequenceMaster(masterReference);
if (this.pageSequenceMaster == null) {
- throw new ValidationException("master-reference '" + masterReference
- + "' for fo:page-sequence matches no"
- + " simple-page-master or page-sequence-master", locator);
+ getFOValidationEventProducer().masterNotFound(this, getName(),
+ masterReference, getLocator());
}
}
@@ -128,7 +123,7 @@ public class PageSequence extends AbstractPageSequence {
XSL Content Model: (title?,static-content*,flow)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
if (FO_URI.equals(nsURI)) {
if (localName.equals("title")) {
if (titleFO != null) {
@@ -149,8 +144,6 @@ public class PageSequence extends AbstractPageSequence {
} else {
invalidChildError(loc, nsURI, localName);
}
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
@@ -184,18 +177,15 @@ public class PageSequence extends AbstractPageSequence {
String flowName = flow.getFlowName();
if (hasFlowName(flowName)) {
- throw new ValidationException("duplicate flow-name \""
- + flowName
- + "\" found within fo:page-sequence", flow.getLocator());
+ getFOValidationEventProducer().duplicateFlowNameInPageSequence(this, flow.getName(),
+ flowName, flow.getLocator());
}
if (!getRoot().getLayoutMasterSet().regionNameExists(flowName)
&& !flowName.equals("xsl-before-float-separator")
&& !flowName.equals("xsl-footnote-separator")) {
- throw new ValidationException("flow-name \""
- + flowName
- + "\" could not be mapped to a region-name in the"
- + " layout-master-set", flow.getLocator());
+ getFOValidationEventProducer().flowNameNotMapped(this, flow.getName(),
+ flowName, flow.getLocator());
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
index 34ad299bd..4258a1139 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
@@ -29,6 +29,7 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.layoutmgr.BlockLevelEventProducer;
/**
* The page-sequence-master formatting object.
@@ -53,6 +54,8 @@ public class PageSequenceMaster extends FObj {
// but the actual FO's are MasterReferences.
/**
+ * Creates a new page-sequence-master element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public PageSequenceMaster(FONode parent) {
@@ -95,20 +98,18 @@ public class PageSequenceMaster extends FObj {
* repeatable-page-master-alternatives)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
if (FO_URI.equals(nsURI)) {
if (!localName.equals("single-page-master-reference")
&& !localName.equals("repeatable-page-master-reference")
&& !localName.equals("repeatable-page-master-alternatives")) {
invalidChildError(loc, nsURI, localName);
}
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
/**
- * Adds a new suqsequence specifier to the page sequence master.
+ * Adds a new subsequence specifier to the page sequence master.
* @param pageMasterReference the subsequence to add
*/
protected void addSubsequenceSpecifier(SubSequenceSpecifier pageMasterReference) {
@@ -199,8 +200,10 @@ public class PageSequenceMaster extends FObj {
if (currentSubSequence == null) {
currentSubSequence = getNextSubSequence();
if (currentSubSequence == null) {
- throw new FOPException("no subsequences in page-sequence-master '"
- + masterName + "'");
+ BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.missingSubsequencesInPageSequenceMaster(this,
+ masterName, getLocator());
}
}
String pageMasterName = currentSubSequence
@@ -209,14 +212,10 @@ public class PageSequenceMaster extends FObj {
while (pageMasterName == null) {
SubSequenceSpecifier nextSubSequence = getNextSubSequence();
if (nextSubSequence == null) {
- if (!canRecover) {
- throw new FOPException("subsequences exhausted in page-sequence-master '"
- + masterName
- + "', cannot recover");
- }
- log.warn("subsequences exhausted in page-sequence-master '"
- + masterName
- + "', using previous subsequence");
+ BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.pageSequenceMasterExhausted(this,
+ masterName, canRecover, getLocator());
currentSubSequence.reset();
canRecover = false;
} else {
@@ -228,9 +227,10 @@ public class PageSequenceMaster extends FObj {
SimplePageMaster pageMaster = this.layoutMasterSet
.getSimplePageMaster(pageMasterName);
if (pageMaster == null) {
- throw new FOPException("No simple-page-master matching '"
- + pageMasterName + "' in page-sequence-master '"
- + masterName + "'");
+ BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.noMatchingPageMaster(this,
+ masterName, pageMasterName, getLocator());
}
return pageMaster;
}
@@ -240,9 +240,7 @@ public class PageSequenceMaster extends FObj {
return "page-sequence-master";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_PAGE_SEQUENCE_MASTER;
}
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java b/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java
index 94c0314a3..0b3cff276 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java
@@ -22,8 +22,8 @@ package org.apache.fop.fo.pagination;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
@@ -39,15 +39,14 @@ public class PageSequenceWrapper extends FObj {
// End of property values
/**
+ * Creates a new page-sequence-wrapper element.
* @param parent FONode that is the parent of this object
*/
public PageSequenceWrapper(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
indexClass = pList.get(PR_INDEX_CLASS).getString();
@@ -59,10 +58,12 @@ public class PageSequenceWrapper extends FObj {
XSL/FOP: (bookmark+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!(FO_URI.equals(nsURI) && (localName.equals("page-sequence") ||
- localName.equals("page-sequence-wrapper")))) {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!(localName.equals("page-sequence")
+ || localName.equals("page-sequence-wrapper"))) {
invalidChildError(loc, nsURI, localName);
+ }
}
}
@@ -81,9 +82,7 @@ public class PageSequenceWrapper extends FObj {
return "page-sequence-wrapper";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_PAGE_SEQUENCE_WRAPPER;
}
diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java
index 2516f90d8..ded86514b 100644
--- a/src/java/org/apache/fop/fo/pagination/Region.java
+++ b/src/java/org/apache/fop/fo/pagination/Region.java
@@ -30,7 +30,6 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
@@ -50,6 +49,8 @@ public abstract class Region extends FObj {
private SimplePageMaster layoutMaster;
/**
+ * Creates a new Region.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
protected Region(FONode parent) {
@@ -57,9 +58,7 @@ public abstract class Region extends FObj {
layoutMaster = (SimplePageMaster) parent;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
// clip = pList.get(PR_CLIP);
@@ -76,18 +75,16 @@ public abstract class Region extends FObj {
// check that name is OK. Not very pretty.
if (isReserved(getRegionName())
&& !getRegionName().equals(getDefaultRegionName())) {
- throw new ValidationException("region-name '" + regionName
- + "' for " + this.getName()
- + " is not permitted.", locator);
+ getFOValidationEventProducer().illegalRegionName(this, getName(),
+ regionName, getLocator());
}
}
//TODO do we need context for getBPPaddingAndBorder() and getIPPaddingAndBorder()?
- if (getUserAgent().validateStrictly()
- && (getCommonBorderPaddingBackground().getBPPaddingAndBorder(false, null) != 0
+ if ((getCommonBorderPaddingBackground().getBPPaddingAndBorder(false, null) != 0
|| getCommonBorderPaddingBackground().getIPPaddingAndBorder(false, null) != 0)) {
- throw new PropertyException("Border and padding for region \""
- + regionName + "\" must be '0' (See 6.4.13 in XSL 1.0).");
+ getFOValidationEventProducer().nonZeroBorderPaddingOnRegion(this, getName(),
+ regionName, true, getLocator());
}
}
@@ -96,8 +93,10 @@ public abstract class Region extends FObj {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/**
@@ -121,7 +120,7 @@ public abstract class Region extends FObj {
* @param name a region name to check
* @return true if the name parameter is a reserved region name
*/
- protected boolean isReserved(String name) /*throws FOPException*/ {
+ protected boolean isReserved(String name) {
return (name.equals("xsl-region-before")
|| name.equals("xsl-region-start")
|| name.equals("xsl-region-end")
@@ -130,9 +129,7 @@ public abstract class Region extends FObj {
|| name.equals("xsl-footnote-separator"));
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean generatesReferenceAreas() {
return true;
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java
index 9459a6637..2852358b5 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.java
@@ -34,15 +34,15 @@ import org.apache.fop.datatypes.SimplePercentBaseContext;
public class RegionAfter extends RegionBA {
/**
+ * Creates a new region-after element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RegionAfter(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) {
/* Special rules apply to resolving extent as values are resolved relative
* to the page size and reference orientation.
@@ -82,9 +82,7 @@ public class RegionAfter extends RegionBA {
return vpRect;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected String getDefaultRegionName() {
return "xsl-region-after";
}
@@ -94,9 +92,7 @@ public class RegionAfter extends RegionBA {
return "region-after";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_REGION_AFTER;
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java
index 768af2489..279164a96 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBA.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java
@@ -36,15 +36,15 @@ public abstract class RegionBA extends SideRegion {
// End of property values
/**
+ * Creates a new region (before or after).
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
protected RegionBA(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
precedence = pList.get(PR_PRECEDENCE).getEnum();
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
index 6115d8dd8..076737252 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
@@ -32,23 +32,22 @@ import org.apache.fop.fo.FONode;
* The fo:region-before element.
*/
public class RegionBefore extends RegionBA {
+
/**
+ * Creates a new region-before element.
+ * @param parent the parent element
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RegionBefore(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected String getDefaultRegionName() {
return "xsl-region-before";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) {
/* Special rules apply to resolving extent as values are resolved relative
* to the page size and reference orientation.
@@ -91,9 +90,7 @@ public class RegionBefore extends RegionBA {
return "region-before";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_REGION_BEFORE;
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBody.java b/src/java/org/apache/fop/fo/pagination/RegionBody.java
index 4de2dd1b4..9700e72fc 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBody.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBody.java
@@ -43,29 +43,29 @@ public class RegionBody extends Region {
// End of property values
/**
+ * Creates a new region-body element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RegionBody(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
commonMarginBlock = pList.getMarginBlockProps();
columnCount = pList.get(PR_COLUMN_COUNT).getNumeric();
columnGap = pList.get(PR_COLUMN_GAP).getLength();
- if ((getColumnCount() > 1) && (getOverflow() == EN_SCROLL)) {
+ if ((getColumnCount() != 1) && (getOverflow() == EN_SCROLL)) {
/* This is an error (See XSL Rec, fo:region-body description).
* The Rec allows for acting as if "1" is chosen in
* these cases, but we will need to be able to change Numeric
* values in order to do this.
*/
- attributeError("If overflow property is set to \"scroll\","
- + " a column-count other than \"1\" may not be specified.");
+ getFOValidationEventProducer().columnCountErrorOnRegionBodyOverflowScroll(this,
+ getName(), getLocator());
}
}
@@ -93,9 +93,7 @@ public class RegionBody extends Region {
return columnGap.getValue();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) {
/* Special rules apply to resolving margins in the page context.
* Contrary to normal margins in this case top and bottom margin
@@ -143,9 +141,7 @@ public class RegionBody extends Region {
reldims.bpd - before - after);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected String getDefaultRegionName() {
return "xsl-region-body";
}
@@ -155,9 +151,7 @@ public class RegionBody extends Region {
return "region-body";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_REGION_BODY;
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/java/org/apache/fop/fo/pagination/RegionEnd.java
index 912be9097..13f65d71a 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.java
@@ -22,26 +22,26 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
-// FOP
-import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.fo.FONode;
/**
* The fo:region-end element.
*/
public class RegionEnd extends RegionSE {
+
/**
+ * Creates a new region-end element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RegionEnd(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) {
/* Special rules apply to resolving extent as values are resolved relative
* to the page size and reference orientation.
@@ -80,9 +80,7 @@ public class RegionEnd extends RegionSE {
return vpRect;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected String getDefaultRegionName() {
return "xsl-region-end";
}
@@ -92,9 +90,7 @@ public class RegionEnd extends RegionSE {
return "region-end";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_REGION_END;
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java
index 735623352..183b44342 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionSE.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java
@@ -35,15 +35,15 @@ public abstract class RegionSE extends SideRegion {
// End of property values
/**
+ * Creates a new region (start or end).
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
protected RegionSE(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java
index d78b19c3d..7a69cfdac 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionStart.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java
@@ -32,16 +32,17 @@ import org.apache.fop.datatypes.SimplePercentBaseContext;
* The fo:region-start element.
*/
public class RegionStart extends RegionSE {
+
/**
+ * Creates a new region-start element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RegionStart(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Rectangle getViewportRectangle (FODimension reldims, SimplePageMaster spm) {
/* Special rules apply to resolving extent as values are resolved relative
* to the page size and reference orientation.
@@ -77,9 +78,7 @@ public class RegionStart extends RegionSE {
return vpRect;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected String getDefaultRegionName() {
return "xsl-region-start";
}
@@ -89,9 +88,7 @@ public class RegionStart extends RegionSE {
return "region-start";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_REGION_START;
}
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
index 9d2fe652c..509b81f21 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
@@ -52,38 +52,29 @@ public class RepeatablePageMasterAlternatives extends FObj
private boolean hasPagePositionOnly = false;
/**
+ * Creates a new repeatable-page-master-alternatives element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RepeatablePageMasterAlternatives(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
conditionalPageMasterRefs = new java.util.ArrayList();
- if (parent.getName().equals("fo:page-sequence-master")) {
- PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
- pageSequenceMaster.addSubsequenceSpecifier(this);
- } else {
- throw new ValidationException("fo:repeatable-page-master-alternatives "
- + "must be child of fo:page-sequence-master, not "
- + parent.getName(), locator);
- }
+ assert parent.getName().equals("fo:page-sequence-master"); //Validation by the parent
+ PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
+ pageSequenceMaster.addSubsequenceSpecifier(this);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void endOfNode() throws FOPException {
if (firstChild == null) {
missingChildElementError("(conditional-page-master-reference+)");
@@ -95,10 +86,11 @@ public class RepeatablePageMasterAlternatives extends FObj
XSL/FOP: (conditional-page-master-reference+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!(FO_URI.equals(nsURI)
- && localName.equals("conditional-page-master-reference"))) {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!localName.equals("conditional-page-master-reference")) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
}
@@ -117,11 +109,7 @@ public class RepeatablePageMasterAlternatives extends FObj
}
}
- /**
- * Get the next matching page master from the conditional
- * page master references.
- * @see org.apache.fop.fo.pagination.SubSequenceSpecifier
- */
+ /** {@inheritDoc} */
public String getNextPageMasterName(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
@@ -183,12 +171,11 @@ public class RepeatablePageMasterAlternatives extends FObj
}
/** {@inheritDoc} */
- /** @see org.apache.fop.fo.pagination.SubSequenceSpecifier#hasPagePositionOnly() */
public boolean hasPagePositionOnly() {
return this.hasPagePositionOnly;
}
- /** @see org.apache.fop.fo.FONode#getLocalName() */
+ /** {@inheritDoc} */
public String getLocalName() {
return "repeatable-page-master-alternatives";
}
diff --git a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
index 172324232..87dc248c0 100644
--- a/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
@@ -47,15 +47,15 @@ public class RepeatablePageMasterReference extends FObj
private int numberConsumed = 0;
/**
+ * Creates a new repeatable-page-master-reference element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RepeatablePageMasterReference(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
@@ -65,9 +65,7 @@ public class RepeatablePageMasterReference extends FObj
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
@@ -83,13 +81,13 @@ public class RepeatablePageMasterReference extends FObj
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getNextPageMasterName(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java
index 6e079cf47..1cff9c3d6 100644
--- a/src/java/org/apache/fop/fo/pagination/Root.java
+++ b/src/java/org/apache/fop/fo/pagination/Root.java
@@ -25,7 +25,6 @@ import java.util.List;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.ElementMapping;
import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -62,7 +61,9 @@ public class Root extends FObj {
*/
private FOEventHandler foEventHandler = null;
- /**
+ /**
+ * Creates a new root element.
+ * @param parent the parent node (must be null)
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public Root(FONode parent) {
@@ -137,13 +138,6 @@ public class Root extends FObj {
}
- /** @inheritDoc */
- protected void validateChildNode(Locator loc, FONode child) throws ValidationException {
- if (child instanceof AbstractPageSequence) {
- pageSequenceFound = true;
- }
- }
-
/**
* Sets the FOEventHandler object that this Root is attached to
* @param foEventHandler the FOEventHandler object
@@ -291,9 +285,7 @@ public class Root extends FObj {
return bookmarkTree;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public Root getRoot() {
return this;
}
@@ -303,9 +295,7 @@ public class Root extends FObj {
return "root";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_ROOT;
}
diff --git a/src/java/org/apache/fop/fo/pagination/SideRegion.java b/src/java/org/apache/fop/fo/pagination/SideRegion.java
index 14328aa9b..552ca871b 100644
--- a/src/java/org/apache/fop/fo/pagination/SideRegion.java
+++ b/src/java/org/apache/fop/fo/pagination/SideRegion.java
@@ -31,7 +31,11 @@ public abstract class SideRegion extends Region {
private Length extent;
- /** @see org.apache.fop.fo.FONode#FONode(FONode) */
+ /**
+ * Creates a new side region.
+ * @param parent the parent node
+ * @see org.apache.fop.fo.FONode#FONode(FONode)
+ */
protected SideRegion(FONode parent) {
super(parent);
}
diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
index ba1c0a6af..85a5081c8 100644
--- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -63,15 +63,15 @@ public class SimplePageMaster extends FObj {
private boolean hasRegionEnd = false;
/**
+ * Creates a new simple-page-master element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public SimplePageMaster(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
commonMarginBlock = pList.getMarginBlockProps();
masterName = pList.get(PR_MASTER_NAME).getString();
@@ -85,9 +85,7 @@ public class SimplePageMaster extends FObj {
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
LayoutMasterSet layoutMasterSet = (LayoutMasterSet) parent;
@@ -101,9 +99,7 @@ public class SimplePageMaster extends FObj {
regions = new HashMap(5);
}
- /**
- * Make sure content model satisfied.
- */
+ /** {@inheritDoc} */
protected void endOfNode() throws FOPException {
if (!hasRegionBody) {
missingChildElementError(
@@ -116,72 +112,70 @@ public class SimplePageMaster extends FObj {
* XSL Content Model: (region-body,region-before?,region-after?,region-start?,region-end?)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("region-body")) {
- if (hasRegionBody) {
- tooManyNodesError(loc, "fo:region-body");
- } else {
- hasRegionBody = true;
- }
- } else if (FO_URI.equals(nsURI) && localName.equals("region-before")) {
- if (!hasRegionBody) {
- nodesOutOfOrderError(loc, "fo:region-body", "fo:region-before");
- } else if (hasRegionBefore) {
- tooManyNodesError(loc, "fo:region-before");
- } else if (hasRegionAfter) {
- nodesOutOfOrderError(loc, "fo:region-before", "fo:region-after");
- } else if (hasRegionStart) {
- nodesOutOfOrderError(loc, "fo:region-before", "fo:region-start");
- } else if (hasRegionEnd) {
- nodesOutOfOrderError(loc, "fo:region-before", "fo:region-end");
- } else {
- hasRegionBody = true;
- }
- } else if (FO_URI.equals(nsURI) && localName.equals("region-after")) {
- if (!hasRegionBody) {
- nodesOutOfOrderError(loc, "fo:region-body", "fo:region-after");
- } else if (hasRegionAfter) {
- tooManyNodesError(loc, "fo:region-after");
- } else if (hasRegionStart) {
- nodesOutOfOrderError(loc, "fo:region-after", "fo:region-start");
- } else if (hasRegionEnd) {
- nodesOutOfOrderError(loc, "fo:region-after", "fo:region-end");
- } else {
- hasRegionAfter = true;
- }
- } else if (FO_URI.equals(nsURI) && localName.equals("region-start")) {
- if (!hasRegionBody) {
- nodesOutOfOrderError(loc, "fo:region-body", "fo:region-start");
- } else if (hasRegionStart) {
- tooManyNodesError(loc, "fo:region-start");
- } else if (hasRegionEnd) {
- nodesOutOfOrderError(loc, "fo:region-start", "fo:region-end");
- } else {
- hasRegionStart = true;
- }
- } else if (FO_URI.equals(nsURI) && localName.equals("region-end")) {
- if (!hasRegionBody) {
- nodesOutOfOrderError(loc, "fo:region-body", "fo:region-end");
- } else if (hasRegionEnd) {
- tooManyNodesError(loc, "fo:region-end");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("region-body")) {
+ if (hasRegionBody) {
+ tooManyNodesError(loc, "fo:region-body");
+ } else {
+ hasRegionBody = true;
+ }
+ } else if (localName.equals("region-before")) {
+ if (!hasRegionBody) {
+ nodesOutOfOrderError(loc, "fo:region-body", "fo:region-before");
+ } else if (hasRegionBefore) {
+ tooManyNodesError(loc, "fo:region-before");
+ } else if (hasRegionAfter) {
+ nodesOutOfOrderError(loc, "fo:region-before", "fo:region-after");
+ } else if (hasRegionStart) {
+ nodesOutOfOrderError(loc, "fo:region-before", "fo:region-start");
+ } else if (hasRegionEnd) {
+ nodesOutOfOrderError(loc, "fo:region-before", "fo:region-end");
+ } else {
+ hasRegionBody = true;
+ }
+ } else if (localName.equals("region-after")) {
+ if (!hasRegionBody) {
+ nodesOutOfOrderError(loc, "fo:region-body", "fo:region-after");
+ } else if (hasRegionAfter) {
+ tooManyNodesError(loc, "fo:region-after");
+ } else if (hasRegionStart) {
+ nodesOutOfOrderError(loc, "fo:region-after", "fo:region-start");
+ } else if (hasRegionEnd) {
+ nodesOutOfOrderError(loc, "fo:region-after", "fo:region-end");
+ } else {
+ hasRegionAfter = true;
+ }
+ } else if (localName.equals("region-start")) {
+ if (!hasRegionBody) {
+ nodesOutOfOrderError(loc, "fo:region-body", "fo:region-start");
+ } else if (hasRegionStart) {
+ tooManyNodesError(loc, "fo:region-start");
+ } else if (hasRegionEnd) {
+ nodesOutOfOrderError(loc, "fo:region-start", "fo:region-end");
+ } else {
+ hasRegionStart = true;
+ }
+ } else if (localName.equals("region-end")) {
+ if (!hasRegionBody) {
+ nodesOutOfOrderError(loc, "fo:region-body", "fo:region-end");
+ } else if (hasRegionEnd) {
+ tooManyNodesError(loc, "fo:region-end");
+ } else {
+ hasRegionEnd = true;
+ }
} else {
- hasRegionEnd = true;
+ invalidChildError(loc, nsURI, localName);
}
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean generatesReferenceAreas() {
return true;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void addChildNode(FONode child) throws FOPException {
if (child instanceof Region) {
addRegion((Region)child);
@@ -268,9 +262,7 @@ public class SimplePageMaster extends FObj {
return "simple-page-master";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_SIMPLE_PAGE_MASTER;
}
diff --git a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
index 43d8e40dc..119ec409e 100644
--- a/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/SinglePageMasterReference.java
@@ -46,6 +46,8 @@ public class SinglePageMasterReference extends FObj
private int state;
/**
+ * Creates a new single-page-master-reference element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public SinglePageMasterReference(FONode parent) {
@@ -53,9 +55,7 @@ public class SinglePageMasterReference extends FObj
this.state = FIRST;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
@@ -64,9 +64,7 @@ public class SinglePageMasterReference extends FObj
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
pageSequenceMaster.addSubsequenceSpecifier(this);
@@ -77,8 +75,10 @@ public class SinglePageMasterReference extends FObj
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
/** {@inheritDoc} */
diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java
index 62d73e56d..184438b6f 100644
--- a/src/java/org/apache/fop/fo/pagination/StaticContent.java
+++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java
@@ -27,24 +27,22 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.ValidationException;
/**
- * Class modelling the fo:static-content object.
+ * Class modeling the fo:static-content object.
*/
public class StaticContent extends Flow {
/**
+ * Creates a new static-content element.
* @param parent FONode that is the parent of this object
*/
public StaticContent(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void startOfNode() throws FOPException {
if (getFlowName() == null || getFlowName().equals("")) {
- throw new ValidationException("A 'flow-name' is required for "
- + getName() + ".", locator);
+ missingPropertyError("flow-name");
}
getFOEventHandler().startFlow(this);
}
@@ -66,9 +64,11 @@ public class StaticContent extends Flow {
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/Title.java b/src/java/org/apache/fop/fo/pagination/Title.java
index 398424152..f6f625ea8 100644
--- a/src/java/org/apache/fop/fo/pagination/Title.java
+++ b/src/java/org/apache/fop/fo/pagination/Title.java
@@ -27,7 +27,7 @@ import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.flow.InlineLevel;
/**
- * Class modelling the fo:title object.
+ * Class modeling the fo:title object.
*/
public class Title extends InlineLevel {
// The value of properties relevant for fo:title.
@@ -35,6 +35,7 @@ public class Title extends InlineLevel {
// End of property values
/**
+ * Creates a new title element.
* @param parent FONode that is the parent of this object
*/
public Title(FONode parent) {
@@ -46,22 +47,20 @@ public class Title extends InlineLevel {
XSL/FOP: (#PCDATA|%inline;)*
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!isInlineItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!isInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getLocalName() {
return "title";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_TITLE;
}
diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
index e588bb3f8..7f55ec51b 100644
--- a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
+++ b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
@@ -20,10 +20,13 @@
package org.apache.fop.fo.pagination.bookmarks;
import java.util.ArrayList;
+import java.util.List;
+
import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
@@ -68,10 +71,10 @@ public class Bookmark extends FObj {
externalDestination = null;
} else if (externalDestination.length() == 0) {
// slightly stronger than spec "should be specified"
- attributeError("Missing attribute: Either external-destination or " +
- "internal-destination must be specified.");
+ getFOValidationEventProducer().missingLinkDestination(this, getName(), locator);
} else {
- attributeWarning("external-destination property not currently supported");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ "external-destination", getLocator());
}
}
@@ -80,18 +83,20 @@ public class Bookmark extends FObj {
XSL/FOP: (bookmark-title, bookmark*)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("bookmark-title")) {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("bookmark-title")) {
if (bookmarkTitle != null) {
tooManyNodesError(loc, "fo:bookmark-title");
}
- } else if (FO_URI.equals(nsURI) && localName.equals("bookmark")) {
+ } else if (localName.equals("bookmark")) {
if (bookmarkTitle == null) {
nodesOutOfOrderError(loc, "fo:bookmark-title", "fo:bookmark");
}
} else {
invalidChildError(loc, nsURI, localName);
}
+ }
}
/**
@@ -123,10 +128,18 @@ public class Bookmark extends FObj {
return bookmarkTitle == null ? "" : bookmarkTitle.getTitle();
}
+ /**
+ * Returns the value of the internal-destination property.
+ * @return the internal-destination
+ */
public String getInternalDestination() {
return internalDestination;
}
+ /**
+ * Returns the value of the external-destination property.
+ * @return the external-destination
+ */
public String getExternalDestination() {
return externalDestination;
}
@@ -141,7 +154,11 @@ public class Bookmark extends FObj {
return bShow;
}
- public ArrayList getChildBookmarks() {
+ /**
+ * Returns a list of child bookmarks.
+ * @return the list of child bookmarks
+ */
+ public List getChildBookmarks() {
return childBookmarks;
}
@@ -150,9 +167,7 @@ public class Bookmark extends FObj {
return "bookmark";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_BOOKMARK;
}
diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java
index f31aad1cb..c7024f2aa 100644
--- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java
+++ b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java
@@ -21,8 +21,8 @@ package org.apache.fop.fo.pagination.bookmarks;
import org.xml.sax.Locator;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
@@ -45,15 +45,16 @@ public class BookmarkTitle extends FObj {
/**
* Add the characters to this BookmarkTitle.
- * The text data inside the BookmarkTitle xml element
+ * The text data inside the BookmarkTitle XML element
* is used for the BookmarkTitle string.
*
* @param data the character data
* @param start the start position in the data array
* @param end the end position in the character array
- * @param locator location in fo source file.
+ * @param pList the currently valid property list
+ * @param locator location in FO source file.
*/
- protected void addCharacters(char data[], int start, int end,
+ protected void addCharacters(char[] data, int start, int end,
PropertyList pList,
Locator locator) {
title += new String(data, start, end - start);
@@ -64,8 +65,10 @@ public class BookmarkTitle extends FObj {
XSL/FOP: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/**
@@ -82,9 +85,7 @@ public class BookmarkTitle extends FObj {
return "bookmark-title";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_BOOKMARK_TITLE;
}
diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java
index 6190fa22a..0f1d8a8b7 100644
--- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java
+++ b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java
@@ -21,6 +21,7 @@ package org.apache.fop.fo.pagination.bookmarks;
// Java
import java.util.ArrayList;
+import java.util.List;
import org.xml.sax.Locator;
@@ -39,15 +40,15 @@ public class BookmarkTree extends FObj {
private ArrayList bookmarks = new ArrayList();
/**
+ * Creates a new bookmark-tree element.
+ * @param parent the parent node
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public BookmarkTree(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void addChildNode(FONode obj) {
if (obj instanceof Bookmark) {
bookmarks.add(obj);
@@ -69,14 +70,19 @@ public class BookmarkTree extends FObj {
XSL/FOP: (bookmark+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!(FO_URI.equals(nsURI) &&
- localName.equals("bookmark"))) {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!localName.equals("bookmark")) {
invalidChildError(loc, nsURI, localName);
+ }
}
}
- public ArrayList getBookmarks() {
+ /**
+ * Returns the root bookmarks.
+ * @return the root bookmarks
+ */
+ public List getBookmarks() {
return bookmarks;
}
@@ -85,9 +91,7 @@ public class BookmarkTree extends FObj {
return "bookmark-tree";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_BOOKMARK_TREE;
}