From 596c4d5b88839546fbd7639dfc7bcd969f48aefd Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 30 May 2004 16:16:58 +0000 Subject: [PATCH] Class to hold minimum and maximum ranges required to layout blocks git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197672 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/AreaRange.java | 186 ++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 src/java/org/apache/fop/area/AreaRange.java diff --git a/src/java/org/apache/fop/area/AreaRange.java b/src/java/org/apache/fop/area/AreaRange.java new file mode 100644 index 000000000..6fa45f51e --- /dev/null +++ b/src/java/org/apache/fop/area/AreaRange.java @@ -0,0 +1,186 @@ +/* + * + * Copyright 2004 The Apache Software Foundation. + * + * Licensed 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. + * + * Created on 30/05/2004 + * $Id$ + */ +package org.apache.fop.area; + +import java.awt.geom.Rectangle2D; +/** + * A AreaRange contains minimum and maximum values for + * inline-progression-dimension and + * block-progression-dimension. + * @author pbw + * @version $Revision$ $Name$ + */ +public class AreaRange { + + /** + * The x-axis length is the mimimum inline-progression-dimension. + * The y-axis length is the mimimum block-progression-dimension. + */ + protected Rectangle2D minima = null; + /** + * The x-axis length is the maximum inline-progression-dimension. + * The y-axis length is the maximum block-progression-dimension. + */ + protected Rectangle2D maxima = null; + /** + */ + public AreaRange() { } + + public AreaRange( + float iPDimMin, float iPDimMax, float bPDimMin, float bPDimMax) { + minima = new Rectangle2D.Float(0, 0, iPDimMin, bPDimMin); + maxima = new Rectangle2D.Float(0, 0, iPDimMax, bPDimMax); + } + + public AreaRange(Rectangle2D minima, Rectangle2D maxima) { + this.minima = minima; + this.maxima = maxima; + } + + /** + * Gets the block-progression-dimension maximum value, + * in points + * N.B. The method is synchronized only on this object. + * @return the block-progression-dimension maximum value + */ + public Float getBPDimMax() { + synchronized (this) { + if (maxima == null) { + return null; + } + return new Float(maxima.getHeight()); + } + } + + /** + * Sets the block-progression-dimension maximum value, + * in points + * N.B. The method is synchronized only on this object. + * @param dimMax block-progression-dimension maximum value + * to set + */ + public void setBPDimMax(float dimMax) { + synchronized (this) { + if (maxima == null) { + maxima = new Rectangle2D.Float(0, 0, 0, 0); + } + maxima.setRect( + maxima.getMinX(), maxima.getMinY(), maxima.getWidth(), + dimMax); + } + } + + /** + * Gets the block-progression-dimension minimum value, + * in points + * N.B. The method is synchronized only on this object. + * @return the block-progression-dimension minimum value + */ + public Float getBPDimMin() { + synchronized (this) { + if (minima == null) { + return null; + } + return new Float(minima.getHeight()); + } + } + + /** + * Sets the block-progression-dimension minimum value, + * in points + * N.B. The method is synchronized only on this object. + * @param dimMin block-progression-dimension minimum value + * to set + */ + public void setBPDimMin(float dimMin) { + synchronized (this) { + if (minima == null) { + minima = new Rectangle2D.Float(0, 0, 0, 0); + } + minima.setRect(maxima.getMinX(), maxima.getMinY(), maxima.getWidth(), + dimMin); + } + } + + /** + * Gets the inline-progression-dimension maximum value, + * in points + * N.B. The method is synchronized only on this object. + * @return the inline-progression-dimension maximum value + */ + public Float getIPDimMax() { + synchronized(this) { + if (maxima == null) { + return null; + } + return new Float(maxima.getWidth()); + } + } + + /** + * Sets the inline-progression-dimension maximum value, + * in points + * N.B. The method is synchronized only on this object. + * @param dimMax inline-progression-dimension maximum value + * to set + */ + public void setIPDimMax(float dimMax) { + synchronized (this) { + if (maxima == null) { + maxima = new Rectangle2D.Float(0, 0, 0, 0); + } + maxima.setRect( + maxima.getMinX(), maxima.getMinY(), dimMax, maxima.getHeight()); + } + } + + /** + * Gets the inline-progression-dimension mimimum value, + * in points + * N.B. The method is synchronized only on this object. + * @return the inline-progression-dimension minimum value + */ + public Float getIPDimMin() { + synchronized (this) { + if (minima == null) { + return null; + } + return new Float(minima.getWidth()); + } + } + + /** + * Sets the inline-progression-dimension minimum value, + * in millipoints + * N.B. The method is synchronized only on this object. + * @param dimMin inline-progression-dimension minimum value + * to set + */ + public void setIPDimMin(float dimMin) { + synchronized (this) { + if (minima == null) { + minima = new Rectangle2D.Float(0, 0, 0, 0); + } + minima.setRect( + minima.getMinX(), minima.getMinY(), dimMin, minima.getHeight()); + } + } + +} -- 2.39.5