cvs commit: xml-fop/src/org/apache/fop/area Area.java
jeremias2003/01/27 01:24:04 Modified:src/org/apache/fop/area Area.java Log: Added convenience method to get a trait as an int. Revision ChangesPath 1.15 +18 -1 xml-fop/src/org/apache/fop/area/Area.java Index: Area.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Area.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Area.java 29 Nov 2002 23:18:52 - 1.14 +++ Area.java 27 Jan 2003 09:24:04 - 1.15 @@ -201,5 +201,22 @@ public Object getTrait(Object oTraitCode) { return (props != null ? props.get(oTraitCode) : null); } + +/** + * Get a trait from this area as an integer. + * + * @param oTraitCode the trait key + * @return the trait value + */ +public int getTraitAsInteger(Object oTraitCode) { +final Object obj = getTrait(oTraitCode); +if (obj instanceof Integer) { +return ((Integer)obj).intValue(); +} else { +throw new IllegalArgumentException("Trait " ++ oTraitCode.getClass().getName() ++ " could not be converted to an integer"); +} +} } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/area Area.java Block.java BlockParent.java RegionReference.java
keiron 2002/09/19 02:20:06 Modified:src/org/apache/fop/area Area.java Block.java BlockParent.java RegionReference.java Log: don't implement serializable twice Revision ChangesPath 1.10 +3 -1 xml-fop/src/org/apache/fop/area/Area.java Index: Area.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Area.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Area.java 18 Sep 2002 13:50:13 - 1.9 +++ Area.java 19 Sep 2002 09:20:06 - 1.10 @@ -151,6 +151,8 @@ * @param child the child area to add */ public void addChild(Area child) { +System.out.println(""); +(new Exception()).printStackTrace(); } /** 1.11 +2 -3 xml-fop/src/org/apache/fop/area/Block.java Index: Block.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Block.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Block.java18 Sep 2002 13:50:13 - 1.10 +++ Block.java19 Sep 2002 09:20:06 - 1.11 @@ -7,7 +7,6 @@ package org.apache.fop.area; -import java.io.Serializable; import java.util.ArrayList; // block areas hold either more block areas or line @@ -21,7 +20,7 @@ * This is the block area class. * It holds child block areas such as other blocks or lines. */ -public class Block extends BlockParent implements Serializable { +public class Block extends BlockParent { /** * Normally stacked with other blocks. */ 1.5 +2 -3 xml-fop/src/org/apache/fop/area/BlockParent.java Index: BlockParent.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BlockParent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- BlockParent.java 18 Sep 2002 13:50:13 - 1.4 +++ BlockParent.java 19 Sep 2002 09:20:06 - 1.5 @@ -7,14 +7,13 @@ package org.apache.fop.area; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * A BlockParent holds block-level areas. */ -public class BlockParent extends Area implements Serializable { +public class BlockParent extends Area { // this position is used for absolute position // or as an indent 1.7 +2 -3 xml-fop/src/org/apache/fop/area/RegionReference.java Index: RegionReference.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/RegionReference.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RegionReference.java 18 Sep 2002 13:50:13 - 1.6 +++ RegionReference.java 19 Sep 2002 09:20:06 - 1.7 @@ -7,7 +7,6 @@ package org.apache.fop.area; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -16,7 +15,7 @@ * This area represents a region on the page. It is cloneable * so the page master can make copies from the original page and regions. */ -public class RegionReference extends Area implements Serializable, Cloneable { +public class RegionReference extends Area implements Cloneable { /** * The before region. */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/area Area.java BeforeFloat.java Block.java BodyRegion.java Flow.java Footnote.java MainReference.java Page.java RegionViewport.java Span.java
klease 01/11/09 14:02:35 Modified:src/org/apache/fop/area Area.java BeforeFloat.java Block.java BodyRegion.java Flow.java Footnote.java MainReference.java Page.java RegionViewport.java Span.java Log: Add some methods needed by the LayoutManager classes (subject to discussion) Revision ChangesPath 1.4 +85 -1 xml-fop/src/org/apache/fop/area/Area.java Index: Area.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Area.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Area.java 2001/11/09 11:32:36 1.3 +++ Area.java 2001/11/09 22:02:34 1.4 @@ -1,5 +1,5 @@ /* - * $Id: Area.java,v 1.3 2001/11/09 11:32:36 keiron Exp $ + * $Id: Area.java,v 1.4 2001/11/09 22:02:34 klease Exp $ * 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. @@ -8,6 +8,7 @@ package org.apache.fop.area; import java.io.Serializable; +import org.apache.fop.fo.FObj; // If the area appears more than once in the output // or if the area has external data it is cached @@ -33,4 +34,87 @@ public static final int ORIENT_180 = 2; public static final int ORIENT_270 = 3; +// area class values +public static final int CLASS_NORMAL = 0; +public static final int CLASS_FIXED = 1; +public static final int CLASS_ABSOLUTE = 2; +public static final int CLASS_BEFORE_FLOAT = 3; +public static final int CLASS_FOOTNOTE = 4; +public static final int CLASS_SIDE_FLOAT = 5; +// IMPORTANT: make sure this is the maximum + 1 +public static final int CLASS_MAX = CLASS_SIDE_FLOAT+1; + +private int areaClass=CLASS_NORMAL; +private FObj genFObj; + +protected Area parent =null; // Doesn't need to be saved in serialization + +public int getAreaClass() { + return areaClass; +} + +public void setAreaClass(int areaClass) { + this.areaClass = areaClass; +} + +/** + * Return a length range describing the minimum, optimum and maximum + * lengths available for content in the block-progression-direction. + * This is calculated from the theoretical maximum size of the area + * and its current content. + */ +public MinOptMax getAvailBPD() { + return MinOptMax.subtract(getMaxBPD(), getContentBPD()); +} + +/** + * Return a length range describing the theoretical maximum size of an + * area in the block-progression-direction. + * For areas holding normal flowing or floating content in paged media, + * this depends on the size of the body. In general the answer is the + * gotten from the parent. At the body level, the calculation accounts + * for the sizes of the conditional areas. + */ +public MinOptMax getMaxBPD() { + if (parent != null) { + return parent.getMaxBPD(); + } + else return new MinOptMax(); +} + +/** + * Return a length range describing the minimum, optimum and maximum + * lengths of all area content in the block-progression-direction. + * This is based on the allocation rectangles of all content in + * the area. + */ +public MinOptMax getContentBPD() { + return new MinOptMax(); +} + +/** + * Return a length range describing the minimum, optimum and maximum + * lengths of the area's allocation rectangle + * in the block-progression-direction. + * This is based on the allocation rectangles of all content in + * the area. + * The default implementation simply returns the same as the content BPD. + * If an Area has before or after border and padding, these contribute + * to the allocation BPD, depending on conditionality. + */ +public MinOptMax getAllocationBPD() { + return getContentBPD(); +} + +public void setParent(Area parent) { + this.parent = parent; +} + +public void setGeneratingFObj(FObj fobj) { + this.genFObj = fobj; +} + +public FObj getGeneratingFObj() { + return this.genFObj; +} } 1.3 +16 -2 xml-fop/src/org/apache/fop/area/BeforeFloat.java Index: BeforeFloat.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/BeforeFloat.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- BeforeFloat.java 2001/10/26 09:26:59 1.2 +++ BeforeFloat.java 2001/11/09 22:02:34 1.3 @@ -1,5 +1,5 @@ /* - * $Id: BeforeFloat.java,v 1.2 2001/10/26 09:26:59 keiron Exp $ + *