diff options
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination/Root.java')
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/Root.java | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/Root.java b/src/java/org/apache/fop/fo/pagination/Root.java index c6346e9fb..fcbb54abd 100644 --- a/src/java/org/apache/fop/fo/pagination/Root.java +++ b/src/java/org/apache/fop/fo/pagination/Root.java @@ -5,9 +5,9 @@ * 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. @@ -63,12 +63,12 @@ public class Root extends FObj { * Context class used while building the FO tree. */ private FOTreeBuilderContext builderContext; - + /** * FOEventHandler object for this FO Tree */ private FOEventHandler foEventHandler = null; - + /** * Base constructor * @@ -88,7 +88,7 @@ public class Root extends FObj { /** {@inheritDoc} */ protected void endOfNode() throws FOPException { if (!pageSequenceFound || layoutMasterSet == null) { - missingChildElementError("(layout-master-set, declarations?, " + missingChildElementError("(layout-master-set, declarations?, " + "bookmark-tree?, (page-sequence|fox:external-document)+)"); } } @@ -98,14 +98,14 @@ public class Root extends FObj { * <br>XSL 1.0 Spec: (layout-master-set,declarations?,page-sequence+) * <br>FOP: (layout-master-set, declarations?, fox:bookmarks?, page-sequence+) */ - protected void validateChildNode(Locator loc, String nsURI, String localName) + protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { if (FO_URI.equals(nsURI)) { - if (localName.equals("layout-master-set")) { + if (localName.equals("layout-master-set")) { if (layoutMasterSet != null) { tooManyNodesError(loc, "fo:layout-master-set"); } - } else if (localName.equals("declarations")) { + } else if (localName.equals("declarations")) { if (layoutMasterSet == null) { nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:declarations"); } else if (declarations != null) { @@ -123,7 +123,7 @@ public class Root extends FObj { } else if (pageSequenceFound) { nodesOutOfOrderError(loc, "fo:bookmark-tree", "fo:page-sequence"); } - } else if (localName.equals("page-sequence")) { + } else if (localName.equals("page-sequence")) { if (layoutMasterSet == null) { nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:page-sequence"); } else { @@ -142,7 +142,7 @@ public class Root extends FObj { //Ignore non-FO elements under root } } - + /** @inheritDoc */ protected void validateChildNode(Locator loc, FONode child) throws ValidationException { @@ -159,15 +159,15 @@ public class Root extends FObj { this.foEventHandler = foEventHandler; } - /** - * This method overrides the FONode version. The FONode version calls the - * method by the same name for the parent object. Since Root is at the top - * of the tree, it returns the actual FOEventHandler object. Thus, any FONode - * can use this chain to find which FOEventHandler it is being built for. - * @return the FOEventHandler implementation that this Root is attached to - */ - public FOEventHandler getFOEventHandler() { - return foEventHandler; + /** + * This method overrides the FONode version. The FONode version calls the + * method by the same name for the parent object. Since Root is at the top + * of the tree, it returns the actual FOEventHandler object. Thus, any FONode + * can use this chain to find which FOEventHandler it is being built for. + * @return the FOEventHandler implementation that this Root is attached to + */ + public FOEventHandler getFOEventHandler() { + return foEventHandler; } /** @@ -182,7 +182,7 @@ public class Root extends FObj { public FOTreeBuilderContext getBuilderContext() { return this.builderContext; } - + /** * Gets the last page number generated by the previous page-sequence * @return the last page number, 0 if no page sequences yet generated @@ -207,15 +207,15 @@ public class Root extends FObj { * @param additionalPages the total pages generated by the sequence (for statistics) * @throws IllegalArgumentException for negative additional page counts */ - public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) { - + public void notifyPageSequenceFinished(int lastPageNumber, int additionalPages) { + if (additionalPages >= 0) { totalPagesGenerated += additionalPages; - endingPageNumberOfPreviousSequence = lastPageNumber; + endingPageNumberOfPreviousSequence = lastPageNumber; } else { throw new IllegalArgumentException( "Number of additional pages must be zero or greater."); - } + } } /** |