diff options
author | Keiron Liddle <keiron@apache.org> | 2001-07-04 12:41:09 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-07-04 12:41:09 +0000 |
commit | 6a99271a265b037c7df93fa1decde3be41a048fb (patch) | |
tree | 0e2cc1dff626002e719935343427f24cf95b2077 /src/org/apache/fop/fo/pagination | |
parent | ebc6e7ec5afcf37060db6ef9e87d37ab1802c5d7 (diff) | |
download | xmlgraphics-fop-6a99271a265b037c7df93fa1decde3be41a048fb.tar.gz xmlgraphics-fop-6a99271a265b037c7df93fa1decde3be41a048fb.zip |
fixed line endings
some cleanup also
no code changes
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194328 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/fo/pagination')
-rw-r--r-- | src/org/apache/fop/fo/pagination/Region.java | 135 |
1 files changed, 62 insertions, 73 deletions
diff --git a/src/org/apache/fop/fo/pagination/Region.java b/src/org/apache/fop/fo/pagination/Region.java index af1f50e07..94d11b3e7 100644 --- a/src/org/apache/fop/fo/pagination/Region.java +++ b/src/org/apache/fop/fo/pagination/Region.java @@ -1,11 +1,10 @@ -/*-- $Id$ -- - +/* $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources." + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. */ - package org.apache.fop.fo.pagination; +package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.FObj; @@ -16,87 +15,79 @@ import org.apache.fop.layout.RegionArea; /** * This is an abstract base class for pagination regions */ -public abstract class Region extends FObj -{ +public abstract class Region extends FObj { public static final String PROP_REGION_NAME = "region-name"; - + private SimplePageMaster _layoutMaster; private String _regionName; - - protected Region(FObj parent, PropertyList propertyList) - throws FOPException - { - super(parent, propertyList); - this.name = getElementName(); - - // regions may have name, or default - if (null == this.properties.get(PROP_REGION_NAME)) { - setRegionName(getDefaultRegionName()); - } - else if (this.properties.get(PROP_REGION_NAME).getString().equals("")) { - setRegionName(getDefaultRegionName()); - } - else { - setRegionName(this.properties.get(PROP_REGION_NAME).getString()); - // check that name is OK. Not very pretty. - if (isReserved(getRegionName()) && - !getRegionName().equals(getDefaultRegionName())) { - throw new FOPException(PROP_REGION_NAME+" '" + _regionName - + "' for "+this.name+" not permitted."); - } - } - - if (parent.getName().equals("fo:simple-page-master")) { - _layoutMaster = (SimplePageMaster) parent; - getPageMaster().addRegion(this); - } else { - throw new FOPException(getElementName()+" must be child " - + "of simple-page-master, not " - + parent.getName()); - } + + protected Region(FObj parent, + PropertyList propertyList) throws FOPException { + super(parent, propertyList); + this.name = getElementName(); + + // regions may have name, or default + if (null == this.properties.get(PROP_REGION_NAME)) { + setRegionName(getDefaultRegionName()); + } else if ( this.properties.get( + PROP_REGION_NAME).getString().equals("")) { + setRegionName(getDefaultRegionName()); + } else { + setRegionName( + this.properties.get(PROP_REGION_NAME).getString()); + // check that name is OK. Not very pretty. + if (isReserved(getRegionName()) && + !getRegionName().equals(getDefaultRegionName())) { + throw new FOPException(PROP_REGION_NAME + " '" + + _regionName + "' for "+this.name + " not permitted."); + } + } + + if (parent.getName().equals("fo:simple-page-master")) { + _layoutMaster = (SimplePageMaster) parent; + getPageMaster().addRegion(this); + } else { + throw new FOPException(getElementName() + " must be child " + + "of simple-page-master, not " + parent.getName()); + } } /** * Creates a Region layout object for this pagination Region. */ - abstract RegionArea makeRegionArea(int allocationRectangleXPosition, - int allocationRectangleYPosition, - int allocationRectangleWidth, - int allocationRectangleHeight); - - /** + abstract RegionArea makeRegionArea( int allocationRectangleXPosition, + int allocationRectangleYPosition, + int allocationRectangleWidth, int allocationRectangleHeight); + + /** * Returns the default region name (xsl-region-before, xsl-region-start, - * etc.) + * etc.) */ protected abstract String getDefaultRegionName(); /** * Returns the element name ("fo:region-body", "fo:region-start", - * etc.) + * etc.) */ protected abstract String getElementName(); - + public abstract String getRegionClass(); - + /** * Returns the name of this region */ - public String getRegionName() - { - return _regionName; + public String getRegionName() { + return _regionName; } - private void setRegionName(String name) - { - _regionName = name; + private void setRegionName(String name) { + _regionName = name; } - - protected SimplePageMaster getPageMaster() - { - return _layoutMaster; + + protected SimplePageMaster getPageMaster() { + return _layoutMaster; } - /** * Checks to see if a given region name is one of the reserved names @@ -104,19 +95,17 @@ 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 - { - return (name.equals( "xsl-region-before" ) || - name.equals( "xsl-region-start" ) || - name.equals( "xsl-region-end" ) || - name.equals( "xsl-region-after" ) || - name.equals( "xsl-before-float-separator" ) || - name.equals( "xsl-footnote-separator" )); + protected boolean isReserved(String name) throws FOPException { + return (name.equals("xsl-region-before") || + name.equals("xsl-region-start") || + name.equals("xsl-region-end") || + name.equals("xsl-region-after") || + name.equals("xsl-before-float-separator") || + name.equals("xsl-footnote-separator")); } - + public boolean generatesReferenceAreas() { - return true; + return true; } - + } |