Thread: [FOray-commit] SF.net SVN: foray: [9556] trunk/foray (Page 13)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-05-21 21:52:10
|
Revision: 9556
http://svn.sourceforge.net/foray/?rev=9556&view=rev
Author: victormote
Date: 2007-05-21 14:51:41 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Conform to axsl changes removing method parameters in favor of FoContext information.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-05-21 20:38:29 UTC (rev 9555)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-05-21 21:51:41 UTC (rev 9556)
@@ -334,8 +334,7 @@
* @return The minimum length of this leader, in millipoints.
*/
public int traitLeaderLengthMin() {
- final int percentBase = this.ancestorArea().crIPD();
- return this.traitGeneratedBy().traitLeaderLengthMin(this, percentBase);
+ return this.traitGeneratedBy().traitLeaderLengthMin(this);
}
/**
@@ -343,8 +342,7 @@
* @return The optimum length of this leader, in millipoints.
*/
public int traitLeaderLengthOpt() {
- final int percentBase = this.ancestorArea().crIPD();
- return this.traitGeneratedBy().traitLeaderLengthOpt(this, percentBase);
+ return this.traitGeneratedBy().traitLeaderLengthOpt(this);
}
/**
@@ -352,8 +350,7 @@
* @return The maximum length of this leader, in millipoints.
*/
public int traitLeaderLengthMax() {
- final int percentBase = this.ancestorArea().crIPD();
- return this.traitGeneratedBy().traitLeaderLengthMax(this, percentBase);
+ return this.traitGeneratedBy().traitLeaderLengthMax(this);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-05-21 20:38:29 UTC (rev 9555)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-05-21 21:51:41 UTC (rev 9556)
@@ -1532,28 +1532,22 @@
/**
* {@inheritDoc}
*/
- public int traitLeaderLengthMin(final FoContext context,
- final int parentAreaContentIPD) {
- return propertyList.getLeaderLengthMinimum(this, context,
- parentAreaContentIPD);
+ public int traitLeaderLengthMin(final FoContext context) {
+ return propertyList.getLeaderLengthMinimum(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitLeaderLengthOpt(final FoContext context,
- final int parentAreaContentIPD) {
- return propertyList.getLeaderLengthOptimum(this, context,
- parentAreaContentIPD);
+ public int traitLeaderLengthOpt(final FoContext context) {
+ return propertyList.getLeaderLengthOptimum(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitLeaderLengthMax(final FoContext context,
- final int parentAreaContentIPD) {
- return propertyList.getLeaderLengthMaximum(this, context,
- parentAreaContentIPD);
+ public int traitLeaderLengthMax(final FoContext context) {
+ return propertyList.getLeaderLengthMaximum(this, context);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-05-21 20:38:29 UTC (rev 9555)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-05-21 21:51:41 UTC (rev 9556)
@@ -2235,19 +2235,16 @@
* @param context An object that knows how to resolve FO Tree context
* issues.
* @param subProperty The length-range specifier.
- * @param parentAreaContentIPD The IPD of the parent Area content-rectangle.
* @return The leader-length property.
*/
private int getLeaderLength(final FObj fobj, final FoContext context,
- final LengthRange subProperty, final int parentAreaContentIPD) {
+ final LengthRange subProperty) {
final LeaderLength property = (LeaderLength) getProperty(
FoProperty.LEADER_LENGTH);
if (property != null) {
- return property.getValue(context, subProperty, fobj,
- parentAreaContentIPD);
+ return property.getValue(context, subProperty, fobj);
}
- return LeaderLength.getValueNoInstance(subProperty, fobj,
- parentAreaContentIPD);
+ return LeaderLength.getValueNoInstance(subProperty, fobj, context);
}
/**
@@ -2255,15 +2252,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentIPD The IPD of the content-rectangle of the
- * parent area, per XSL-FO 1.0, Sec. 7.21.4. This value is needed for
- * computations that are percent-based, but is ignored for others.
* @return The leader-length.minimum property.
*/
- public int getLeaderLengthMinimum(final FObj fobj, final FoContext context,
- final int parentAreaContentIPD) {
- return getLeaderLength(fobj, context, LengthRange.MINIMUM,
- parentAreaContentIPD);
+ public int getLeaderLengthMinimum(final FObj fobj,
+ final FoContext context) {
+ return getLeaderLength(fobj, context, LengthRange.MINIMUM);
}
/**
@@ -2271,15 +2264,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentIPD The IPD of the content-rectangle of the
- * parent area, per XSL-FO 1.0, Sec. 7.21.4. This value is needed for
- * computations that are percent-based, but is ignored for others.
* @return The leader-length.optimum property.
*/
- public int getLeaderLengthOptimum(final FObj fobj, final FoContext context,
- final int parentAreaContentIPD) {
- return getLeaderLength(fobj, context, LengthRange.OPTIMUM,
- parentAreaContentIPD);
+ public int getLeaderLengthOptimum(final FObj fobj,
+ final FoContext context) {
+ return getLeaderLength(fobj, context, LengthRange.OPTIMUM);
}
/**
@@ -2287,15 +2276,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentIPD The IPD of the content-rectangle of the
- * parent area, per XSL-FO 1.0, Sec. 7.21.4. This value is needed for
- * computations that are percent-based, but is ignored for others.
* @return The leader-length.maximum property.
*/
- public int getLeaderLengthMaximum(final FObj fobj, final FoContext context,
- final int parentAreaContentIPD) {
- return getLeaderLength(fobj, context, LengthRange.MAXIMUM,
- parentAreaContentIPD);
+ public int getLeaderLengthMaximum(final FObj fobj,
+ final FoContext context) {
+ return getLeaderLength(fobj, context, LengthRange.MAXIMUM);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-05-21 20:38:29 UTC (rev 9555)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-05-21 21:51:41 UTC (rev 9556)
@@ -49,6 +49,22 @@
*/
public class Leader extends FObjMixed implements org.axsl.foR.fo.Leader {
+ /** A constant IPD value used for testing submitted property values. */
+ private static final int TEST_IPD = 1000000;
+
+ /** A static context useful for testing submitted property values. */
+ private static final FoContext TEST_CONTEXT = new FoContext() {
+ public GraftingPoint getGraftingPoint() {
+ return null;
+ }
+ public int ipdNearestBlockLevel() {
+ return 0;
+ }
+ public int bpdNearestBlockLevel() {
+ return TEST_IPD;
+ }
+ };
+
/** The parent of this node. */
private FObj parent;
@@ -79,15 +95,13 @@
/* Using a null context here is OK, because we are not computing
* a length to be used anywhere, only testing the relative values of
* the min, max, and optimum. */
- final FoContext context = null;
- final int testConstant = 1000000;
- if (traitLeaderLengthMin(context, testConstant)
- > traitLeaderLengthOpt(context, testConstant)) {
+ if (traitLeaderLengthMin(TEST_CONTEXT)
+ > traitLeaderLengthOpt(TEST_CONTEXT)) {
throwException("leader-length.minimum may not exceed "
+ "leader-length.optimum");
}
- if (traitLeaderLengthOpt(context, testConstant)
- > traitLeaderLengthMax(context, testConstant)) {
+ if (traitLeaderLengthOpt(TEST_CONTEXT)
+ > traitLeaderLengthMax(TEST_CONTEXT)) {
throwException("leader-length.optimum may not exceed "
+ "leader-length.maximum");
}
@@ -159,7 +173,7 @@
* {@inheritDoc}
*/
public int inlineSizeOptimum(final int lineLength) {
- return traitLeaderLengthOpt(null, lineLength);
+ return traitLeaderLengthOpt(null);
}
/**
@@ -167,14 +181,14 @@
*/
public int inlineSizeOptimum(final FoContext context,
final int lineLength) {
- return traitLeaderLengthOpt(context, lineLength);
+ return traitLeaderLengthOpt(context);
}
/**
* {@inheritDoc}
*/
public int inlineSizeMinimum(final int lineLength) {
- return traitLeaderLengthMin(null, lineLength);
+ return traitLeaderLengthMin(null);
}
/**
@@ -182,14 +196,14 @@
*/
public int inlineSizeMinimum(final FoContext context,
final int lineLength) {
- return traitLeaderLengthMin(context, lineLength);
+ return traitLeaderLengthMin(context);
}
/**
* {@inheritDoc}
*/
public int inlineSizeMaximum(final int lineLength) {
- return traitLeaderLengthMax(null, lineLength);
+ return traitLeaderLengthMax(null);
}
/**
@@ -197,7 +211,7 @@
*/
public int inlineSizeMaximum(final FoContext context,
final int lineLength) {
- return traitLeaderLengthMax(context, lineLength);
+ return traitLeaderLengthMax(context);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java 2007-05-21 20:38:29 UTC (rev 9555)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java 2007-05-21 21:51:41 UTC (rev 9556)
@@ -137,12 +137,10 @@
* @param subProperty The length-range for the property needed (MINIMUM,
* OPTIMUM, OR MAXIMUM).
* @param fobj The FO for which this value is needed.
- * @param parentAreaCRIPD The inline-progression-dimension of the parent
- * area's content-rectangle.
* @return The value of this property.
*/
public int getValue(final FoContext context, final LengthRange subProperty,
- final FObj fobj, final int parentAreaCRIPD) {
+ final FObj fobj) {
if (value() instanceof DtLengthRange) {
final DtLengthRange lengthRange = (DtLengthRange) value();
ExprNumeric length = null;
@@ -167,17 +165,16 @@
return 0;
}
return length.getLength(fobj.traitFontSize(context),
- parentAreaCRIPD);
+ context.ipdNearestBlockLevel());
}
if (value() instanceof FoPropertyKeyword) {
final FoPropertyKeyword kw = (FoPropertyKeyword) value();
if (kw.getValue() == FoValue.INHERIT) {
return getValueInherited(context, subProperty, fobj,
- parentAreaCRIPD);
+ context.ipdNearestBlockLevel());
}
}
- // This is an error that should already have been caught.
- return getValueNoInstance(subProperty, fobj, parentAreaCRIPD);
+ throw this.unexpectedRetrieval();
}
/**
@@ -196,19 +193,16 @@
final FObj effectiveParent = fobj.effectiveParent(context);
switch (subProperty) {
case MINIMUM: {
- return effectiveParent.traitLeaderLengthMin(context,
- parentAreaCRIPD);
+ return effectiveParent.traitLeaderLengthMin(context);
}
case OPTIMUM: {
- return effectiveParent.traitLeaderLengthOpt(context,
- parentAreaCRIPD);
+ return effectiveParent.traitLeaderLengthOpt(context);
}
case MAXIMUM: {
- return effectiveParent.traitLeaderLengthMax(context,
- parentAreaCRIPD);
+ return effectiveParent.traitLeaderLengthMax(context);
}
}
- return getValueNoInstance(subProperty, fobj, parentAreaCRIPD);
+ return getValueNoInstance(subProperty, fobj, context);
}
/**
@@ -216,12 +210,11 @@
* @param subProperty The length-range for the property needed (MINIMUM,
* OPTIMUM, OR MAXIMUM).
* @param fobj The FO for which this value is needed.
- * @param parentAreaCRIPD The inline-progression-dimension of the parent
- * area's content-rectangle.
+ * @param foContext An object that knows how to resolve FO context issues.
* @return The initial value for this property.
*/
public static int getValueNoInstance(final LengthRange subProperty,
- final FObj fobj, final int parentAreaCRIPD) {
+ final FObj fobj, final FoContext foContext) {
// These values are the initial values from the spec
switch (subProperty) {
case MINIMUM: {
@@ -231,7 +224,7 @@
return DEFAULT_OPTIMUM_VALUE;
}
case MAXIMUM: {
- return parentAreaCRIPD;
+ return foContext.ipdNearestBlockLevel();
}
}
return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-21 22:45:08
|
Revision: 9557
http://svn.sourceforge.net/foray/?rev=9557&view=rev
Author: victormote
Date: 2007-05-21 15:44:59 -0700 (Mon, 21 May 2007)
Log Message:
-----------
ConforConform to axsl changes removing method parameters in favor of FoContext information.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractRelativeDimension.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -1114,25 +1114,11 @@
}
/**
- * Returns the BPD of the nearest ancestor generated by a block-level FO.
- * @return The BPD of the nearest ancestor generated by a block-level FO,
- * or -1 if not such ancestor exists.
- */
- private int nearestBaseBPD() {
- int nearestBPD = -1;
- final Area nearest = this.ancestorGeneratedByBlockLevelFO();
- if (nearest != null) {
- nearestBPD = nearest.crBPD();
- }
- return nearestBPD;
- }
-
- /**
* Return the minimum BP dimension for this area.
* @return The minimum BP dimension for this area, or -1 for "auto".
*/
public int traitBPDimensionMin() {
- return traitGeneratedBy().traitBPDimensionMin(this, nearestBaseBPD());
+ return traitGeneratedBy().traitBPDimensionMin(this);
}
/**
@@ -1140,7 +1126,7 @@
* @return The optimum BP dimension for this area, or -1 for "auto".
*/
public int traitBPDimensionOpt() {
- return traitGeneratedBy().traitBPDimensionOpt(this, nearestBaseBPD());
+ return traitGeneratedBy().traitBPDimensionOpt(this);
}
/**
@@ -1148,29 +1134,15 @@
* @return The maximim BP dimension for this area, or -1 for "auto".
*/
public int traitBPDimensionMax() {
- return traitGeneratedBy().traitBPDimensionMax(this, nearestBaseBPD());
+ return traitGeneratedBy().traitBPDimensionMax(this);
}
/**
- * Returns the IPD of the nearest ancestor generated by a block-level FO.
- * @return The IPD of the nearest ancestor generated by a block-level FO,
- * or -1 if not such ancestor exists.
- */
- private int nearestBaseIPD() {
- int nearestIPD = -1;
- final Area nearest = this.ancestorGeneratedByBlockLevelFO();
- if (nearest != null) {
- nearestIPD = nearest.crIPD();
- }
- return nearestIPD;
- }
-
- /**
* Return the minimum IP dimension for this area.
* @return The minimum IP dimension for this area, or -1 for "auto".
*/
public int traitIPDimensionMin() {
- return traitGeneratedBy().traitIPDimensionMin(this, nearestBaseIPD());
+ return traitGeneratedBy().traitIPDimensionMin(this);
}
/**
@@ -1178,7 +1150,7 @@
* @return The optimum IP dimension for this area, or -1 for "auto".
*/
public int traitIPDimensionOpt() {
- return traitGeneratedBy().traitIPDimensionOpt(this, nearestBaseIPD());
+ return traitGeneratedBy().traitIPDimensionOpt(this);
}
/**
@@ -1186,7 +1158,7 @@
* @return The maximim IP dimension for this area, or -1 for "auto".
*/
public int traitIPDimensionMax() {
- return traitGeneratedBy().traitIPDimensionMax(this, nearestBaseIPD());
+ return traitGeneratedBy().traitIPDimensionMax(this);
}
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -595,7 +595,7 @@
* {@inheritDoc}
*/
public int ipdNearestBlockLevel() {
- final Area area = this.nearestGeneratedByBlockLevelFO();
+ final Area area = this.ancestorGeneratedByBlockLevelFO();
return area.crIPD();
}
@@ -603,7 +603,7 @@
* {@inheritDoc}
*/
public int bpdNearestBlockLevel() {
- final Area area = this.nearestGeneratedByBlockLevelFO();
+ final Area area = this.ancestorGeneratedByBlockLevelFO();
return area.crBPD();
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -144,8 +144,7 @@
*/
public int viewportBPD() {
final ExternalGraphic eg = this.traitGeneratedBy();
- final Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO();
- return eg.viewportBPD(this, parentForDimensions.crBPD());
+ return eg.viewportBPD(this);
}
/**
@@ -154,8 +153,7 @@
*/
public int viewportIPD() {
final ExternalGraphic eg = this.traitGeneratedBy();
- final Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO();
- return eg.viewportIPD(this, parentForDimensions.crIPD());
+ return eg.viewportIPD(this);
}
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -146,8 +146,7 @@
*/
public int viewportBPD() {
final InstreamForeignObject ifo = this.traitGeneratedBy();
- final Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO();
- return ifo.viewportBPD(this, parentForDimensions.crBPD());
+ return ifo.viewportBPD(this);
}
/**
@@ -156,8 +155,7 @@
*/
public int viewportIPD() {
final InstreamForeignObject ifo = this.traitGeneratedBy();
- final Area parentForDimensions = this.ancestorGeneratedByBlockLevelFO();
- return ifo.viewportIPD(this, parentForDimensions.crIPD());
+ return ifo.viewportIPD(this);
}
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -249,8 +249,7 @@
/* For "auto" column width, start by just making all of the columns
* equal. */
final Table table = this.traitGeneratedBy();
- final int tableWidth = table.traitIPDimensionOpt(this,
- this.crIPD());
+ final int tableWidth = table.traitIPDimensionOpt(this);
if (this.resolvedColumnWidth.length < 1) {
/* TODO: Consider throwing an exception here. */
return 0;
@@ -273,7 +272,7 @@
*/
private int calcFixedColumnWidths(final int maxAllocationIPD) {
final Table node = this.traitGeneratedBy();
- final int tableWidth = node.traitIPDimensionOpt(this, maxAllocationIPD);
+ final int tableWidth = node.traitIPDimensionOpt(this);
/* Accumulates the total table units used in columns in this table. */
double totalTableUnits = 0.0;
/*
@@ -315,33 +314,33 @@
int maxIPD;
final boolean bHasProportionalUnits = totalTableUnits > 0.0;
- if (node.traitIPDimensionMax(this, maxAllocationIPD) >= 0) {
- maxIPD = node.traitIPDimensionMax(this, maxAllocationIPD);
+ if (node.traitIPDimensionMax(this) >= 0) {
+ maxIPD = node.traitIPDimensionMax(this);
} else {
maxIPD = maxAllocationIPD;
}
- if (node.traitIPDimensionOpt(this, maxAllocationIPD) < 0) {
+ if (node.traitIPDimensionOpt(this) < 0) {
optIPD = -1;
} else {
/* TODO: This looks like a bug. Should be getIPDOptimum()? */
- optIPD = node.traitIPDimensionMax(this, maxAllocationIPD);
+ optIPD = node.traitIPDimensionMax(this);
}
- if (node.traitIPDimensionMin(this, maxAllocationIPD) < 0) {
+ if (node.traitIPDimensionMin(this) < 0) {
minIPD = -1;
} else {
- minIPD = node.traitIPDimensionMin(this, maxAllocationIPD);
+ minIPD = node.traitIPDimensionMin(this);
}
if (bHasProportionalUnits && optIPD < 0) {
if (minIPD > 0) {
- if (node.traitIPDimensionMax(this, maxAllocationIPD) >= 0) {
+ if (node.traitIPDimensionMax(this) >= 0) {
optIPD = (minIPD + maxIPD) / 2;
} else {
optIPD = minIPD;
}
- } else if (node.traitIPDimensionMax(this, maxAllocationIPD) >= 0) {
+ } else if (node.traitIPDimensionMax(this) >= 0) {
optIPD = maxIPD;
} else {
getLogger().error("At least one of minimum, optimum, or "
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -88,8 +88,7 @@
newRow.registerWithLinkage(retrieveMarker);
/* Non-standard initialization of progression dimension. */
- int startingPD = generatedBy.traitBPDimensionMin(newRow,
- parentArea.crBPD());
+ int startingPD = generatedBy.traitBPDimensionMin(newRow);
if (startingPD == Fo.DIMENSION_AUTO) {
startingPD = 0;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -1670,55 +1670,43 @@
/**
* {@inheritDoc}
*/
- public int traitBPDimensionMax(final FoContext context,
- final int parentAreaContentBPD) {
- return propertyList.traitBPDimensionMax(this, context,
- parentAreaContentBPD);
+ public int traitBPDimensionMax(final FoContext context) {
+ return propertyList.traitBPDimensionMax(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitBPDimensionOpt(final FoContext context,
- final int parentAreaContentBPD) {
- return propertyList.traitBPDimensionOpt(this, context,
- parentAreaContentBPD);
+ public int traitBPDimensionOpt(final FoContext context) {
+ return propertyList.traitBPDimensionOpt(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitBPDimensionMin(final FoContext context,
- final int parentAreaContentBPD) {
- return propertyList.traitBPDimensionMin(this, context,
- parentAreaContentBPD);
+ public int traitBPDimensionMin(final FoContext context) {
+ return propertyList.traitBPDimensionMin(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitIPDimensionMax(final FoContext context,
- final int parentAreaContentIPD) {
- return propertyList.traitIPDimensionMax(this, context,
- parentAreaContentIPD);
+ public int traitIPDimensionMax(final FoContext context) {
+ return propertyList.traitIPDimensionMax(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitIPDimensionOpt(final FoContext context,
- final int parentAreaContentIPD) {
- return propertyList.traitIPDimensionOpt(this, context,
- parentAreaContentIPD);
+ public int traitIPDimensionOpt(final FoContext context) {
+ return propertyList.traitIPDimensionOpt(this, context);
}
/**
* {@inheritDoc}
*/
- public int traitIPDimensionMin(final FoContext context,
- final int parentAreaContentIPD) {
- return propertyList.traitIPDimensionMin(this, context,
- parentAreaContentIPD);
+ public int traitIPDimensionMin(final FoContext context) {
+ return propertyList.traitIPDimensionMin(this, context);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObjScaled.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -69,12 +69,10 @@
/**
* {@inheritDoc}
*/
- public int viewportIPD(final FoContext context,
- final int parentAreaContentIPD) {
+ public int viewportIPD(final FoContext context) {
/* See XSL-FO Standard 1.0, Section 6.6.5 and 6.6.6, Subsection
* "Constraints", first paragraph, for explanation of logic. */
- final int viewportIPD = this.traitIPDimensionOpt(context,
- parentAreaContentIPD);
+ final int viewportIPD = this.traitIPDimensionOpt(context);
if (viewportIPD != FObj.DIMENSION_AUTO) {
return viewportIPD;
}
@@ -118,8 +116,7 @@
*/
private boolean isViewportIpdDependent(final FoContext context,
final int parentAreaContentIPD) {
- final int viewportIPD = this.traitIPDimensionOpt(context,
- parentAreaContentIPD);
+ final int viewportIPD = this.traitIPDimensionOpt(context);
if (viewportIPD != FObj.DIMENSION_AUTO) {
return false;
}
@@ -132,12 +129,10 @@
/**
* {@inheritDoc}
*/
- public int viewportBPD(final FoContext context,
- final int parentAreaContentBPD) {
+ public int viewportBPD(final FoContext context) {
/* See XSL-FO Standard 1.0, Section 6.6.5 and 6.6.6, Subsection
* "Constraints", first paragraph, for explanation of logic. */
- final int viewportBPD = this.traitBPDimensionOpt(context,
- parentAreaContentBPD);
+ final int viewportBPD = this.traitBPDimensionOpt(context);
if (viewportBPD != FObj.DIMENSION_AUTO) {
return viewportBPD;
}
@@ -164,10 +159,11 @@
* dimensions of this viewport.
* We punt by returning the smaller of 1) the intrinsic height,
* and 2) the height of the parent area. */
- return Math.min(intrinsicHeight, parentAreaContentBPD);
+ return Math.min(intrinsicHeight,
+ context.bpdNearestBlockLevel());
} else {
/* We can use the other dimension to compute this one. */
- final int viewportIpd = this.viewportIPD(context, 0);
+ final int viewportIpd = this.viewportIPD(context);
final int intrinsicWidth = this.intrinsicContentWidth(context);
final float heightToWidth = (float) intrinsicHeight
/ (float) intrinsicWidth;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -2421,16 +2421,11 @@
* issues.
* @param relativeAxis The axis for which the dimension is needed.
* @param subProperty The length-range specifier.
- * @param parentAreaCRDimension Per XSL-FO Std 1.0, Section 7.14.5, "the
- * corresponding dimension of the closest area ancestor that was generated
- * by a block-level formatting object." Used only when the
- * relative dimension is expressed as a percentage.
* @return The computed value, or {@link FObj#DIMENSION_AUTO} for
* "auto".
*/
private int getRelativeDimension(final FObj fobj, final FoContext context,
- final RelativeAxis relativeAxis, final LengthRange subProperty,
- final int parentAreaCRDimension) {
+ final RelativeAxis relativeAxis, final LengthRange subProperty) {
AbstractRelativeDimension property = null;
if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
property = (AbstractRelativeDimension)
@@ -2440,8 +2435,7 @@
getProperty(FoProperty.INLINE_PROGRESSION_DIMENSION);
}
if (property != null) {
- return property.getValue(context, relativeAxis, subProperty, fobj,
- parentAreaCRDimension);
+ return property.getValue(context, relativeAxis, subProperty, fobj);
}
/* Try the corresponding absolute dimension. */
@@ -2487,8 +2481,7 @@
}
}
if (absDimProperty != null) {
- return absDimProperty.getValue(context,
- relativeAxis, fobj, parentAreaCRDimension);
+ return absDimProperty.getValue(context, relativeAxis, fobj);
}
return AbstractRelativeDimension.getValueNoInstance();
}
@@ -2498,15 +2491,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentBPD The BPD of the content-rectangle of the
- * parent area.
* @return The block-progression-dimension.minimum property.
*/
- public int traitBPDimensionMin(final FObj fobj, final FoContext context,
- final int parentAreaContentBPD) {
+ public int traitBPDimensionMin(final FObj fobj, final FoContext context) {
return getRelativeDimension(fobj, context,
- RelativeAxis.BLOCK_PROGRESSION, LengthRange.MINIMUM,
- parentAreaContentBPD);
+ RelativeAxis.BLOCK_PROGRESSION, LengthRange.MINIMUM);
}
/**
@@ -2514,15 +2503,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentBPD The BPD of the content-rectangle of the
- * parent area.
* @return The block-progression-dimension.optimum property.
*/
- public int traitBPDimensionOpt(final FObj fobj, final FoContext context,
- final int parentAreaContentBPD) {
+ public int traitBPDimensionOpt(final FObj fobj, final FoContext context) {
return getRelativeDimension(fobj, context,
- RelativeAxis.BLOCK_PROGRESSION, LengthRange.OPTIMUM,
- parentAreaContentBPD);
+ RelativeAxis.BLOCK_PROGRESSION, LengthRange.OPTIMUM);
}
/**
@@ -2530,15 +2515,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentBPD The BPD of the content-rectangle of the
- * parent area.
* @return The block-progression-dimension.maximum property.
*/
- public int traitBPDimensionMax(final FObj fobj, final FoContext context,
- final int parentAreaContentBPD) {
+ public int traitBPDimensionMax(final FObj fobj, final FoContext context) {
return getRelativeDimension(fobj, context,
- RelativeAxis.BLOCK_PROGRESSION, LengthRange.MAXIMUM,
- parentAreaContentBPD);
+ RelativeAxis.BLOCK_PROGRESSION, LengthRange.MAXIMUM);
}
/**
@@ -2546,15 +2527,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentIPD The IPD of the content-rectangle of the
- * parent area.
* @return The inline-progression-dimension.minimum property.
*/
- public int traitIPDimensionMin(final FObj fobj, final FoContext context,
- final int parentAreaContentIPD) {
+ public int traitIPDimensionMin(final FObj fobj, final FoContext context) {
return getRelativeDimension(fobj, context,
- RelativeAxis.INLINE_PROGRESSION, LengthRange.MINIMUM,
- parentAreaContentIPD);
+ RelativeAxis.INLINE_PROGRESSION, LengthRange.MINIMUM);
}
/**
@@ -2562,15 +2539,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentIPD The IPD of the content-rectangle of the
- * parent area.
* @return The inline-progression-dimension.optimum property.
*/
- public int traitIPDimensionOpt(final FObj fobj, final FoContext context,
- final int parentAreaContentIPD) {
+ public int traitIPDimensionOpt(final FObj fobj, final FoContext context) {
return getRelativeDimension(fobj, context,
- RelativeAxis.INLINE_PROGRESSION, LengthRange.OPTIMUM,
- parentAreaContentIPD);
+ RelativeAxis.INLINE_PROGRESSION, LengthRange.OPTIMUM);
}
/**
@@ -2578,15 +2551,11 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param parentAreaContentIPD The IPD of the content-rectangle of the
- * parent area.
* @return The inline-progression-dimension.maximum property.
*/
- public int traitIPDimensionMax(final FObj fobj, final FoContext context,
- final int parentAreaContentIPD) {
+ public int traitIPDimensionMax(final FObj fobj, final FoContext context) {
return getRelativeDimension(fobj, context,
- RelativeAxis.INLINE_PROGRESSION, LengthRange.MAXIMUM,
- parentAreaContentIPD);
+ RelativeAxis.INLINE_PROGRESSION, LengthRange.MAXIMUM);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ExternalGraphic.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -240,7 +240,7 @@
*/
public int inlineSizeOptimum(final FoContext context,
final int lineLength) {
- return this.viewportIPD(context, lineLength);
+ return this.viewportIPD(context);
}
/**
@@ -255,7 +255,7 @@
*/
public int inlineSizeMinimum(final FoContext context,
final int lineLength) {
- return this.viewportIPD(context, lineLength);
+ return this.viewportIPD(context);
}
/**
@@ -270,7 +270,7 @@
*/
public int inlineSizeMaximum(final FoContext context,
final int lineLength) {
- return this.viewportIPD(context, lineLength);
+ return this.viewportIPD(context);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/InstreamForeignObject.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -200,7 +200,7 @@
*/
public int inlineSizeOptimum(final FoContext context,
final int lineLength) {
- return this.viewportIPD(context, lineLength);
+ return this.viewportIPD(context);
}
/**
@@ -215,7 +215,7 @@
*/
public int inlineSizeMinimum(final FoContext context,
final int lineLength) {
- return this.viewportIPD(context, lineLength);
+ return this.viewportIPD(context);
}
/**
@@ -230,7 +230,7 @@
*/
public int inlineSizeMaximum(final FoContext context,
final int lineLength) {
- return this.viewportIPD(context, lineLength);
+ return this.viewportIPD(context);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java 2007-05-21 21:51:41 UTC (rev 9556)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractAbsoluteDimension.java 2007-05-21 22:44:59 UTC (rev 9557)
@@ -114,15 +114,18 @@
* @param context An object that knows how to resolve FO context issues.
* @param relativeAxis The axis for which the dimension is needed.
* @param fobj The FO for which this value is needed.
- * @param dimAncestorGenByBlockLevelFO The size, in millipoints, of the
- * ancestor area generated by a block-level FO.
* @return The value of this property.
*/
public int getValue(final FoContext context,
final RelativeAxis relativeAxis,
- final FObj fobj, final int dimAncestorGenByBlockLevelFO) {
+ final FObj fobj) {
if (value() instanceof DtPercentage) {
- final int base = dimAncestorGenByBlockLevelFO;
+ int base = 0;
+ if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
+ base = context.bpdNearestBlockLevel();
+ } else {
+ base = context.ipdNearestBlockLevel();
+ }
final DtPercentage percentageDT = (DtPercentage) value();
final float percentage = percentageDT.getValue();
return Math.round(percentage * base
@@ -141,8 +144,7 @@
return FObj.DIMENSION_AUTO;
}
case INHERIT: {
- return getInheritValue(context, relativeAxis, fobj,
- dimAncestorGenByBlockLevelFO);
+ return getInheritValue(context, relativeAxis, fobj);
}
}
}
@@ -168,40 +170,35 @@
* @param context An object that knows how to resolve FO context issues.
* @param relativeAxis The axis for which the dimension is needed.
* @param fobj The FO for which this value is needed.
- * @param dimAncestorGenByBlockLevelFO The size, in millipoints, of the
- * ancestor area generated by a block-level FO.
* @return The inherited value of this property.
*/
private int getInheritValue(final FoContext context,
- final RelativeAxis relativeAxis, final FObj fobj,
- final int dimAncestorGenByBlockLevelFO) {
+ final RelativeAxis relativeAxis, final FObj fobj) {
switch (getPropertyType()) {
case HEIGHT:
case WIDTH: {
if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
return fobj.effectiveParent(context).traitBPDimensionOpt(
- context, dimAncestorGenByBlockLevelFO);
+ context);
}
return fobj.effectiveParent(context).traitIPDimensionOpt(
- context, dimAncestorGenByBlockLevelFO);
+ context);
}
case MAX_HEIGHT:
case MAX_WIDTH: {
if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
return fobj.effectiveParent(context).traitBPDimensionMax(
- context, dimAncestorGenByBlockLevelFO);
+ context);
}
- return fobj.effectiveParent(context).traitIPDimensionMax(context,
- dimAncestorGenByBlockLevelFO);
+ return fobj.effectiveParent(context).traitIPDimensionMax(context);
}
case MIN_HEIGHT:
case MIN_WIDTH: {
if (relativeAxis == RelativeAxis.BLOCK_PROGRESSION) {
return fobj.effectiveParent(context).traitBPDimensionMin(
- context, dimAncestorGenByBlockLevelFO);
+ context);
}
- return fobj.effectiveParent(context).traitIPDimensionMin(context,
- dimAncestorGenByBlockLevelFO);
+ return fobj.effectiveParent(context).traitIPDimensionMin(context);
}
...
[truncated message content] |
|
From: <vic...@us...> - 2007-05-21 23:43:00
|
Revision: 9558
http://svn.sourceforge.net/foray/?rev=9558&view=rev
Author: victormote
Date: 2007-05-21 16:43:01 -0700 (Mon, 21 May 2007)
Log Message:
-----------
Move testing of leader length minimum <= optimum <= maximum rule from Fo Tree to Area Tree.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2007-05-21 22:44:59 UTC (rev 9557)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2007-05-21 23:43:01 UTC (rev 9558)
@@ -29,6 +29,7 @@
package org.foray.area;
import org.axsl.areaR.RenderVisitor;
+import org.axsl.areaW.AreaWException;
import org.axsl.foR.FoText;
import org.axsl.foR.fo.ExternalGraphic;
import org.axsl.foR.fo.GraftingPoint;
@@ -150,7 +151,7 @@
*/
public LeaderArea makeLeaderArea(
final Leader leader, final int ipd,
- final GraftingPoint graftingPoint) {
+ final GraftingPoint graftingPoint) throws AreaWException {
final LeaderArea newLeaderArea = LeaderArea.makeLeaderArea(leader, this,
graftingPoint, ipd);
this.children.add(newLeaderArea);
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-05-21 22:44:59 UTC (rev 9557)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-05-21 23:43:01 UTC (rev 9558)
@@ -29,6 +29,7 @@
package org.foray.area;
import org.axsl.areaR.RenderVisitor;
+import org.axsl.areaW.AreaWException;
import org.axsl.common.value.LeaderAlignment;
import org.axsl.common.value.LeaderPattern;
import org.axsl.common.value.RuleStyle;
@@ -104,16 +105,31 @@
* area.
* @param initialProgressionDimension The initial size, in millipoints,
* of this Area.
+ * @throws AreaWException If the minimum length is greater than the optimum
+ * length, or if the optimum length is greater than the maximum length.
*/
private static void initLeaderArea(final LeaderArea newLeaderArea,
final Leader generatedBy, final GraftingPoint graftingPoint,
- final int initialProgressionDimension) {
+ final int initialProgressionDimension) throws AreaWException {
newLeaderArea.generatedBy = newLeaderArea.linkage(generatedBy,
graftingPoint);
newLeaderArea.registerWithLinkage(graftingPoint);
newLeaderArea.initializeProgressionDimension();
newLeaderArea.initializeAnteriorSpace();
newLeaderArea.init(initialProgressionDimension);
+
+ /* This cannot be fully validated during FO parsing because percentages
+ * cannot be resolved entirely there, so we validate it here. */
+ if (newLeaderArea.traitLeaderLengthMin()
+ > newLeaderArea.traitLeaderLengthOpt()) {
+ throw new AreaWException("leader-length.minimum may not exceed "
+ + "leader-length.optimum");
+ }
+ if (newLeaderArea.traitLeaderLengthOpt()
+ > newLeaderArea.traitLeaderLengthMax()) {
+ throw new AreaWException("leader-length.optimum may not exceed "
+ + "leader-length.maximum");
+ }
}
/**
@@ -125,11 +141,13 @@
* @param initialProgressionDimension The initial size, in millipoints,
* of this Area.
* @return The new instance.
+ * @throws AreaWException If the minimum length is greater than the optimum
+ * length, or if the optimum length is greater than the maximum length.
*/
static LeaderArea makeLeaderArea(final Leader generatedBy,
final LineArea parentArea,
final GraftingPoint graftingPoint,
- final int initialProgressionDimension) {
+ final int initialProgressionDimension) throws AreaWException {
final LeaderArea newLeaderArea = new LeaderArea(parentArea);
LeaderArea.initLeaderArea(newLeaderArea, generatedBy, graftingPoint,
initialProgressionDimension);
@@ -145,11 +163,13 @@
* @param initialProgressionDimension The initial size, in millipoints,
* of this Area.
* @return The new instance.
+ * @throws AreaWException If the minimum length is greater than the optimum
+ * length, or if the optimum length is greater than the maximum length.
*/
static LeaderArea makeLeaderArea(final Leader generatedBy,
final AbstractInlineArea parentArea,
final GraftingPoint graftingPoint,
- final int initialProgressionDimension) {
+ final int initialProgressionDimension) throws AreaWException {
final LeaderArea newLeaderArea = new LeaderArea(parentArea);
LeaderArea.initLeaderArea(newLeaderArea, generatedBy, graftingPoint,
initialProgressionDimension);
@@ -399,7 +419,7 @@
*/
public LeaderArea makeLeaderArea(
final Leader leader, final int ipd,
- final GraftingPoint graftingPoint) {
+ final GraftingPoint graftingPoint) throws AreaWException {
final LeaderArea newLeaderArea = LeaderArea.makeLeaderArea(leader, this,
graftingPoint, ipd);
this.children.add(newLeaderArea);
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-05-21 22:44:59 UTC (rev 9557)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-05-21 23:43:01 UTC (rev 9558)
@@ -990,9 +990,8 @@
/**
* {@inheritDoc}
*/
- public LeaderArea makeLeaderArea(
- final Leader leader, final int ipd,
- final GraftingPoint graftingPoint) {
+ public LeaderArea makeLeaderArea(final Leader leader, final int ipd,
+ final GraftingPoint graftingPoint) throws AreaWException {
final LeaderArea newLeaderArea = LeaderArea.makeLeaderArea(leader, this,
graftingPoint, ipd);
this.children.add(newLeaderArea);
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-05-21 22:44:59 UTC (rev 9557)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Leader.java 2007-05-21 23:43:01 UTC (rev 9558)
@@ -49,22 +49,6 @@
*/
public class Leader extends FObjMixed implements org.axsl.foR.fo.Leader {
- /** A constant IPD value used for testing submitted property values. */
- private static final int TEST_IPD = 1000000;
-
- /** A static context useful for testing submitted property values. */
- private static final FoContext TEST_CONTEXT = new FoContext() {
- public GraftingPoint getGraftingPoint() {
- return null;
- }
- public int ipdNearestBlockLevel() {
- return 0;
- }
- public int bpdNearestBlockLevel() {
- return TEST_IPD;
- }
- };
-
/** The parent of this node. */
private FObj parent;
@@ -92,19 +76,10 @@
* {@inheritDoc}
*/
protected void validateProperties() throws FoTreeException {
- /* Using a null context here is OK, because we are not computing
- * a length to be used anywhere, only testing the relative values of
- * the min, max, and optimum. */
- if (traitLeaderLengthMin(TEST_CONTEXT)
- > traitLeaderLengthOpt(TEST_CONTEXT)) {
- throwException("leader-length.minimum may not exceed "
- + "leader-length.optimum");
- }
- if (traitLeaderLengthOpt(TEST_CONTEXT)
- > traitLeaderLengthMax(TEST_CONTEXT)) {
- throwException("leader-length.optimum may not exceed "
- + "leader-length.maximum");
- }
+ /* It is tempting, but not possible, to test that minimum <= optimum
+ * <= maximum, because of the possibility of percentages.
+ * TODO: Consider adding the above tests for the case where percentages
+ * do not exist in the actual data. */
}
/**
Modified: trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2007-05-21 22:44:59 UTC (rev 9557)
+++ trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2007-05-21 23:43:01 UTC (rev 9558)
@@ -185,7 +185,11 @@
graftingPoint);
} else if (nonTextToUse instanceof Leader) {
final Leader leader = (Leader) nonTextToUse;
- lineArea.makeLeaderArea(leader, sizeInline, graftingPoint);
+ try {
+ lineArea.makeLeaderArea(leader, sizeInline, graftingPoint);
+ } catch (final AreaWException e) {
+ throw new TextException(e);
+ }
} else if (nonTextToUse instanceof PageNumberCitation) {
final PageNumberCitation citation = (PageNumberCitation)
nonTextToUse;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-22 17:08:55
|
Revision: 9566
http://svn.sourceforge.net/foray/?rev=9566&view=rev
Author: victormote
Date: 2007-05-22 10:07:35 -0700 (Tue, 22 May 2007)
Log Message:
-----------
Conform to axsl changes converting method parameters from RetrieveMarker to GraftingPoint. Convert all layout logic to use the general GraftingPoint as well.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTablePartContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BasicLinkPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnotePL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/InlinePL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/InstreamForeignObjectPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/LeaderPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/MarkerPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/NoLayoutPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberCitationPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PageNumberPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/StaticContentPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableRowPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/WrapperPL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTablePartContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTablePartContainer.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractTablePartContainer.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -31,7 +31,7 @@
import org.axsl.areaR.BackgroundArea;
import org.axsl.areaW.AreaWException;
import org.axsl.common.value.RelativeAxis;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.TableRow;
import org.axsl.graphicR.Graphic;
@@ -68,10 +68,10 @@
* {@inheritDoc}
*/
public TableRowContainer makeTableRowContainer(final TableRow node,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final TableRowContainer newRow =
TableRowContainer.makeTableRowContainer(node, this,
- retrieveMarker);
+ graftingPoint);
this.children.add(newRow);
return newRow;
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListBlockArea.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -34,7 +34,6 @@
import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.ListItem;
-import org.axsl.foR.fo.RetrieveMarker;
import java.util.ArrayList;
import java.util.List;
@@ -89,9 +88,9 @@
* {@inheritDoc}
*/
public ListItemArea makeListItemArea(final ListItem listItem,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final ListItemArea newItemArea = ListItemArea.makeListItemArea(listItem,
- this, retrieveMarker);
+ this, graftingPoint);
this.children.add(newItemArea);
return newItemArea;
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -39,7 +39,6 @@
import org.axsl.foR.fo.ListItem;
import org.axsl.foR.fo.ListItemBody;
import org.axsl.foR.fo.ListItemLabel;
-import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.foR.fo.Table;
import java.util.ArrayList;
@@ -76,17 +75,17 @@
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
- * @param retrieveMarker The ancestor retrieve-marker, if any, for this
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
* area.
* @return The new instance.
*/
static ListItemArea makeListItemArea(final ListItem generatedBy,
final ListBlockArea parentArea,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final ListItemArea newItemArea = new ListItemArea(parentArea);
newItemArea.generatedBy = newItemArea.linkage(generatedBy,
- retrieveMarker);
- newItemArea.registerWithLinkage(retrieveMarker);
+ graftingPoint);
+ newItemArea.registerWithLinkage(graftingPoint);
newItemArea.initializeProgressionDimension();
newItemArea.initializeAnteriorSpace();
return newItemArea;
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableBodyContainer.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -30,7 +30,7 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.TableBody;
/**
@@ -46,7 +46,7 @@
/**
* Private Constructor.
* Use {@link TableRA#makeTableBodyContainer(org.axsl.foR.fo.TableBody,
- * RetrieveMarker)} to create an instance.
+ * GraftingPoint)} to create an instance.
* @param parentArea The parent area.
*/
private TableBodyContainer(final TableRA parentArea) {
@@ -57,18 +57,18 @@
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
- * @param retrieveMarker The ancestor retrieve-marker, if any, for this
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
* area.
* @return The newly-created instance.
*/
static TableBodyContainer makeTableBodyContainer(
final TableBody generatedBy,
- final TableRA parentArea, final RetrieveMarker retrieveMarker) {
+ final TableRA parentArea, final GraftingPoint graftingPoint) {
final TableBodyContainer bodyContainer = new TableBodyContainer(
parentArea);
bodyContainer.generatedBy = bodyContainer.linkage(generatedBy,
- retrieveMarker);
- bodyContainer.registerWithLinkage(retrieveMarker);
+ graftingPoint);
+ bodyContainer.registerWithLinkage(graftingPoint);
bodyContainer.initializeProgressionDimension();
bodyContainer.initializeAnteriorSpace();
return bodyContainer;
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -38,7 +38,6 @@
import org.axsl.foR.fo.BlockContainer;
import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.ListBlock;
-import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.foR.fo.Table;
import org.axsl.foR.fo.TableCell;
import org.axsl.graphicR.Graphic;
@@ -85,7 +84,7 @@
/**
* Private Constructor.
* Use {@link TableRowContainer#makeTableCellArea(TableCell,
- * RetrieveMarker)} to create a new cell instance.
+ * GraftingPoint)} to create a new cell instance.
* @param parentArea The parent area.
*/
private TableCellRA(final TableRowContainer parentArea) {
@@ -96,16 +95,16 @@
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
- * @param retrieveMarker The ancestor retrieve-marker, if any, for this
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
* area.
* @return The new instance.
*/
static TableCellRA makeTableCellRA(final TableCell generatedBy,
final TableRowContainer parentArea,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final TableCellRA newCell = new TableCellRA(parentArea);
- newCell.generatedBy = newCell.linkage(generatedBy, retrieveMarker);
- newCell.registerWithLinkage(retrieveMarker);
+ newCell.generatedBy = newCell.linkage(generatedBy, graftingPoint);
+ newCell.registerWithLinkage(graftingPoint);
/* Do not set any area dimensions here. The IPD is controlled by the
* table and columns. The BPD is controlled by the TableRowContainer,
* which get input from each cell about the BPD of its contents.*/
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableFooterContainer.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -30,7 +30,7 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.TableFooter;
/**
@@ -46,7 +46,7 @@
/**
* Private Constructor.
* Use {@link TableRA#makeTableFooterContainer(org.axsl.foR.fo.TableHeader,
- * RetrieveMarker)} to create an instance.
+ * GraftingPoint)} to create an instance.
* @param parentArea The parent area.
*/
private TableFooterContainer(final TableRA parentArea) {
@@ -57,18 +57,18 @@
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
- * @param retrieveMarker The ancestor retrieve-marker, if any, for this
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
* area.
* @return The newly-created instance.
*/
static TableFooterContainer makeTableFooterContainer(
final TableFooter generatedBy,
- final TableRA parentArea, final RetrieveMarker retrieveMarker) {
+ final TableRA parentArea, final GraftingPoint graftingPoint) {
final TableFooterContainer footerContainer = new TableFooterContainer(
parentArea);
footerContainer.generatedBy = footerContainer.linkage(generatedBy,
- retrieveMarker);
- footerContainer.registerWithLinkage(retrieveMarker);
+ graftingPoint);
+ footerContainer.registerWithLinkage(graftingPoint);
footerContainer.initializeProgressionDimension();
footerContainer.initializeAnteriorSpace();
return footerContainer;
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableHeaderContainer.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -30,7 +30,7 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.TableHeader;
/**
@@ -46,7 +46,7 @@
/**
* Private Constructor.
* Use {@link TableRA#makeTableHeaderContainer(org.axsl.foR.fo.TableHeader,
- * RetrieveMarker)} to create an instance.
+ * GraftingPoint)} to create an instance.
* @param parentArea The parent area.
*/
private TableHeaderContainer(final TableRA parentArea) {
@@ -57,18 +57,18 @@
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
- * @param retrieveMarker The ancestor retrieve-marker, if any, for this
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
* area.
* @return The newly-created instance.
*/
static TableHeaderContainer makeTableHeaderContainer(
final TableHeader generatedBy,
- final TableRA parentArea, final RetrieveMarker retrieveMarker) {
+ final TableRA parentArea, final GraftingPoint graftingPoint) {
final TableHeaderContainer headerContainer = new TableHeaderContainer(
parentArea);
headerContainer.generatedBy = headerContainer.linkage(generatedBy,
- retrieveMarker);
- headerContainer.registerWithLinkage(retrieveMarker);
+ graftingPoint);
+ headerContainer.registerWithLinkage(graftingPoint);
headerContainer.initializeProgressionDimension();
headerContainer.initializeAnteriorSpace();
return headerContainer;
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -37,7 +37,6 @@
import org.axsl.common.value.TableLayout;
import org.axsl.foR.FoContext;
import org.axsl.foR.fo.GraftingPoint;
-import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.foR.fo.Table;
import org.axsl.foR.fo.TableBody;
import org.axsl.foR.fo.TableColumn;
@@ -181,10 +180,10 @@
* {@inheritDoc}
*/
public TableBodyContainer makeTableBodyContainer(
- final TableBody tableBody, final RetrieveMarker retrieveMarker) {
+ final TableBody tableBody, final GraftingPoint graftingPoint) {
final TableBodyContainer bodyContainer
= TableBodyContainer.makeTableBodyContainer(tableBody, this,
- retrieveMarker);
+ graftingPoint);
if (this.getTableFooterContainer() == null) {
/* If there is not yet a footer area, add it to the end. */
this.children.add(bodyContainer);
@@ -202,10 +201,10 @@
*/
public TableHeaderContainer makeTableHeaderContainer(
final TableHeader tableHeader,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final TableHeaderContainer headerContainer
= TableHeaderContainer.makeTableHeaderContainer(tableHeader,
- this, retrieveMarker);
+ this, graftingPoint);
this.children.add(headerContainer);
return headerContainer;
}
@@ -215,10 +214,10 @@
*/
public TableFooterContainer makeTableFooterContainer(
final TableFooter tableFooter,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final TableFooterContainer footerContainer
= TableFooterContainer.makeTableFooterContainer(tableFooter,
- this, retrieveMarker);
+ this, graftingPoint);
this.children.add(footerContainer);
return footerContainer;
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRowContainer.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -32,7 +32,7 @@
import org.axsl.areaW.AreaWException;
import org.axsl.common.value.RelativeAxis;
import org.axsl.foR.Fo;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.TableCell;
import org.axsl.foR.fo.TableRow;
import org.axsl.graphicR.Graphic;
@@ -65,7 +65,7 @@
/**
* Private Constructor.
* Use {@link AbstractTablePartContainer#makeTableRowContainer(TableRow,
- * RetrieveMarker)} to create an instance.
+ * GraftingPoint)} to create an instance.
* @param parentArea The parent area.
*/
private TableRowContainer(final AbstractTablePartContainer parentArea) {
@@ -76,16 +76,16 @@
* Package-visible factory method.
* @param generatedBy The FO node generating this area.
* @param parentArea The parent area.
- * @param retrieveMarker The ancestor retrieve-marker, if any, for this
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
* area.
* @return The new instance.
*/
static TableRowContainer makeTableRowContainer(final TableRow generatedBy,
final AbstractTablePartContainer parentArea,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final TableRowContainer newRow = new TableRowContainer(parentArea);
- newRow.generatedBy = newRow.linkage(generatedBy, retrieveMarker);
- newRow.registerWithLinkage(retrieveMarker);
+ newRow.generatedBy = newRow.linkage(generatedBy, graftingPoint);
+ newRow.registerWithLinkage(graftingPoint);
/* Non-standard initialization of progression dimension. */
int startingPD = generatedBy.traitBPDimensionMin(newRow);
@@ -111,9 +111,9 @@
* {@inheritDoc}
*/
public TableCellRA makeTableCellArea(final TableCell node,
- final RetrieveMarker retrieveMarker) {
+ final GraftingPoint graftingPoint) {
final TableCellRA newCell = TableCellRA.makeTableCellRA(node, this,
- retrieveMarker);
+ graftingPoint);
this.children.add(newCell);
return newCell;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -34,8 +34,8 @@
import org.axsl.areaW.TableArea;
import org.axsl.foR.FoNode;
import org.axsl.foR.fo.AbstractTablePart;
+import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.Marker;
-import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.foR.fo.Table;
import org.axsl.foR.fo.TableBody;
import org.axsl.foR.fo.TableFooter;
@@ -72,7 +72,7 @@
* {@inheritDoc}
*/
public Status layout(final AreaNode areaNode,
- final RetrieveMarker retrieveMarker) throws AreaWException {
+ final GraftingPoint graftingPoint) throws AreaWException {
final AbstractTablePart node = getFONode();
final TableArea tableArea = (TableArea) areaNode;
final Table table = tableArea.traitGeneratedBy();
@@ -103,13 +103,13 @@
AbstractTablePartContainer areaContainer = null;
if (node instanceof TableBody) {
areaContainer = tableArea.makeTableBodyContainer(
- (TableBody) node, retrieveMarker);
+ (TableBody) node, graftingPoint);
} else if (node instanceof TableHeader) {
areaContainer = tableArea.makeTableHeaderContainer(
- (TableHeader) node, retrieveMarker);
+ (TableHeader) node, graftingPoint);
} else if (node instanceof TableFooter) {
areaContainer = tableArea.makeTableFooterContainer(
- (TableFooter) node, retrieveMarker);
+ (TableFooter) node, graftingPoint);
}
List<TableRow> keepWith = new ArrayList<TableRow>();
@@ -121,7 +121,7 @@
if (child instanceof Marker) {
final MarkerPL markerPL = (MarkerPL) getLayoutProxy(
(FoNode) child);
- markerPL.layout(tableArea, retrieveMarker);
+ markerPL.layout(tableArea, graftingPoint);
continue;
}
/* FOTree is normalized so that all children are TableRows. */
@@ -157,7 +157,7 @@
}
}
rowPL.setIgnoreKeepTogether(bRowStartsArea);
- Status status = rowPL.layout(areaContainer, retrieveMarker);
+ Status status = rowPL.layout(areaContainer, graftingPoint);
if (status.isIncomplete()) {
// BUG!!! don't distinguish between break-before and after!
if (status.isPageBreak()) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BasicLinkPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BasicLinkPL.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BasicLinkPL.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -31,7 +31,7 @@
import org.axsl.areaW.AreaNode;
import org.axsl.areaW.AreaWException;
import org.axsl.foR.fo.BasicLink;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
/**
* Pioneer Layout for a {@link BasicLink}.
@@ -62,8 +62,8 @@
* {@inheritDoc}
*/
public Status layout(final AreaNode areaNode,
- final RetrieveMarker retrieveMarker) throws AreaWException {
- return this.standardLayout(areaNode, retrieveMarker);
+ final GraftingPoint graftingPoint) throws AreaWException {
+ return this.standardLayout(areaNode, graftingPoint);
}
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockContainerPL.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -34,7 +34,7 @@
import org.axsl.areaW.BlockContentFactory;
import org.axsl.foR.FoNode;
import org.axsl.foR.fo.BlockContainer;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
/**
* Pioneer Layout for {@link BlockContainer}.
@@ -59,7 +59,7 @@
* {@inheritDoc}
*/
public Status layout(final AreaNode areaNode,
- final RetrieveMarker retrieveMarker) throws AreaWException {
+ final GraftingPoint graftingPoint) throws AreaWException {
if (! (areaNode instanceof BlockContentFactory)) {
throw new AreaWException("Area \"" + areaNode.getAreaName()
+ "\" cannot contain a BlockContentArea.");
@@ -71,12 +71,12 @@
}
final BlockContainerRA blockContainer = bcArea.makeBlockContainerArea(
- this.node, retrieveMarker);
+ this.node, graftingPoint);
for (int i = this.getProgress(); i < this.node.getChildCount(); i++) {
final FoNode fo = this.node.getChildAt(i);
final FObjPL fobjPL = (FObjPL) getLayoutProxy(fo);
- fobjPL.layout(blockContainer, retrieveMarker);
+ fobjPL.layout(blockContainer, graftingPoint);
}
return Status.OK;
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -35,7 +35,7 @@
import org.axsl.areaW.NormalBlockArea;
import org.axsl.foR.FoNode;
import org.axsl.foR.fo.Block;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
/**
* Pioneer Layout for {@link Block}.
@@ -89,7 +89,7 @@
* {@inheritDoc}
*/
public Status layout(final AreaNode areaNode,
- final RetrieveMarker retrieveMarker) throws AreaWException {
+ final GraftingPoint graftingPoint) throws AreaWException {
if (! (areaNode instanceof BlockContentFactory)) {
throw new AreaWException("Area \"" + areaNode.getAreaName()
+ "\" cannot contain a NormalBlockArea.");
@@ -133,7 +133,7 @@
setProgress(0);
}
- blockArea = bcArea.makeNormalBlockArea(node, retrieveMarker);
+ blockArea = bcArea.makeNormalBlockArea(node, graftingPoint);
for (int i = getProgress(); i < node.getChildCount(); i++) {
final FoNode fo = node.getChildAt(i);
@@ -142,7 +142,7 @@
Status status = null;
boolean doneProcessingItem = false;
while (! doneProcessingItem) {
- status = nodePL.layout(blockArea, retrieveMarker);
+ status = nodePL.layout(blockArea, graftingPoint);
if (! status.isIncomplete()) {
doneProcessingItem = true;
break;
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/CharacterPL.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -32,7 +32,7 @@
import org.axsl.areaW.AreaWException;
import org.axsl.foR.fo.Character;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
/**
* Concrete class for FObj instances that do not need layout.
@@ -56,8 +56,8 @@
* {@inheritDoc}
*/
public Status layout(final AreaNode areaNode,
- final RetrieveMarker retrieveMarker) throws AreaWException {
- return layoutChildren(areaNode, retrieveMarker);
+ final GraftingPoint graftingPoint) throws AreaWException {
+ return layoutChildren(areaNode, graftingPoint);
}
/**
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2007-05-22 16:42:02 UTC (rev 9565)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2007-05-22 17:07:35 UTC (rev 9566)
@@ -33,7 +33,7 @@
import org.axsl.areaW.TableArea;
import org.axsl.foR.FoNode;
import org.axsl.foR.extension.ContinuedLabel;
-import org.axsl.foR.fo.RetrieveMarker;
+import org.axsl.foR.fo.GraftingPoint;
/**
* Pioneer Layout for {@link ContinuedLabel}.
@@ -64,7 +64,7 @@
* was placed in the current parent area.
*/
public Status layout(final AreaNode areaNode,
- final RetrieveMarker retrieveMarker) throws AreaWException {
+ final GraftingPoint graftingPoint) throws AreaWException {
if (getProgress() == FONodePL.START) {
setProgress(0);
}
@@ -76,7 +76,7 @@
for (int i = getProgress(); i < numChildren; i++) {
final FoNode fo = this.label.getChildren().get(i);
final Status status = getLayoutProxy(fo).layout(areaNode,
- retrieveMarker);
+ graftingPoint);
if (status.isIncomplete()) {
setProgress(i);
return status;
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ExternalGraphicPL.java
===================================================================...
[truncated message content] |
|
From: <vic...@us...> - 2007-05-22 23:55:45
|
Revision: 9571
http://svn.sourceforge.net/foray/?rev=9571&view=rev
Author: victormote
Date: 2007-05-22 16:55:41 -0700 (Tue, 22 May 2007)
Log Message:
-----------
Upgrade the dependency on Apache Commons Logging to version 1.1.
Modified Paths:
--------------
trunk/foray/doc/web/app/using/release.html
trunk/foray/foray-app/.classpath
trunk/foray/foray-app/scripts/build.xml
trunk/foray/foray-areatree/.classpath
trunk/foray/foray-areatree/scripts/build.xml
trunk/foray/foray-common/.classpath
trunk/foray/foray-common/scripts/build.xml
trunk/foray/foray-core/.classpath
trunk/foray/foray-core/scripts/build.xml
trunk/foray/foray-font/.classpath
trunk/foray/foray-font/scripts/build.xml
trunk/foray/foray-fotree/.classpath
trunk/foray/foray-fotree/scripts/build.xml
trunk/foray/foray-graphic/.classpath
trunk/foray/foray-graphic/scripts/build.xml
trunk/foray/foray-hyphen-r/.classpath
trunk/foray/foray-hyphen-r/scripts/build.xml
trunk/foray/foray-layout/.classpath
trunk/foray/foray-layout/scripts/build.xml
trunk/foray/foray-mif/.classpath
trunk/foray/foray-mif/scripts/build.xml
trunk/foray/foray-output/.classpath
trunk/foray/foray-output/scripts/build.xml
trunk/foray/foray-pdf/.classpath
trunk/foray/foray-pdf/scripts/build.xml
trunk/foray/foray-pioneer/.classpath
trunk/foray/foray-pioneer/scripts/build.xml
trunk/foray/foray-ps/.classpath
trunk/foray/foray-ps/scripts/build.xml
trunk/foray/foray-render/.classpath
trunk/foray/foray-render/scripts/build.xml
trunk/foray/foray-text/.classpath
trunk/foray/foray-text/scripts/build.xml
trunk/foray/lib/readme.txt
Added Paths:
-----------
trunk/foray/lib/commons-logging-1.1.jar
trunk/foray/lib-build/commons-logging/
trunk/foray/lib-build/commons-logging/commons-logging-1.1-src.zip
Removed Paths:
-------------
trunk/foray/lib/commons-logging.jar
Modified: trunk/foray/doc/web/app/using/release.html
===================================================================
--- trunk/foray/doc/web/app/using/release.html 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/doc/web/app/using/release.html 2007-05-22 23:55:41 UTC (rev 9571)
@@ -41,6 +41,7 @@
support. These services are now provided natively through open-source
libraries packaged with FOray.</li>
<li>Tables now work much better (not perfectly).</li>
+ <li>Lists now work much better (not perfectly).</li>
<li>Added support for the axsl:metadata extension. See
<a href="/app/features/extensions.html#axsl-extensions">aXSL
Extensions</a>.</li>
@@ -79,6 +80,8 @@
This makes storage of the property type redundant, and it has been removed,
which should reduce the memory footprint.
Also the PropertyList no longer keeps a reference to the parent FObj.</li>
+ <li>The Apache Commons Logging dependency has been upgraded to version
+ 1.1.</li>
</ul>
<h2><a name="0_2">Release 0.2</a></h2>
Modified: trunk/foray/foray-app/.classpath
===================================================================
--- trunk/foray/foray-app/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-app/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -33,12 +33,12 @@
<classpathentry combineaccessrules="false" kind="src" path="/FOrayPS"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.2.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.2-src.zip"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
<classpathentry kind="lib" path="/FOray Lib/foray-hyphen-r-0.3-rsrc.jar"/>
<classpathentry kind="lib" path="/FOray Lib/resolver.jar"/>
<classpathentry kind="lib" path="/FOray Lib/servlet-2.2.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xalan-2.4.1.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xml-apis-1.3.02.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-app/scripts/build.xml
===================================================================
--- trunk/foray/foray-app/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-app/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,12 +22,12 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="xml-apis*.jar"/>
+ <include name="axsl*.jar"/>
+ <include name="commons-io-*.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="servlet*.jar"/>
- <include name="axsl*.jar"/>
<include name="xercesImpl*.jar"/>
- <include name="commons-logging.jar"/>
- <include name="commons-io-1.2.jar"/>
+ <include name="xml-apis*.jar"/>
</fileset>
<fileset dir="${build.lib.dir}">
<include name="junit/*.jar"/>
Modified: trunk/foray/foray-areatree/.classpath
===================================================================
--- trunk/foray/foray-areatree/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-areatree/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -13,6 +13,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/axslArea-W"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-areatree/scripts/build.xml
===================================================================
--- trunk/foray/foray-areatree/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-areatree/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -25,7 +25,7 @@
<include name="xml-apis.jar"/>
<include name="batik.jar"/>
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-common/.classpath
===================================================================
--- trunk/foray/foray-common/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-common/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -5,6 +5,6 @@
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.2.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.2-src.zip"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-common/scripts/build.xml
===================================================================
--- trunk/foray/foray-common/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-common/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,13 +22,10 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="batik*.jar"/>
- <include name="xml-apis.jar"/>
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
- <include name="commons-io-1.2.jar"/>
- <include name="avalon-framework*.jar"/>
- <include name="icu*.jar"/>
+ <include name="batik*.jar"/>
+ <include name="commons-logging-*.jar"/>
+ <include name="commons-io-*.jar"/>
</fileset>
</path>
Modified: trunk/foray/foray-core/.classpath
===================================================================
--- trunk/foray/foray-core/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-core/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -13,8 +13,8 @@
<classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslCommon"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslHyphen-R"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xml-apis-1.3.02.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-core/scripts/build.xml
===================================================================
--- trunk/foray/foray-core/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-core/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -23,7 +23,7 @@
</fileset>
<fileset dir="${lib.dir}">
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="xml-apis-1.3.02.jar"/>
<include name="xercesImpl-2.7.1.jar"/>
</fileset>
Modified: trunk/foray/foray-font/.classpath
===================================================================
--- trunk/foray/foray-font/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-font/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -12,8 +12,8 @@
<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.2.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.2-src.zip"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
<classpathentry kind="lib" path="/FOray Lib/foray-font-0.3-rsrc.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-font/scripts/build.xml
===================================================================
--- trunk/foray/foray-font/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-font/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -27,10 +27,9 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="avalon-framework*.jar"/>
<include name="xercesImpl*.jar"/>
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="xml-apis*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-pretty/build/ant">
Modified: trunk/foray/foray-fotree/.classpath
===================================================================
--- trunk/foray/foray-fotree/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-fotree/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -11,6 +11,6 @@
<classpathentry kind="src" path="/axslText"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-fotree/scripts/build.xml
===================================================================
--- trunk/foray/foray-fotree/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-fotree/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -28,7 +28,7 @@
<include name="batik*.jar"/>
<include name="xml-apis.jar"/>
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-graphic/.classpath
===================================================================
--- trunk/foray/foray-graphic/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-graphic/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -10,6 +10,6 @@
<classpathentry kind="lib" path="/FOray Lib/xmlgraphics-commons-1.1.jar" sourcepath="/FOray Lib-Build/xmlgraphics-commons/xmlgraphics-commons-1.1-src.zip"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-io-1.2.jar" sourcepath="/FOray Lib-Build/commons-io/commons-io-1.2-src.zip"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-graphic/scripts/build.xml
===================================================================
--- trunk/foray/foray-graphic/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-graphic/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,10 +22,10 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
+ <include name="axsl*.jar"/>
<include name="batik*.jar"/>
<include name="commons-io-*.jar"/>
- <include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="xmlgraphics-commons-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
Modified: trunk/foray/foray-hyphen-r/.classpath
===================================================================
--- trunk/foray/foray-hyphen-r/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-hyphen-r/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -9,6 +9,6 @@
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
<classpathentry kind="lib" path="/FOray Lib/xercesImpl-2.7.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslCommon"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-hyphen-r/scripts/build.xml
===================================================================
--- trunk/foray/foray-hyphen-r/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-hyphen-r/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -27,11 +27,10 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="avalon-framework*.jar"/>
+ <include name="axsl*.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="xml-apis*.jar"/>
<include name="xerces*.jar"/>
- <include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-layout/.classpath
===================================================================
--- trunk/foray/foray-layout/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-layout/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -10,6 +10,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/axslGraphic-R"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslCommon"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslLayout"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-layout/scripts/build.xml
===================================================================
--- trunk/foray/foray-layout/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-layout/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,7 +22,7 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-mif/.classpath
===================================================================
--- trunk/foray/foray-mif/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-mif/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -4,6 +4,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry combineaccessrules="false" kind="src" path="/FOrayCommon"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-mif/scripts/build.xml
===================================================================
--- trunk/foray/foray-mif/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-mif/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,9 +22,9 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
+ <include name="axsl*.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="xml-apis.jar"/>
- <include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-output/.classpath
===================================================================
--- trunk/foray/foray-output/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-output/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -9,6 +9,6 @@
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry combineaccessrules="false" kind="src" path="/FOrayMIF"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-output/scripts/build.xml
===================================================================
--- trunk/foray/foray-output/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-output/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -23,7 +23,7 @@
</fileset>
<fileset dir="${lib.dir}">
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-pdf/.classpath
===================================================================
--- trunk/foray/foray-pdf/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-pdf/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -10,6 +10,6 @@
<classpathentry kind="src" path="/FOrayPS"/>
<classpathentry kind="src" path="/axslPDF-W"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-pdf/scripts/build.xml
===================================================================
--- trunk/foray/foray-pdf/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-pdf/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -27,7 +27,7 @@
<fileset dir="${lib.dir}">
<include name="axsl*.jar"/>
<include name="batik*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-pioneer/.classpath
===================================================================
--- trunk/foray/foray-pioneer/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-pioneer/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -12,6 +12,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/FOrayLayout"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslLayout"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-pioneer/scripts/build.xml
===================================================================
--- trunk/foray/foray-pioneer/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-pioneer/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,10 +22,10 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
+ <include name="axsl*.jar"/>
<include name="batik*.jar"/>
+ <include name="commons-logging-*.jar"/>
<include name="xml-apis.jar"/>
- <include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-ps/.classpath
===================================================================
--- trunk/foray/foray-ps/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-ps/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -7,6 +7,6 @@
<classpathentry kind="src" path="/axslPS-R"/>
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-ps/scripts/build.xml
===================================================================
--- trunk/foray/foray-ps/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-ps/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -26,7 +26,7 @@
</fileset>
<fileset dir="${lib.dir}">
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-render/.classpath
===================================================================
--- trunk/foray/foray-render/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-render/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -16,6 +16,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/axslOutput"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
<classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-render/scripts/build.xml
===================================================================
--- trunk/foray/foray-render/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-render/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -30,9 +30,9 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
+ <include name="axsl*.jar"/>
<include name="batik.jar"/>
- <include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Modified: trunk/foray/foray-text/.classpath
===================================================================
--- trunk/foray/foray-text/.classpath 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-text/.classpath 2007-05-22 23:55:41 UTC (rev 9571)
@@ -8,6 +8,6 @@
<classpathentry kind="src" path="/FOrayCommon"/>
<classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslHyphen-R"/>
- <classpathentry kind="lib" path="/FOray Lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-text/scripts/build.xml
===================================================================
--- trunk/foray/foray-text/scripts/build.xml 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/foray-text/scripts/build.xml 2007-05-22 23:55:41 UTC (rev 9571)
@@ -22,11 +22,10 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="avalon-framework*.jar"/>
- <include name="xml-apis*.jar"/>
- <include name="xerces*.jar"/>
<include name="axsl*.jar"/>
- <include name="commons-logging.jar"/>
+ <include name="commons-logging-*.jar"/>
+ <include name="xerces*.jar"/>
+ <include name="xml-apis*.jar"/>
</fileset>
<fileset dir="${foray.sandbox}/foray-common/build/ant">
<include name="*.jar"/>
Added: trunk/foray/lib/commons-logging-1.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib/commons-logging-1.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/foray/lib/commons-logging.jar
===================================================================
(Binary files differ)
Modified: trunk/foray/lib/readme.txt
===================================================================
--- trunk/foray/lib/readme.txt 2007-05-22 22:28:44 UTC (rev 9570)
+++ trunk/foray/lib/readme.txt 2007-05-22 23:55:41 UTC (rev 9571)
@@ -2,8 +2,8 @@
There is a separate lib-build directory that contains libraries not needed at
runtime, but needed for building and/or testing FOray.
-aXSL
-----
+axsl-*.jar
+----------
The API used by FOray to glue its various modules together.
www.axsl.org
@@ -13,6 +13,17 @@
The svg library from Batik at xml.apache.org
+commons-io-*.jar
+----------------
+The Apache Commons I/O library.
+
+
+commons-logging-*.jar
+---------------------
+The Apache Commons Logging library.
+Last download: http://jakarta.apache.org/commons/logging/
+
+
resolver.jar
------------
Classes implementing EntityResolver (for handling Oasis catalogs, etc.)
Added: trunk/foray/lib-build/commons-logging/commons-logging-1.1-src.zip
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib-build/commons-logging/commons-logging-1.1-src.zip
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-23 01:17:22
|
Revision: 9574
http://svn.sourceforge.net/foray/?rev=9574&view=rev
Author: victormote
Date: 2007-05-22 18:17:24 -0700 (Tue, 22 May 2007)
Log Message:
-----------
Improved handling of children and underlying text for the page-number-* objects.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitationLast.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2007-05-23 00:39:55 UTC (rev 9573)
+++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2007-05-23 01:17:24 UTC (rev 9574)
@@ -295,7 +295,8 @@
builder.append(style.toString() + ", ");
builder.append(weight.toString() + ", ");
builder.append(variant.toString() + ", ");
- builder.append(stretch.toString() + ".");
+ builder.append(stretch.toString() + ", ");
+ builder.append("U+" + Integer.toHexString(codePoint).toUpperCase());
this.getLogger().warn("Suitable font not found for: "
+ builder.toString());
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-05-23 00:39:55 UTC (rev 9573)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-05-23 01:17:24 UTC (rev 9574)
@@ -110,12 +110,24 @@
import org.axsl.text.line.LineText;
import java.awt.Color;
+import java.util.Collections;
+import java.util.List;
/**
* Base class for formatting objects.
*/
public abstract class FObj extends FONode implements org.axsl.foR.Fo {
+ /** A static empty and immutable list of children, suitable for return by
+ * objects that have no children. */
+ protected static final List<FONode> EMPTY_CHILD_LIST =
+ Collections.emptyList();
+
+ /** Static array containing one space, to be used for obtaining a font
+ * for the page-citation-* objects. */
+ protected static final char[] PAGE_CITATION_TEXT_SEGMENT =
+ new char[] { ' ' };
+
/** The property list for this object. */
private PropertyList propertyList;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java 2007-05-23 00:39:55 UTC (rev 9573)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumber.java 2007-05-23 01:17:24 UTC (rev 9574)
@@ -39,7 +39,6 @@
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.GraftingPoint;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -54,9 +53,6 @@
/** The parent of this node. */
private FObj parent;
- /** The children of this object. */
- private List<FONode> children = new ArrayList<FONode>();
-
/**
* Constructor.
* @param parent The parent FObj.
@@ -219,7 +215,7 @@
* {@inheritDoc}
*/
public List<FONode> getChildren() {
- return children;
+ return EMPTY_CHILD_LIST;
}
/**
@@ -229,4 +225,13 @@
this.getChildren().add(child);
}
+ /**
+ * {@inheritDoc}
+ * Overrides the superclass because this class has no children but
+ * encapsulates its underlying text.
+ */
+ public char[] firstTextSegment() {
+ return PAGE_CITATION_TEXT_SEGMENT;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java 2007-05-23 00:39:55 UTC (rev 9573)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitation.java 2007-05-23 01:17:24 UTC (rev 9574)
@@ -39,7 +39,6 @@
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.GraftingPoint;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -56,9 +55,6 @@
/** The parent of this node. */
private FObj parent;
- /** The children of this object. */
- private List<FONode> children = new ArrayList<FONode>();
-
/**
* Constructor.
* @param parent The parent FObj.
@@ -231,7 +227,7 @@
* {@inheritDoc}
*/
public List<FONode> getChildren() {
- return children;
+ return EMPTY_CHILD_LIST;
}
/**
@@ -241,4 +237,13 @@
this.getChildren().add(child);
}
+ /**
+ * {@inheritDoc}
+ * Overrides the superclass because this class has no children but
+ * encapsulates its underlying text.
+ */
+ public char[] firstTextSegment() {
+ return PAGE_CITATION_TEXT_SEGMENT;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitationLast.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitationLast.java 2007-05-23 00:39:55 UTC (rev 9573)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/PageNumberCitationLast.java 2007-05-23 01:17:24 UTC (rev 9574)
@@ -133,7 +133,7 @@
* {@inheritDoc}
*/
public List<FONode> getChildren() {
- return null;
+ return EMPTY_CHILD_LIST;
}
/**
@@ -145,4 +145,13 @@
return;
}
+ /**
+ * {@inheritDoc}
+ * Overrides the superclass because this class has no children but
+ * encapsulates its underlying text.
+ */
+ public char[] firstTextSegment() {
+ return PAGE_CITATION_TEXT_SEGMENT;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-23 02:34:31
|
Revision: 9575
http://svn.sourceforge.net/foray/?rev=9575&view=rev
Author: victormote
Date: 2007-05-22 19:34:29 -0700 (Tue, 22 May 2007)
Log Message:
-----------
Improvements to font selection by testing the font only against printable characters.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java
Added: trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java 2007-05-23 02:34:29 UTC (rev 9575)
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common;
+
+import java.util.Arrays;
+
+/**
+ * Utility class for various Unicode-related character computations.
+ */
+public final class UnicodeChar {
+
+ /**
+ * Sorted array of other non-printable characters, which can be searched
+ * using binary techniques.
+ */
+ private static final int[] OTHER_NONPRINTABLE = new int[] {
+ /* TODO: This list is almost certainly very incomplete. */
+ '\u200B',
+ };
+
+ /**
+ * Private Constructor. This class is a utility class, and should never be
+ * instantiated.
+ */
+ private UnicodeChar() { }
+
+ /**
+ * Finds the first printable Unicode code point in a given array of chars.
+ * "Printable" for this purpose is defined as a code point that would
+ * require a glyph.
+ * @param inputChars The array of chars to be checked.
+ * @return The first printable Unicode code point in the array, or
+ * {@link WKConstants#INVALID_UNICODE_CHARACTER} if there is no printable
+ * code point.
+ */
+ public static int firstPrintable(final char[] inputChars) {
+ final int returnChar = WKConstants.INVALID_UNICODE_CHARACTER;
+ if (inputChars == null) {
+ return returnChar;
+ }
+ for (int i = 0; i < inputChars.length; i++) {
+ final char c = inputChars[i];
+ final int codePoint = Character.codePointAt(inputChars, i);
+ if (Character.isHighSurrogate(c)) {
+ /* Skip the next character as we have already eaten it. */
+ i++;
+ }
+ if (isPrintable(codePoint)) {
+ return codePoint;
+ }
+ }
+ return returnChar;
+ }
+
+ /**
+ * Indicates whether a given Unicode code point is printable.
+ * "Printable" for this purpose is defined as a code point that would
+ * require a glyph.
+ * @param codePoint The Unicode code point to be tested.
+ * @return True iff the given code point is printable.
+ */
+ public static boolean isPrintable(final int codePoint) {
+ if (! Character.isValidCodePoint(codePoint)) {
+ throw new IllegalStateException("Test for \"printable\" requires a "
+ + "valid Unicode code point.");
+ }
+ /* For efficiency, try these in the order of expected frequency. */
+ if (Character.isLetterOrDigit(codePoint)) {
+ return true;
+ }
+ if (Character.isSpaceChar(codePoint)) {
+ return false;
+ }
+ if (Character.isISOControl(codePoint)) {
+ return false;
+ }
+ if (Character.isWhitespace(codePoint)) {
+ return false;
+ }
+ final int index = Arrays.binarySearch(OTHER_NONPRINTABLE, codePoint);
+ if (index > -1) {
+ /* The item was found in the array. */
+ return false;
+ }
+ return true;
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-05-23 01:17:24 UTC (rev 9574)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-05-23 02:34:29 UTC (rev 9575)
@@ -28,6 +28,7 @@
package org.foray.fotree;
+import org.foray.common.UnicodeChar;
import org.foray.common.WKConstants;
import org.foray.fotree.fo.FoProperty;
import org.foray.fotree.fo.FoValue;
@@ -318,9 +319,13 @@
}
try {
final char[] firstTextSegment = fobj.firstTextSegment();
- char firstChar = WKConstants.INVALID_UNICODE_CHARACTER;
- if (firstTextSegment != null && firstTextSegment.length > 0) {
- firstChar = firstTextSegment[0];
+ int firstChar = UnicodeChar.firstPrintable(firstTextSegment);
+ if (firstChar == WKConstants.INVALID_UNICODE_CHARACTER) {
+ /* There are no printable characters in the first text segment,
+ * so what we do here doesn't matter much. We set the first
+ * char to space so that virtually any font should pass the
+ * test. */
+ firstChar = ' ';
}
final FontConsumer fontConsumer = fobj.getFontConsumer();
this.resolvedFont = fontConsumer.selectFontXSL(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-30 15:06:56
|
Revision: 9662
http://svn.sourceforge.net/foray/?rev=9662&view=rev
Author: victormote
Date: 2007-05-30 08:06:57 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Fix bug in computation of the optimum table width.
Modified Paths:
--------------
trunk/foray/doc/web/app/using/release.html
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
Modified: trunk/foray/doc/web/app/using/release.html
===================================================================
--- trunk/foray/doc/web/app/using/release.html 2007-05-30 01:34:35 UTC (rev 9661)
+++ trunk/foray/doc/web/app/using/release.html 2007-05-30 15:06:57 UTC (rev 9662)
@@ -45,11 +45,12 @@
<li>Added support for the axsl:metadata extension. See
<a href="/app/features/extensions.html#axsl-extensions">aXSL
Extensions</a>.</li>
- <li>Added parse-time support for the objects and properties added in XSL-FO
- 1.1.
- These are not necessarily validated or used, but their existence should not
- cause processing errors.
+ <li>Added parsing and validation support for the objects and properties added
+ in XSL-FO 1.1.
+ These are not necessarily used by other FOray modules, but their existence
+ should not cause processing errors.
(The bookmark-related objects are fully supported).</li>
+ <li>Significant improvements to expressions in property values.</li>
</ul>
<h3>Unreleased changes of interest to Developers</h3>
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-05-30 01:34:35 UTC (rev 9661)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-05-30 15:06:57 UTC (rev 9662)
@@ -277,31 +277,26 @@
* @return The new width of the table.
*/
private int calcFixedColumnWidths(final int maxAllocationIPD) {
- final Table node = this.traitGeneratedBy();
- final int tableWidth = node.traitIPDimensionOpt(this);
+ final Table table = this.traitGeneratedBy();
+ final int tableWidth = table.traitIPDimensionOpt(this);
/* Accumulates the total table units used in columns in this table. */
double totalTableUnits = 0.0;
- /*
- * Accumulates the total width, in millipoints(?), of the columns that
- * have a fixed width.
- */
+ /* Accumulates the total width, in millipoints, of the columns that
+ * have a fixed width. */
int totalFixedWidth = 0;
/* Minimum number of proportional units. */
double tuMin = Double.MAX_VALUE;
- /*
- * Loop through the columns and total the fixed widths and proportional
- * units for each one.
- */
- for (int i = 0; i < node.getTableColumns().length; i++) {
- final TableColumn column = node.getTableColumns()[i];
+ /* Loop through the columns and total the fixed widths and proportional
+ * units for each one. */
+ for (int i = 0; i < table.getTableColumns().length; i++) {
+ final TableColumn column = table.getTableColumns()[i];
if (column == null) {
getLogger().warn("No table-column specification for column " +
(i + 1) + ".");
} else {
final double tu = column.traitColumnWidthTableUnits();
- /* Keep track of minimum number of proportional units
- * in any column which has only proportional units.
- */
+ /* Keep track of minimum number of proportional units in any
+ * column which has only proportional units. */
if (tu > 0 && tu < tuMin
&& column.traitColumnWidth(this,
tableWidth) == 0) {
@@ -320,33 +315,32 @@
int maxIPD;
final boolean bHasProportionalUnits = totalTableUnits > 0.0;
- if (node.traitIPDimensionMax(this) >= 0) {
- maxIPD = node.traitIPDimensionMax(this);
+ if (table.traitIPDimensionMax(this) >= 0) {
+ maxIPD = table.traitIPDimensionMax(this);
} else {
maxIPD = maxAllocationIPD;
}
- if (node.traitIPDimensionOpt(this) < 0) {
+ if (table.traitIPDimensionOpt(this) < 0) {
optIPD = -1;
} else {
- /* TODO: This looks like a bug. Should be getIPDOptimum()? */
- optIPD = node.traitIPDimensionMax(this);
+ optIPD = table.traitIPDimensionOpt(this);
}
- if (node.traitIPDimensionMin(this) < 0) {
+ if (table.traitIPDimensionMin(this) < 0) {
minIPD = -1;
} else {
- minIPD = node.traitIPDimensionMin(this);
+ minIPD = table.traitIPDimensionMin(this);
}
if (bHasProportionalUnits && optIPD < 0) {
if (minIPD > 0) {
- if (node.traitIPDimensionMax(this) >= 0) {
+ if (table.traitIPDimensionMax(this) >= 0) {
optIPD = (minIPD + maxIPD) / 2;
} else {
optIPD = minIPD;
}
- } else if (node.traitIPDimensionMax(this) >= 0) {
+ } else if (table.traitIPDimensionMax(this) >= 0) {
optIPD = maxIPD;
} else {
getLogger().error("At least one of minimum, optimum, or "
@@ -399,8 +393,8 @@
}
// Now distribute the extra units onto each column and set offsets
int columnOffset = 0;
- for (int i = 0; i < node.getTableColumns().length; i++) {
- final TableColumn column = node.getTableColumns()[i];
+ for (int i = 0; i < table.getTableColumns().length; i++) {
+ final TableColumn column = table.getTableColumns()[i];
if (column != null) {
//Compute the width of the column
int colWidth = -1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-30 16:35:24
|
Revision: 9664
http://svn.sourceforge.net/foray/?rev=9664&view=rev
Author: victormote
Date: 2007-05-30 09:35:17 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Get non-text line content inside the appropriate containing area.
Modified Paths:
--------------
trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java
Modified: trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java
===================================================================
--- trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2007-05-30 15:47:44 UTC (rev 9663)
+++ trunk/foray/foray-layout/src/java/org/foray/layout/LayoutStrategy.java 2007-05-30 16:35:17 UTC (rev 9664)
@@ -175,29 +175,34 @@
graftingPoint = foLineNonText.getGraftingPoint();
nonTextToUse = foLineNonText.getWrapped();
}
+
+ LineContentFactory factory = lineArea;
+ if (this.areaStack.size() > 0) {
+ factory = this.areaStack.peek();
+ }
if (nonTextToUse instanceof InstreamForeignObject) {
final InstreamForeignObject ifo = (InstreamForeignObject)
nonTextToUse;
- lineArea.makeForeignObjectArea(ifo, sizeInline, graftingPoint);
+ factory.makeForeignObjectArea(ifo, sizeInline, graftingPoint);
} else if (nonTextToUse instanceof ExternalGraphic) {
final ExternalGraphic graphic = (ExternalGraphic) nonTextToUse;
- lineArea.makeExternalGraphicArea(graphic, sizeInline,
+ factory.makeExternalGraphicArea(graphic, sizeInline,
graftingPoint);
} else if (nonTextToUse instanceof Leader) {
final Leader leader = (Leader) nonTextToUse;
try {
- lineArea.makeLeaderArea(leader, sizeInline, graftingPoint);
+ factory.makeLeaderArea(leader, sizeInline, graftingPoint);
} catch (final AreaWException e) {
throw new TextException(e);
}
} else if (nonTextToUse instanceof PageNumberCitation) {
final PageNumberCitation citation = (PageNumberCitation)
nonTextToUse;
- lineArea.makePageNumberCitationArea(citation, sizeInline,
+ factory.makePageNumberCitationArea(citation, sizeInline,
graftingPoint);
} else if (nonTextToUse instanceof PageNumber) {
final PageNumber pageNumber = (PageNumber) nonTextToUse;
- lineArea.makePageNumberArea(pageNumber, sizeInline, graftingPoint);
+ factory.makePageNumberArea(pageNumber, sizeInline, graftingPoint);
}
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java 2007-05-30 15:47:44 UTC (rev 9663)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java 2007-05-30 16:35:17 UTC (rev 9664)
@@ -78,7 +78,7 @@
* Adds text from this text item to an Area.
* @param lineText The line text item containing the text.
* @param areaNode The parent areaNode into which the text should be placed.
- * @param inputStart The index to the first char in lineText that should
+ * @param start The index to the first char in lineText that should
* be added.
* @param graftingPoint The ancestor grafting point, if any.
* @return The index into the text char array that indicates the next array
@@ -88,9 +88,8 @@
* @throws AreaWException For errors during layout.
*/
private int addText(final FoLineText lineText, final AreaNode areaNode,
- final int inputStart, final GraftingPoint graftingPoint)
+ final int start, final GraftingPoint graftingPoint)
throws AreaWException {
- final int start = inputStart;
final int end = lineText.inlineText().length;
final LineArea la = this.activeLineArea(areaNode);
if (la == null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-30 20:30:34
|
Revision: 9668
http://svn.sourceforge.net/foray/?rev=9668&view=rev
Author: victormote
Date: 2007-05-30 13:30:23 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Add and use a post-order node iterator to find the descendant leader instances.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-05-30 19:14:25 UTC (rev 9667)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-05-30 20:30:23 UTC (rev 9668)
@@ -28,6 +28,8 @@
package org.foray.area;
+import org.foray.common.OrderedTreeNode;
+
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
import org.axsl.common.value.AbsoluteAxis;
@@ -53,6 +55,7 @@
import org.axsl.fontR.Font;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
@@ -213,8 +216,10 @@
if (leaderSpaceAvailable == 0) {
return;
}
- for (int i = 0; i < getChildren().size(); i++) {
- final Object object = getChildren().get(i);
+ final Iterator<? extends OrderedTreeNode> iterator =
+ this.postOrderDescendantIterator();
+ while (iterator.hasNext()) {
+ final OrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
boolean prorating = false;
@@ -239,8 +244,10 @@
private int computeLeaderCapacity(final int unusedSpace) {
// First, compute how much capacity the leaders have.
int leaderSpaceAvailable = 0;
- for (int i = 0; i < getChildren().size(); i++) {
- final Object object = getChildren().get(i);
+ final Iterator<? extends OrderedTreeNode> iterator =
+ this.postOrderDescendantIterator();
+ while (iterator.hasNext()) {
+ final OrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
if (unusedSpace > 0) {
Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-05-30 19:14:25 UTC (rev 9667)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-05-30 20:30:23 UTC (rev 9668)
@@ -30,17 +30,19 @@
import java.util.Collections;
import java.util.Enumeration;
+import java.util.Iterator;
import java.util.List;
+import java.util.NoSuchElementException;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
/**
- * An implementation of the TreeNode interface that provides methods for various
- * traversal needs.
+ * An implementation of the {@link TreeNode} interface that provides methods for
+ * various traversal needs.
*
- * <p>Consideration was given to using
- * {@link DefaultMutableTreeNode} instead of creating this class.
+ * <p>Consideration was given to using {@link DefaultMutableTreeNode} instead of
+ * creating this class.
* However, the data portion of that class was not deemed suitable.</p>
*/
public abstract class OrderedTreeNode
@@ -60,6 +62,15 @@
}
/**
+ * Returns an iterator that will iterate the descendant nodes of this node
+ * in post-traversal (depth-first) order.
+ * @return A post-traversal iterator of this node's descendants.
+ */
+ public Iterator<? extends OrderedTreeNode> postOrderDescendantIterator() {
+ return new PostOrderDescendantIterator(this);
+ }
+
+ /**
* Return the List of this node's children.
* @return The List of this node's children.
*/
@@ -223,6 +234,24 @@
}
/**
+ * Returns the next node in the tree relative to the current node, in
+ * post-order traversal order. This is also known as depth-first order.
+ * @return The next post-order node, or null if there is none.
+ */
+ public OrderedTreeNode nextPostOrderNode() {
+ /* All of the children would come before this. */
+ /* If there are siblings, they or their descendants come next. */
+ final OrderedTreeNode nextSibling = this.getNextSibling();
+ if (nextSibling != null) {
+ return nextSibling.getFirstLeaf();
+ }
+ /* If there are no siblings, then the parent's children are all
+ * processed, and the parent is the next node. If that happens to be
+ * null, then we are done, and null is what should be returned. */
+ return this.getParent();
+ }
+
+ /**
* {@inheritDoc}
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
@@ -412,4 +441,74 @@
return levels;
}
+ /**
+ * A post-order iterator over the descendants of a given node.
+ */
+ public final class PostOrderDescendantIterator
+ implements java.util.Iterator<OrderedTreeNode> {
+
+ /** The root node whose descendants are being iterated. */
+ private OrderedTreeNode root;
+
+ /** The next post-order node to be returned. */
+ private OrderedTreeNode nextPostOrderNode;
+
+ /**
+ * Private constructor.
+ * @param root The node whose descendants should be iterated by this
+ * iterator.
+ */
+ private PostOrderDescendantIterator(final OrderedTreeNode root) {
+ this.root = root;
+ if (root.getChildCount() < 1) {
+ this.nextPostOrderNode = null;
+ } else {
+ this.nextPostOrderNode =
+ this.root.getFirstChild().getFirstLeaf();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasNext() {
+ return this.nextPostOrderNode != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public OrderedTreeNode next() {
+ if (this.nextPostOrderNode == null) {
+ throw new NoSuchElementException("This iterator has no more "
+ + "nodes.");
+ }
+ final OrderedTreeNode returnNode = this.nextPostOrderNode;
+ this.setNextNode();
+ return returnNode;
+ }
+
+ /**
+ * Finds and records the next node to be returned by the iterator.
+ */
+ private void setNextNode() {
+ final OrderedTreeNode provisionalNextNode =
+ this.nextPostOrderNode.nextPostOrderNode();
+ if (provisionalNextNode.isNodeAncestor(this.root)) {
+ this.nextPostOrderNode = provisionalNextNode;
+ } else {
+ this.nextPostOrderNode = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void remove() {
+ throw new UnsupportedOperationException("The \"remove\" operation "
+ + "is not supported by this iterator.");
+ }
+
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-30 21:16:50
|
Revision: 9670
http://svn.sourceforge.net/foray/?rev=9670&view=rev
Author: victormote
Date: 2007-05-30 14:16:42 -0700 (Wed, 30 May 2007)
Log Message:
-----------
Use iterator to find the descendant PageNumberCitation instances.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-05-30 20:53:41 UTC (rev 9669)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-05-30 21:16:42 UTC (rev 9670)
@@ -159,9 +159,11 @@
return false;
}
this.optimized = true;
- // Resolve the page-number-citations.
- for (int i = 0; i < getChildren().size(); i++) {
- final Object o = getChildren().get(i);
+ /* Resolve the page-number-citations. */
+ final Iterator<OrderedTreeNode> iterator =
+ this.postOrderDescendantIterator();
+ while (iterator.hasNext()) {
+ final OrderedTreeNode o = iterator.next();
if (o instanceof PageNumberCitationArea) {
final PageNumberCitationArea pia = (PageNumberCitationArea) o;
pia.resolve();
@@ -216,8 +218,8 @@
if (leaderSpaceAvailable == 0) {
return;
}
- final Iterator<? extends OrderedTreeNode> iterator =
- this.postOrderDescendantIterator();
+ final Iterator<OrderedTreeNode> iterator =
+ this.postOrderDescendantIterator();
while (iterator.hasNext()) {
final OrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
@@ -245,7 +247,7 @@
private int computeLeaderCapacity(final int unusedSpace) {
// First, compute how much capacity the leaders have.
int leaderSpaceAvailable = 0;
- final Iterator<? extends OrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
final OrderedTreeNode object = iterator.next();
Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-05-30 20:53:41 UTC (rev 9669)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-05-30 21:16:42 UTC (rev 9670)
@@ -66,7 +66,7 @@
* in post-traversal (depth-first) order.
* @return A post-traversal iterator of this node's descendants.
*/
- public Iterator<? extends OrderedTreeNode> postOrderDescendantIterator() {
+ public Iterator<OrderedTreeNode> postOrderDescendantIterator() {
return new PostOrderDescendantIterator(this);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-05-31 18:29:09
|
Revision: 9672
http://svn.sourceforge.net/foray/?rev=9672&view=rev
Author: victormote
Date: 2007-05-31 11:29:11 -0700 (Thu, 31 May 2007)
Log Message:
-----------
1. Fix bug in block layout logic, returning with the wrong status.
2. Add test file and test for this bug.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java
Added Paths:
-----------
trunk/foray/resource/test/fo/block-002.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-05-30 21:23:35 UTC (rev 9671)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-05-31 18:29:11 UTC (rev 9672)
@@ -46,15 +46,13 @@
public abstract class AbstractAreaTreeTest extends TestCase {
/**
- * Returns the first page item in a given area tree.
- * @param areaTree The area tree whose first page is needed.
- * @return The first page in <code>areaTree</code>
+ * Returns the first normal-flow reference area in a given area tree.
+ * @param areaTree The area tree being tested.
+ * @return The first normal-flow reference area in <code>areaTree</code>.
*/
protected NormalFlowRA getFirstNormalFlowArea(final AreaTree areaTree) {
- OrderedTreeNode node = areaTree.getChildAt(0);
- assertTrue(node instanceof PageCollection);
- final PageCollection pageCollection = (PageCollection) node;
- node = pageCollection.getChildAt(0);
+ final PageCollection pageCollection = getFirstPageCollection(areaTree);
+ OrderedTreeNode node = pageCollection.getChildAt(0);
assertTrue(node instanceof PageRA);
final PageRA firstPage = (PageRA) node;
final RegionRABody regionBody = firstPage.getRegionBody();
@@ -68,4 +66,16 @@
return nfa;
}
+ /**
+ * Returns the first page collection in a given area tree.
+ * @param areaTree The area tree being tested.
+ * @return The first page collection in <code>areaTree</code>.
+ */
+ protected PageCollection getFirstPageCollection(final AreaTree areaTree) {
+ final OrderedTreeNode node = areaTree.getChildAt(0);
+ assertTrue(node instanceof PageCollection);
+ final PageCollection pageCollection = (PageCollection) node;
+ return pageCollection;
+ }
+
}
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java 2007-05-30 21:23:35 UTC (rev 9671)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java 2007-05-31 18:29:11 UTC (rev 9672)
@@ -32,6 +32,7 @@
import org.foray.area.LineArea;
import org.foray.area.NormalBlockArea;
import org.foray.area.NormalFlowRA;
+import org.foray.area.PageCollection;
import org.foray.core.FOrayException;
import org.axsl.common.OrderedTreeNode;
@@ -138,4 +139,18 @@
assertEquals(12000, lineArea.crBPD());
}
+ /**
+ * Test of fo/block-002.fo.
+ * @throws FOrayException For errors creating the FO Tree or Area Tree.
+ */
+ public void testBlock002() throws FOrayException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree areaTree = creator.buildAreaTree(
+ "fo/block-002.fo");
+ final PageCollection pageCollection = this.getFirstPageCollection(
+ areaTree);
+ final int numPages = pageCollection.getChildCount();
+ assertEquals(2, numPages);
+ }
+
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2007-05-30 21:23:35 UTC (rev 9671)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/BlockPL.java 2007-05-31 18:29:11 UTC (rev 9672)
@@ -167,6 +167,7 @@
return Status.AREA_FULL_SOME;
}
anythingLaidOut = true;
+ return status;
}
anythingLaidOut = true;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java 2007-05-30 21:23:35 UTC (rev 9671)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FOTextPL.java 2007-05-31 18:29:11 UTC (rev 9672)
@@ -95,7 +95,9 @@
if (la == null) {
return start;
}
- return addTextItemToLine(la, lineText, start, end, graftingPoint);
+ final int progress = addTextItemToLine(la, lineText, start, end,
+ graftingPoint);
+ return progress;
}
/**
Added: trunk/foray/resource/test/fo/block-002.fo
===================================================================
--- trunk/foray/resource/test/fo/block-002.fo (rev 0)
+++ trunk/foray/resource/test/fo/block-002.fo 2007-05-31 18:29:11 UTC (rev 9672)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+This fo file is on a short (4 inches high) page, and contains one block with
+content that spills onto a second page. Its purpose is to test whether all of
+the content finds its way into the Area Tree.
+-->
+
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+
+<fo:layout-master-set>
+ <fo:simple-page-master
+ master-name="simple"
+ page-height="4in"
+ margin-top="1in"
+ margin-bottom="1in"
+ margin-left="1in"
+ margin-right="1in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+</fo:layout-master-set>
+
+<fo:page-sequence master-reference="simple">
+<fo:flow flow-name="xsl-region-body">
+
+
+<fo:block>
+This document is on a short (4 inches high) page, and contains one block.
+The content of that one block is intended to spill onto a second page, the
+purpose being to test whether all of the content ends up in the output
+document.
+This is test sentence 1. This is test sentence 2. This is test sentence 3.
+This is test sentence 4. This is test sentence 5. This is test sentence 6.
+This is test sentence 7. This is test sentence 8. This is test sentence 9.
+This is test sentence 10. This is test sentence 11. This is test sentence 12.
+This is test sentence 13. This is test sentence 14. This is test sentence 15.
+This is test sentence 16. This is test sentence 17. This is test sentence 18.
+This is test sentence 19. This is test sentence 20. This is test sentence 21.
+This is test sentence 22. This is test sentence 23. This is test sentence 24.
+This is test sentence 25. This is test sentence 26. This is test sentence 27.
+This is test sentence 28. This is test sentence 29. This is test sentence 30.
+This is test sentence 31. This is test sentence 32. This is test sentence 33.
+This is test sentence 34. This is test sentence 35. This is test sentence 36.
+This is test sentence 37. This is test sentence 38. This is test sentence 39.
+This is test sentence 40. This is test sentence 41. This is test sentence 42.
+This is test sentence 43. This is test sentence 44. This is test sentence 45.
+This is test sentence 46. This is test sentence 47. This is test sentence 48.
+This is test sentence 49. This is test sentence 50. This is test sentence 51.
+This is test sentence 52. This is test sentence 53. This is test sentence 54.
+</fo:block>
+
+
+</fo:flow>
+</fo:page-sequence>
+</fo:root>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-01 18:07:51
|
Revision: 9680
http://svn.sourceforge.net/foray/?rev=9680&view=rev
Author: victormote
Date: 2007-06-01 11:07:53 -0700 (Fri, 01 Jun 2007)
Log Message:
-----------
1. Conform to axsl changes renaming and repurposing the contentComplete() method in AreaTree.
2. Move the decisions about whether a page is actually ready to be rendered from the Core module to the AreaTree module.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-06-01 15:56:25 UTC (rev 9679)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-06-01 18:07:53 UTC (rev 9680)
@@ -32,8 +32,8 @@
import org.axsl.areaW.AreaTreeEvent;
import org.axsl.areaW.AreaTreeListener;
import org.axsl.areaW.AreaWException;
+import org.axsl.foR.Fo;
import org.axsl.foR.FoNode;
-import org.axsl.foR.Fo;
import org.axsl.foR.fo.Bookmark;
import org.axsl.foR.fo.BookmarkTree;
import org.axsl.foR.fo.Marker;
@@ -98,6 +98,13 @@
= new ArrayList<AreaTreeListener>();
/**
+ * The list of pages waiting to be renderered. In general, pages waiting
+ * to be rendered are doing so because they have unresolved "ref-id" items
+ * on them.
+ */
+ private List<PageRA> renderQueue = new ArrayList<PageRA>();
+
+ /**
* Private Constructor.
* @param fontConsumer The Font Consumer.
* @param textServer The Text Server.
@@ -188,7 +195,8 @@
/**
* {@inheritDoc}
*/
- public void createDocumentNodes() {
+ public void contentComplete() {
+ this.processQueue(true);
layoutBookmarkTree(this.getRoot());
}
@@ -284,6 +292,39 @@
* @param page The PageArea instance that was just completed.
*/
protected void notifyPageComplete(final PageRA page) {
+ /* Add the newly laid-out page to the queue. It may or may not be ready
+ * to process because of unresolved references or other factors that
+ * require looking ahead at future pages. */
+ renderQueue.add(page);
+
+ processQueue(false);
+ }
+
+ /**
+ * Try to process the queue of pages from the first entry forward.
+ * If an entry can't be processed, then the queue can't move forward, so
+ * return.
+ * @param force Set to true if pages should be processed regardless of
+ * whether they have unresolved references.
+ */
+ private synchronized void processQueue(final boolean force) {
+ while (renderQueue.size() > 0) {
+ final PageRA queuedPage = renderQueue.get(0);
+ if (force
+ || queuedPage.firstUnresolvedRefId() == null) {
+ releasePage(queuedPage);
+ renderQueue.remove(0);
+ } else {
+ return;
+ }
+ }
+ }
+
+ /**
+ * Releases a given page by firing a "Page Complete" event.
+ * @param page The page to be released.
+ */
+ private void releasePage(final PageRA page) {
/* If nobody wants these events, don't waste resources creating
* them. */
if (areaTreeListeners.size() < 1) {
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2007-06-01 15:56:25 UTC (rev 9679)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayTarget.java 2007-06-01 18:07:53 UTC (rev 9680)
@@ -31,7 +31,6 @@
import org.foray.common.WKConstants;
import org.axsl.areaR.AreaRException;
-import org.axsl.areaR.PageArea;
import org.axsl.areaW.AreaTreeEvent;
import org.axsl.areaW.AreaTreeFactory;
import org.axsl.areaW.AreaTreeListener;
@@ -54,8 +53,6 @@
import java.io.IOException;
import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
/**
This class acts as a bridge between the XML:FO parser
@@ -100,13 +97,6 @@
private OutputTarget outputTarget;
/**
- * The list of pages waiting to be renderered. In general, pages waiting
- * to be rendered are doing so because they have unresolved "ref-id" items
- * on them.
- */
- private List<PageArea> renderQueue = new ArrayList<PageArea>();
-
- /**
* Keeps track of how many page-sequence objects have been processed.
* Used in messages to the users.
*/
@@ -213,15 +203,8 @@
* @throws SAXException For errors during cleanup.
*/
public void stopRenderer() throws SAXException {
- /*
- Force the processing of any more queue elements,
- even if they are not resolved.
- */
try {
- processQueue(true);
outputTarget.stopOutput();
- } catch (final AreaRException e) {
- throw new SAXException(e);
} catch (final IOException e) {
throw new SAXException(e);
}
@@ -264,9 +247,9 @@
*/
public void render(final PageSequence pageSequence) throws FOrayException {
pageSequenceCount ++;
- getLogger().info("Starting layout of page-sequence "
- + pageSequenceCount + ".");
if (this.outputTarget instanceof Renderer) {
+ getLogger().info("Starting layout of page-sequence "
+ + pageSequenceCount + ".");
final Renderer renderer = (Renderer) this.outputTarget;
final org.axsl.areaR.AreaTree areaTreeR = getRenderedAreaTree();
renderer.setAreaTree(areaTreeR);
@@ -279,15 +262,8 @@
} catch (final LayoutException e) {
throw new FOrayException(e);
}
- try {
- processQueue(false);
- } catch (final AreaRException e1) {
- throw new FOrayException(e1);
- } catch (final IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- getLogger().info("Ending page-sequence " + pageSequenceCount + ": "
+ getLogger().info("Ending layout of page-sequence "
+ + pageSequenceCount + ": "
+ pageCollection.getPageCount() + " pages produced.");
}
}
@@ -323,72 +299,19 @@
* {@inheritDoc}
*/
public void pageComplete(final AreaTreeEvent event) {
- final org.axsl.areaW.PageArea page = event.getPage();
- final org.axsl.areaR.PageArea pageToRender = (PageArea) page;
+ final org.axsl.areaR.PageArea page = event.getPage();
+ final Renderer renderer = (Renderer) this.outputTarget;
try {
- queuePage(pageToRender);
- } catch (final AreaWException e) {
- /* TODO: Do something better with this. */
- e.printStackTrace();
+ renderer.render(page);
+ } catch (final IOException e) {
+ this.getLogger().error("Rendering error", e);
+ } catch (final AreaRException e) {
+ this.getLogger().error("Rendering error", e);
}
- }
-
- /**
- * Adds a page to the queue of pages to be rendered.
- * @param page The page to add to the queue of unrendered pages.
- * @throws AreaWException For errors during ouput.
- */
- public synchronized void queuePage(final PageArea page)
- throws AreaWException {
- /* TODO: Resolve whether the queue should be rendered here or not.*/
-
- /*
- * We run the pages through a queue because any page page that contains
- * an unresolved ref-id prevents subsequent pages from being rendered.
- * So, first we add them to the queue. Then, we check to see if
- * anything in the queue can be processed.
- */
-// try {
- renderQueue.add(page);
- /*
- The just-added entry could (possibly) resolve the
- waiting entries, so we try to process the queue
- now to see.
- */
-// processQueue(false);
-// } catch (IOException e) {
-// throw new FOrayException(e);
-// }
pageCount++;
}
/**
- * Try to process the queue of pages from the first entry forward.
- * If an entry can't be processed, then the queue can't move forward, so
- * return.
- * @param force Set to true if pages should be processed regardless of
- * whether they have unresolved references.
- * @throws AreaRException For errors in the Area Tree.
- * @throws IOException For errors during output.
- */
- private synchronized void processQueue(final boolean force)
- throws AreaRException, IOException {
- if (! (this.outputTarget instanceof Renderer)) {
- return;
- }
- final Renderer renderer = (Renderer) this.outputTarget;
- while (renderQueue.size() > 0) {
- final PageArea page = renderQueue.get(0);
- if (force || page.firstUnresolvedRefId() == null) {
- renderer.render(page);
- renderQueue.remove(0);
- } else {
- return;
- }
- }
- }
-
- /**
* Returns the logger.
* @return The logger.
*/
@@ -428,7 +351,7 @@
* @param event the FOTreeEvent that was fired
*/
public void foDocumentComplete(final FoTreeEvent event) {
- getCreatedAreaTree().createDocumentNodes();
+ getCreatedAreaTree().contentComplete();
try {
stopRenderer();
} catch (final SAXException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-01 23:22:53
|
Revision: 9683
http://svn.sourceforge.net/foray/?rev=9683&view=rev
Author: victormote
Date: 2007-06-01 16:22:55 -0700 (Fri, 01 Jun 2007)
Log Message:
-----------
Remove zero-width spaces from the PDF output.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java
trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java 2007-06-01 22:26:49 UTC (rev 9682)
+++ trunk/foray/foray-common/src/java/org/foray/common/UnicodeChar.java 2007-06-01 23:22:55 UTC (rev 9683)
@@ -41,7 +41,7 @@
*/
private static final int[] OTHER_NONPRINTABLE = new int[] {
/* TODO: This list is almost certainly very incomplete. */
- '\u200B',
+ '\u200B', /* zero-width space */
};
/**
Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2007-06-01 22:26:49 UTC (rev 9682)
+++ trunk/foray/foray-common/src/java/org/foray/common/XMLCharacter.java 2007-06-01 23:22:55 UTC (rev 9683)
@@ -613,7 +613,7 @@
}
/**
- * Indicates whether the input is one of the fiver predefined XML entity
+ * Indicates whether the input is one of the five predefined XML entity
* references.
* @param c The char to be tested.
* @return True iff <code>c</code> is a predefined XML entity reference.
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2007-06-01 22:26:49 UTC (rev 9682)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2007-06-01 23:22:55 UTC (rev 9683)
@@ -79,6 +79,11 @@
if (Character.isSupplementaryCodePoint(codePoint)) {
i++;
}
+ if (codePoint == '\u200B') {
+ /* Zero-width space. Until we learn better, we just omit it
+ * from the output. */
+ continue;
+ }
final int ch = font.encodeCharacter(codePoint);
addCharToBuffer(buffer, ch);
if (i + 1 < theString.length()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-02 22:44:23
|
Revision: 9692
http://svn.sourceforge.net/foray/?rev=9692&view=rev
Author: victormote
Date: 2007-06-02 15:44:25 -0700 (Sat, 02 Jun 2007)
Log Message:
-----------
1. Conform to axsl changes allowing suppression of kerning.
2. Use new methods to suppress kerning for dot leaders.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -215,4 +215,12 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ /* Kerning is not applicable for this inline element. */
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -224,4 +224,12 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ /* Kerning is not applicable for this inline element. */
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -287,4 +287,12 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ /* Kerning is not applicable for this inline element. */
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineContainerArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -166,4 +166,12 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ /* Kerning is not applicable for this inline element. */
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -544,4 +544,19 @@
return (Leader) this.getLinkage().getFONode();
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ if (this.traitLeaderPattern() == LeaderPattern.USE_CONTENT) {
+ return true;
+ }
+ /* This is meaningless for all other types except LeaderPattern.DOTS,
+ * For DOTS, we adjust the word spacing to handle the actual size of the
+ * space between the dots. If we left that intact, we would have to
+ * adjust the space more to compensate for any kerning, which would
+ * make no sense. */
+ return false;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -183,4 +183,11 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -206,4 +206,11 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/SVGArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -159,4 +159,12 @@
return 0;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ /* Kerning is not applicable for this inline element. */
+ return true;
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -786,4 +786,11 @@
return this.generatedBy;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean kern() {
+ return true;
+ }
+
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -128,13 +128,13 @@
/**
* {@inheritDoc}
*/
- public synchronized void drawText(final String text) {
+ public synchronized void drawText(final String text, final boolean kern) {
if (text.length() < 1) {
return;
}
openTextObject();
final PDFString pdfString = new PDFString(this.getPDFDocument(), text,
- this.getGS().getFont());
+ this.getGS().getFont(), kern);
add(pdfString.toPDF());
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -53,17 +53,23 @@
/** The Font that should be used to render this String. */
private PDFFont font;
+ /** Indicates whether the text in this string should be kerned or not. */
+ private boolean kerningActive;
+
/**
* Constructor.
* @param doc The parent PDF document.
* @param string The String being encapsulated.
* @param font The font in which this String should be written.
+ * @param kerningActive Indicates whether the text in this string should be
+ * kerned or not.
*/
public PDFString(final PDFDocument doc, final String string,
- final PDFFont font) {
+ final PDFFont font, final boolean kerningActive) {
super(doc);
this.theString = string;
this.font = font;
+ this.kerningActive = kerningActive;
}
/**
@@ -144,6 +150,9 @@
*/
private void addKerning(final Font font, final char char1, final char char2,
final StringBuilder buf) {
+ if (! this.kerningActive) {
+ return;
+ }
final int kernAmount = font.kern(char1, char2);
if (kernAmount == 0) {
return;
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFGraphics2D.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -816,7 +816,8 @@
currentStream.write("1 0 0 -1 0 0 Tm ");
final PDFFont pdfFont = new PDFFont(this.pdfDoc, font);
- final PDFString pdfString = new PDFString(this.pdfDoc, s, pdfFont);
+ final PDFString pdfString = new PDFString(this.pdfDoc, s, pdfFont,
+ true);
final String outputString = pdfString.toPDF();
currentStream.write(outputString);
Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-06-02 22:06:43 UTC (rev 9691)
+++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-06-02 22:44:25 UTC (rev 9692)
@@ -325,7 +325,8 @@
if (newFont != currentFont) {
/* Font has changed. Write the text so far. */
final int size = i - startIndex;
- paintText(area, currentFont, text, startIndex, size);
+ paintText(area, currentFont, text, startIndex, size,
+ area.kern());
if (size > 0) {
startIndex = i;
}
@@ -334,7 +335,7 @@
}
if (startIndex < text.length) {
paintText(area, currentFont, text, startIndex,
- text.length - startIndex);
+ text.length - startIndex, area.kern());
}
}
@@ -388,9 +389,11 @@
* @param startIndex The starting index into <code>text</code> which should
* be rendered.
* @param size The size of <code>text</code> which should be rendered.
+ * @param kern Indicates whether the text should be kerned.
*/
private void paintText(final GeneralInlineArea area, final FontUse fontUse,
- final char[] text, final int startIndex, final int size) {
+ final char[] text, final int startIndex, final int size,
+ final boolean kern) {
if (size < 1) {
return;
}
@@ -400,7 +403,7 @@
/* Paint the text. */
final String textToWrite = new String(text, startIndex, size);
- getContentStream().drawText(textToWrite);
+ getContentStream().drawText(textToWrite, kern);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-04 20:09:44
|
Revision: 9694
http://svn.sourceforge.net/foray/?rev=9694&view=rev
Author: victormote
Date: 2007-06-04 13:09:36 -0700 (Mon, 04 Jun 2007)
Log Message:
-----------
Round 1 of changes to implement new axsl requirements for handling lists in the Area Tree.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java
Added Paths:
-----------
trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListItemBodyContainer.java
trunk/foray/foray-areatree/src/java/org/foray/area/ListItemLabelContainer.java
Added: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java (rev 0)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -0,0 +1,267 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.axsl.areaR.RenderVisitor;
+import org.axsl.areaW.AreaWException;
+import org.axsl.common.value.RelativeAxis;
+import org.axsl.foR.Fo;
+import org.axsl.foR.fo.Block;
+import org.axsl.foR.fo.BlockContainer;
+import org.axsl.foR.fo.GraftingPoint;
+import org.axsl.foR.fo.ListBlock;
+import org.axsl.foR.fo.ListItemBody;
+import org.axsl.foR.fo.ListItemLabel;
+import org.axsl.foR.fo.Table;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * An AreaNode containing the areas generated by the children of a
+ * list-item-label.
+ */
+public abstract class AbstractListItemContent extends ContainerRA
+ implements org.axsl.areaW.ListItemLabelContainer {
+
+ /** The "generated-by" trait, as defined in Section 6.1.1. */
+ private FOLinkage generatedBy;
+
+ /** The parent of this node. */
+ private ListItemArea parent;
+
+ /** The children of this node. */
+ private List<Area> children = new ArrayList<Area>();
+
+ /** See {@link #getProgressionDimension()} for a description of
+ * "progression dimension". */
+ private int progressionDimension = 0;
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area.
+ */
+ protected AbstractListItemContent(final ListItemArea parentArea) {
+ this.parent = parentArea;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void render(final RenderVisitor visitor) {
+ visitor.render(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Area getOverflowArea(final Area requester) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int crBPD() {
+ return getProgressionDimension();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int crIPD() {
+ /* TODO: This is probably not right. */
+ return this.ancestorArea().crIPD();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public RelativeAxis contentStackingAxisRelative() {
+ return RelativeAxis.BLOCK_PROGRESSION;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListItemArea getParent() {
+ return this.parent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setParent(final AreaNode node) throws AreaWException {
+ if (node instanceof ListItemArea) {
+ this.parent = (ListItemArea) node;
+ } else {
+ throw new AreaWException("Parent of " + this.getClass().getName()
+ + "must be a " + ListItemArea.class.getName());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<Area> getChildren() {
+ return this.children;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setProgressionDimension(final int progressionDimension) {
+ /* Non-standard logic. This area does not necessarily grow as the
+ * child Areas grow, because there are two columns of child areas.
+ * This works more like a table-row, that is, only if the maximum
+ * height of the two columns grows should this area grow. So we hijack
+ * the logic here to reset it based upon the size of the children,
+ * then notify the parent of the change. */
+ final int newPd = computePdFromChildren();
+ setParentPD(newPd);
+ this.progressionDimension = newPd;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void incrementProgressionDimension(final int incrementAmount) {
+ /* Non-standard logic. We will treat this more like an event that tells
+ * us we need to recompute. Do the same as is done when setting the
+ * PD. */
+ final int savePd = this.progressionDimension;
+ final int newPd = this.computePdFromChildren();
+ final int computedIncrementAmount = newPd - savePd;
+ incrementParentPD(computedIncrementAmount);
+ this.progressionDimension = newPd;
+ }
+
+ /**
+ * Resets the progression dimension for this row by polling the cells to
+ * see whether their content BPD has changed.
+ * @return The computed BPD of this item.
+ */
+ private int computePdFromChildren() {
+ int labelPd = 0;
+ int bodyPd = 0;
+ for (Area child : this.children) {
+ final Fo fo = child.traitGeneratedBy().ancestorListRelatedObject(
+ this);
+ if (fo == null) {
+ throw new IllegalStateException("Child of list-item-area must "
+ + "be generated by objects having list-related "
+ + "ancestors.");
+ }
+ if (fo instanceof ListItemLabel) {
+ labelPd += child.getProgressionDimension();
+ } else if (fo instanceof ListItemBody) {
+ bodyPd += child.getProgressionDimension();
+ }
+ }
+ final int maxPd = Math.max(labelPd, bodyPd);
+ return maxPd;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getProgressionDimension() {
+ return this.progressionDimension;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected boolean optimize() {
+ this.optimizeChildren();
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public TableRA makeTableArea(final Table table,
+ final GraftingPoint graftingPoint) {
+ final TableRA newTable = TableRA.makeTableRA(table, this,
+ graftingPoint);
+ this.children.add(newTable);
+ return newTable;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public NormalBlockArea makeNormalBlockArea(final Block block,
+ final GraftingPoint graftingPoint) {
+ final NormalBlockArea nbArea = NormalBlockArea.makeNormalBlockArea(
+ block, this, graftingPoint);
+ this.children.add(nbArea);
+ return nbArea;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public BlockContainerRA makeBlockContainerArea(
+ final BlockContainer blockContainer,
+ final GraftingPoint graftingPoint) {
+ final BlockContainerRA newBcArea
+ = BlockContainerRA.makeBlockContainerArea(blockContainer, this,
+ graftingPoint);
+ this.children.add(newBcArea);
+ return newBcArea;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListBlockArea makeListBlockArea(final ListBlock listBlock,
+ final GraftingPoint graftingPoint) {
+ final ListBlockArea newListBlockArea = ListBlockArea.makeListBlockArea(
+ listBlock, this, graftingPoint);
+ this.children.add(newListBlockArea);
+ return newListBlockArea;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FOLinkage getLinkage() {
+ return this.generatedBy;
+ }
+
+ /**
+ * Sets the "generated by" for this Area.
+ * @param generatedBy The new "generated by" value.
+ */
+ protected void setGeneratedBy(final FOLinkage generatedBy) {
+ this.generatedBy = generatedBy;
+ }
+
+}
Property changes on: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractListItemContent.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2007-06-03 00:44:55 UTC (rev 9693)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListItemArea.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -32,14 +32,10 @@
import org.axsl.areaW.AreaWException;
import org.axsl.common.value.RelativeAxis;
import org.axsl.foR.Fo;
-import org.axsl.foR.fo.Block;
-import org.axsl.foR.fo.BlockContainer;
import org.axsl.foR.fo.GraftingPoint;
-import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.ListItem;
import org.axsl.foR.fo.ListItemBody;
import org.axsl.foR.fo.ListItemLabel;
-import org.axsl.foR.fo.Table;
import java.util.ArrayList;
import java.util.List;
@@ -233,61 +229,39 @@
/**
* {@inheritDoc}
*/
- public TableRA makeTableArea(final Table table,
- final GraftingPoint graftingPoint) {
- final TableRA newTable = TableRA.makeTableRA(table, this,
- graftingPoint);
- this.children.add(newTable);
- return newTable;
+ public FOLinkage getLinkage() {
+ return this.generatedBy;
}
/**
* {@inheritDoc}
*/
- public NormalBlockArea makeNormalBlockArea(final Block block,
- final GraftingPoint graftingPoint) {
- final NormalBlockArea nbArea = NormalBlockArea.makeNormalBlockArea(
- block, this, graftingPoint);
- this.children.add(nbArea);
- return nbArea;
+ public ListItem traitGeneratedBy() {
+ return (ListItem) this.getLinkage().getFONode();
}
/**
* {@inheritDoc}
*/
- public BlockContainerRA makeBlockContainerArea(
- final BlockContainer blockContainer,
+ public ListItemLabelContainer makeListItemLabelContainer(
+ final ListItemLabel listItemLabel,
final GraftingPoint graftingPoint) {
- final BlockContainerRA newBcArea
- = BlockContainerRA.makeBlockContainerArea(blockContainer, this,
- graftingPoint);
- this.children.add(newBcArea);
- return newBcArea;
+ final ListItemLabelContainer container =
+ ListItemLabelContainer.makeListItemLabelContainer(listItemLabel,
+ this, graftingPoint);
+ return container;
}
/**
* {@inheritDoc}
*/
- public ListBlockArea makeListBlockArea(final ListBlock listBlock,
+ public ListItemBodyContainer makeListItemBodyContainer(
+ final ListItemBody listItemBody,
final GraftingPoint graftingPoint) {
- final ListBlockArea newListBlockArea = ListBlockArea.makeListBlockArea(
- listBlock, this, graftingPoint);
- this.children.add(newListBlockArea);
- return newListBlockArea;
+ final ListItemBodyContainer container =
+ ListItemBodyContainer.makeListItemBodyContainer(listItemBody,
+ this, graftingPoint);
+ return container;
}
- /**
- * {@inheritDoc}
- */
- public FOLinkage getLinkage() {
- return this.generatedBy;
- }
-
- /**
- * {@inheritDoc}
- */
- public ListItem traitGeneratedBy() {
- return (ListItem) this.getLinkage().getFONode();
- }
-
}
Added: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemBodyContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListItemBodyContainer.java (rev 0)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListItemBodyContainer.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.axsl.foR.fo.GraftingPoint;
+import org.axsl.foR.fo.ListItemBody;
+
+/**
+ * An AreaNode containing the areas generated by the children of a
+ * list-item-body.
+ */
+public final class ListItemBodyContainer extends AbstractListItemContent
+ implements org.axsl.areaW.ListItemBodyContainer {
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area.
+ */
+ private ListItemBodyContainer(final ListItemArea parentArea) {
+ super(parentArea);
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
+ * area.
+ * @return The new instance.
+ */
+ static ListItemBodyContainer makeListItemBodyContainer(
+ final ListItemBody generatedBy,
+ final ListItemArea parentArea,
+ final GraftingPoint graftingPoint) {
+ final ListItemBodyContainer newContainer = new ListItemBodyContainer(
+ parentArea);
+ newContainer.setGeneratedBy(newContainer.linkage(generatedBy,
+ graftingPoint));
+ newContainer.registerWithLinkage(graftingPoint);
+ newContainer.initializeProgressionDimension();
+ newContainer.initializeAnteriorSpace();
+ return newContainer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getAreaName() {
+ return "list-item-body";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListItemBody traitGeneratedBy() {
+ return (ListItemBody) this.getLinkage().getFONode();
+ }
+
+}
Property changes on: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemBodyContainer.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemLabelContainer.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ListItemLabelContainer.java (rev 0)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ListItemLabelContainer.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.area;
+
+import org.axsl.foR.fo.GraftingPoint;
+import org.axsl.foR.fo.ListItemLabel;
+
+/**
+ * An AreaNode containing the areas generated by the children of a
+ * list-item-label.
+ */
+public final class ListItemLabelContainer extends AbstractListItemContent
+ implements org.axsl.areaW.ListItemLabelContainer {
+
+ /**
+ * Private Constructor.
+ * @param parentArea The parent area.
+ */
+ private ListItemLabelContainer(final ListItemArea parentArea) {
+ super(parentArea);
+ }
+
+ /**
+ * Package-visible factory method.
+ * @param generatedBy The FO node generating this area.
+ * @param parentArea The parent area.
+ * @param graftingPoint The ancestor retrieve-marker, if any, for this
+ * area.
+ * @return The new instance.
+ */
+ static ListItemLabelContainer makeListItemLabelContainer(
+ final ListItemLabel generatedBy,
+ final ListItemArea parentArea,
+ final GraftingPoint graftingPoint) {
+ final ListItemLabelContainer newContainer = new ListItemLabelContainer(
+ parentArea);
+ newContainer.setGeneratedBy(newContainer.linkage(generatedBy,
+ graftingPoint));
+ newContainer.registerWithLinkage(graftingPoint);
+ newContainer.initializeProgressionDimension();
+ newContainer.initializeAnteriorSpace();
+ return newContainer;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getAreaName() {
+ return "list-item-label";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ListItemLabel traitGeneratedBy() {
+ return (ListItemLabel) this.getLinkage().getFONode();
+ }
+
+}
Property changes on: trunk/foray/foray-areatree/src/java/org/foray/area/ListItemLabelContainer.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java 2007-06-03 00:44:55 UTC (rev 9693)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -29,8 +29,9 @@
package org.foray.pioneer;
import org.axsl.areaW.AreaNode;
-
import org.axsl.areaW.AreaWException;
+import org.axsl.areaW.ListItemArea;
+import org.axsl.areaW.ListItemBodyContainer;
import org.axsl.foR.Fo;
import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.ListItemBody;
@@ -59,22 +60,24 @@
*/
public Status layout(final AreaNode areaNode,
final GraftingPoint graftingPoint) throws AreaWException {
+ if (! (areaNode instanceof ListItemArea)) {
+ throw new AreaWException("Illegal parent area for "
+ + "fo:list-item-label");
+ }
+ final ListItemArea listItemArea = (ListItemArea) areaNode;
+ final ListItemBodyContainer container =
+ listItemArea.makeListItemBodyContainer(this.node,
+ graftingPoint);
+
if (getProgress() == FONodePL.START) {
setProgress(0);
}
- /*
- * For calculating the lineage - The fo:list-item-body formatting object
- * does not generate any areas. The fo:list-item-body formatting object
- * returns the sequence of areas created by concatenating the sequences
- * of areas returned by each of the children of the fo:list-item-body.
- */
-
final int numChildren = this.node.getChildren().size();
for (int i = getProgress(); i < numChildren; i++) {
final Fo fo = (Fo) this.node.getChildren().get(i);
- final Status status = getLayoutProxy(fo).layout(areaNode,
+ final Status status = getLayoutProxy(fo).layout(container,
graftingPoint);
if (status.isIncomplete()) {
setProgress(i);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java 2007-06-03 00:44:55 UTC (rev 9693)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -29,9 +29,10 @@
package org.foray.pioneer;
import org.axsl.areaW.AreaNode;
-
import org.axsl.areaW.AreaWException;
-import org.axsl.foR.fo.Block;
+import org.axsl.areaW.ListItemArea;
+import org.axsl.areaW.ListItemLabelContainer;
+import org.axsl.foR.Fo;
import org.axsl.foR.fo.GraftingPoint;
import org.axsl.foR.fo.ListItemLabel;
@@ -59,27 +60,33 @@
*/
public Status layout(final AreaNode areaNode,
final GraftingPoint graftingPoint) throws AreaWException {
+ if (! (areaNode instanceof ListItemArea)) {
+ throw new AreaWException("Illegal parent area for "
+ + "fo:list-item-label");
+ }
+ final ListItemArea listItemArea = (ListItemArea) areaNode;
+ final ListItemLabelContainer container =
+ listItemArea.makeListItemLabelContainer(this.node,
+ graftingPoint);
+
+ if (getProgress() == FONodePL.START) {
+ setProgress(0);
+ }
final int numChildren = this.node.getChildren().size();
+ for (int i = getProgress(); i < numChildren; i++) {
+ final Fo fo = (Fo) this.node.getChildren().get(i);
- if (numChildren != 1) {
- throw new AreaWException("Non-standard restriction: "
- + "list-item-label must have exactly one block.");
+ final Status status = getLayoutProxy(fo).layout(container,
+ graftingPoint);
+ if (status.isIncomplete()) {
+ setProgress(i);
+ if ((i == 0) && (status == Status.AREA_FULL_NONE)) {
+ return Status.AREA_FULL_NONE;
+ }
+ return Status.AREA_FULL_SOME;
+ }
}
-
- final Block block = (Block) this.node.getChildren().get(0);
-
- /*
- * For calculating the lineage - The fo:list-item-label formatting
- * object does not generate any areas.
- * The fo:list-item-label formatting object returns the sequence of
- * areas created by concatenating the sequences of areas returned by
- * each of the children of the fo:list-item-label.
- */
-
- Status status;
- final BlockPL blockPL = (BlockPL) getLayoutProxy(block);
- status = blockPL.layout(areaNode, graftingPoint);
- return status;
+ return Status.OK;
}
/**
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java 2007-06-03 00:44:55 UTC (rev 9693)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java 2007-06-04 20:09:36 UTC (rev 9694)
@@ -72,12 +72,12 @@
final ListItemArea group = listBlockArea.makeListItemArea(this.node,
graftingPoint);
- /* Now lay out the list-item-label inside the new block-area. */
+ /* Lay out the list-item-label inside the new list-item area. */
final ListItemLabel label =
(ListItemLabel) this.node.getChildren().get(0);
Status status;
- // what follows doesn't yet take into account whether the
- // body failed completely or only got some text in
+ /* What follows doesn't yet take into account whether the body failed
+ * completely or only got some text in. */
if (getProgress() == 0) {
final ListItemLabelPL labelPL
= (ListItemLabelPL) this.getLayoutProxy(label);
@@ -87,7 +87,7 @@
}
}
- /* Now create a BlockArea to contain the list-item-body. */
+ /* Lay out the list-item-body inside the new list-item area. */
final ListItemBody body = (ListItemBody) this.node.getChildren().get(1);
final ListItemBodyPL bodyPL = (ListItemBodyPL) getLayoutProxy(body);
status = bodyPL.layout(group, graftingPoint);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-06 15:33:47
|
Revision: 9702
http://svn.sourceforge.net/foray/?rev=9702&view=rev
Author: victormote
Date: 2007-06-06 08:29:53 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Rename class for clarity, and in preparation for moving the related interface from axsl to foray.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
Removed Paths:
-------------
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-06-04 23:51:01 UTC (rev 9701)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-06-06 15:29:53 UTC (rev 9702)
@@ -116,10 +116,11 @@
*/
protected String getText(final AreaNode node) {
final StringBuilder builder = new StringBuilder();
- final Iterator<org.foray.common.OrderedTreeNode> iterator =
+ final Iterator<org.foray.common.AbstractOrderedTreeNode> iterator =
node.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final org.foray.common.OrderedTreeNode otn = iterator.next();
+ final org.foray.common.AbstractOrderedTreeNode otn =
+ iterator.next();
if (otn instanceof TextArea) {
final TextArea textArea = (TextArea) otn;
final char[] text = textArea.getRawText();
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-04 23:51:01 UTC (rev 9701)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-06 15:29:53 UTC (rev 9702)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.common.OrderedTreeNode;
+import org.foray.common.AbstractOrderedTreeNode;
import org.axsl.areaW.AreaWException;
import org.axsl.foR.FoNode;
@@ -44,7 +44,7 @@
/**
* Abstract superclass for all nodes in the AreaTree.
*/
-public abstract class AreaNode extends OrderedTreeNode
+public abstract class AreaNode extends AbstractOrderedTreeNode
implements org.axsl.areaR.AreaNode, org.axsl.areaW.AreaNode {
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-06-04 23:51:01 UTC (rev 9701)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-06-06 15:29:53 UTC (rev 9702)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.common.OrderedTreeNode;
+import org.foray.common.AbstractOrderedTreeNode;
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
@@ -160,10 +160,10 @@
}
this.optimized = true;
/* Resolve the page-number-citations. */
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<AbstractOrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode o = iterator.next();
+ final AbstractOrderedTreeNode o = iterator.next();
if (o instanceof PageNumberCitationArea) {
final PageNumberCitationArea pia = (PageNumberCitationArea) o;
pia.resolve();
@@ -219,10 +219,10 @@
if (leaderSpaceAvailable == 0) {
return;
}
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<AbstractOrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode object = iterator.next();
+ final AbstractOrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
boolean prorating = false;
@@ -248,10 +248,10 @@
private int computeLeaderCapacity(final int unusedSpace) {
// First, compute how much capacity the leaders have.
int leaderSpaceAvailable = 0;
- final Iterator<OrderedTreeNode> iterator =
+ final Iterator<AbstractOrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final OrderedTreeNode object = iterator.next();
+ final AbstractOrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
if (unusedSpace > 0) {
Copied: trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java (from rev 9673, trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java)
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 15:29:53 UTC (rev 9702)
@@ -0,0 +1,520 @@
+/*
+ * Copyright 2005 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common;
+
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+
+/**
+ * An implementation of the {@link TreeNode} interface that provides methods for
+ * various traversal needs.
+ *
+ * <p>Consideration was given to using {@link DefaultMutableTreeNode} instead of
+ * creating this class.
+ * However, the data portion of that class was not deemed suitable.</p>
+ */
+public abstract class AbstractOrderedTreeNode
+ implements org.axsl.common.OrderedTreeNode {
+
+ /**
+ * Constructor.
+ */
+ public AbstractOrderedTreeNode() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Enumeration<? extends AbstractOrderedTreeNode> children() {
+ return Collections.enumeration(this.getChildren());
+ }
+
+ /**
+ * Returns an iterator that will iterate the descendant nodes of this node
+ * in post-traversal (depth-first) order.
+ * @return A post-traversal iterator of this node's descendants.
+ */
+ public Iterator<AbstractOrderedTreeNode> postOrderDescendantIterator() {
+ return new PostOrderDescendantIterator(this);
+ }
+
+ /**
+ * Return the List of this node's children.
+ * @return The List of this node's children.
+ */
+ public abstract List<? extends AbstractOrderedTreeNode>
+ getChildren();
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract boolean getAllowsChildren();
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode getChildAt(final int childIndex) {
+ if (childIndex < 0) {
+ return null;
+ }
+ if (childIndex >= getChildren().size()) {
+ return null;
+ }
+ return getChildren().get(childIndex);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getChildCount() {
+ if (getChildren() == null) {
+ return 0;
+ }
+ return getChildren().size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getIndex(final TreeNode node) {
+ if (getChildren() == null) {
+ return -1;
+ }
+ return getChildren().indexOf(node);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public abstract AbstractOrderedTreeNode getParent();
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isLeaf() {
+ if (getChildCount() < 1) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the List of this node's parent's children, which includes this
+ * node.
+ * @return The List of this node's parent's children.
+ */
+ public abstract List<? extends AbstractOrderedTreeNode> getSiblings();
+
+ /**
+ * {@inheritDoc}
+ */
+ public int siblingIndex() {
+ final List<? extends AbstractOrderedTreeNode> siblings = getSiblings();
+ if (siblings == null) {
+ return -1;
+ }
+ return siblings.indexOf(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode getPreviousSibling() {
+ final int mySiblingIndex = siblingIndex();
+ if (mySiblingIndex < 1) {
+ return null;
+ }
+ return getSiblings().get(mySiblingIndex - 1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode getNextSibling() {
+ final int mySiblingIndex = siblingIndex();
+ if (mySiblingIndex < 0) {
+ return null;
+ }
+ // If the above test was passed, then getSiblings() is not null.
+ if (mySiblingIndex >= getSiblings().size() - 1) {
+ return null;
+ }
+ return getSiblings().get(mySiblingIndex + 1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasChildren() {
+ if (getChildCount() > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode getFirstChild() {
+ final List<? extends AbstractOrderedTreeNode> children = getChildren();
+ if (children == null) {
+ return null;
+ }
+ if (children.size() < 1) {
+ return null;
+ }
+ return children.get(0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode getLastChild() {
+ final List<? extends AbstractOrderedTreeNode> children = getChildren();
+ if (children == null) {
+ return null;
+ }
+ if (children.size() < 1) {
+ return null;
+ }
+ return children.get(children.size() - 1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode nextPreOrderNode() {
+ // Any children?
+ if (getChildCount() > 0) {
+ return getChildren().get(0);
+ }
+ AbstractOrderedTreeNode currentNode = this;
+ while (currentNode != null) {
+ currentNode = currentNode.getNextSibling();
+ if (currentNode != null) {
+ return currentNode;
+ }
+ // Go up a level and see if the parent has any siblings
+ currentNode = this.getParent();
+ }
+ // Current node is null; we are at the root of the tree.
+ return null;
+ }
+
+ /**
+ * Returns the next node in the tree relative to the current node, in
+ * post-order traversal order. This is also known as depth-first order.
+ * @return The next post-order node, or null if there is none.
+ */
+ public AbstractOrderedTreeNode nextPostOrderNode() {
+ /* All of the children would come before this. */
+ /* If there are siblings, they or their descendants come next. */
+ final AbstractOrderedTreeNode nextSibling = this.getNextSibling();
+ if (nextSibling != null) {
+ return nextSibling.getFirstLeaf();
+ }
+ /* If there are no siblings, then the parent's children are all
+ * processed, and the parent is the next node. If that happens to be
+ * null, then we are done, and null is what should be returned. */
+ return this.getParent();
+ }
+
+ /**
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ */
+ public AbstractOrderedTreeNode getFirstLeaf() {
+ AbstractOrderedTreeNode node = this;
+ while (!node.isLeaf()) {
+ node = node.getFirstChild();
+ }
+ return node;
+ }
+
+ /**
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ */
+ public AbstractOrderedTreeNode getLastLeaf() {
+ AbstractOrderedTreeNode node = this;
+ while (!node.isLeaf()) {
+ node = node.getLastChild();
+ }
+ return node;
+ }
+
+ /**
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ */
+ public AbstractOrderedTreeNode getNextLeaf() {
+ final AbstractOrderedTreeNode myParent = getParent();
+ if (myParent == null) {
+ return null;
+ }
+ /* Linear search. */
+ final AbstractOrderedTreeNode nextSibling = getNextSibling();
+ if (nextSibling != null) {
+ return nextSibling.getFirstLeaf();
+ }
+ /* Tail recursion. */
+ return myParent.getNextLeaf();
+ }
+
+ /**
+ * {@inheritDoc}
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ */
+ public AbstractOrderedTreeNode getPreviousLeaf() {
+ final AbstractOrderedTreeNode myParent = getParent();
+ if (myParent == null) {
+ return null;
+ }
+ /* Linear search. */
+ final AbstractOrderedTreeNode previousSibling = getPreviousSibling();
+ if (previousSibling != null) {
+ return previousSibling.getLastLeaf();
+ }
+ /* Tail recursion. */
+ return myParent.getPreviousLeaf();
+ }
+
+ /**
+ * Returns true if <code>anotherNode</code> is an ancestor of this node
+ * -- if it is this node, this node's parent, or an ancestor of this
+ * node's parent. (Note that a node is considered an ancestor of itself.)
+ * If <code>anotherNode</code> is null, this method returns false. This
+ * operation is at worst O(h) where h is the distance from the root to
+ * this node.
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see #isNodeDescendant
+ * @see #getSharedAncestor
+ * @param anotherNode node to test as an ancestor of this node
+ * @return true if this node is a descendant of <code>anotherNode</code>
+ */
+ public boolean isNodeAncestor(final AbstractOrderedTreeNode anotherNode) {
+ if (anotherNode == null) {
+ return false;
+ }
+ AbstractOrderedTreeNode ancestor = this;
+ do {
+ if (ancestor == anotherNode) {
+ return true;
+ }
+ } while((ancestor = ancestor.getParent()) != null);
+ return false;
+ }
+
+ /**
+ * Returns true if <code>anotherNode</code> is a descendant of this node
+ * -- if it is this node, one of this node's children, or a descendant of
+ * one of this node's children. Note that a node is considered a
+ * descendant of itself. If <code>anotherNode</code> is null, returns
+ * false. This operation is at worst O(h) where h is the distance from the
+ * root to <code>anotherNode</code>.
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see #isNodeAncestor
+ * @see #getSharedAncestor
+ * @param anotherNode node to test as descendant of this node
+ * @return true if this node is an ancestor of <code>anotherNode</code>
+ */
+ public boolean isNodeDescendant(final AbstractOrderedTreeNode anotherNode) {
+ if (anotherNode == null) {
+ return false;
+ }
+ return anotherNode.isNodeAncestor(this);
+ }
+
+ /**
+ * Returns the nearest common ancestor to this node and <code>aNode</code>.
+ * Returns null, if no such ancestor exists -- if this node and
+ * <code>aNode</code> are in different trees or if <code>aNode</code> is
+ * null. A node is considered an ancestor of itself.
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see #isNodeAncestor
+ * @see #isNodeDescendant
+ * @param aNode node to find common ancestor with
+ * @return nearest ancestor common to this node and <code>aNode</code>,
+ * or null if none
+ */
+ public AbstractOrderedTreeNode getSharedAncestor(
+ final AbstractOrderedTreeNode aNode) {
+ if (aNode == this) {
+ return this;
+ } else if (aNode == null) {
+ return null;
+ }
+
+ int level1;
+ int level2;
+ int diff;
+ AbstractOrderedTreeNode node1;
+ AbstractOrderedTreeNode node2;
+
+ level1 = getLevel();
+ level2 = aNode.getLevel();
+
+ if (level2 > level1) {
+ diff = level2 - level1;
+ node1 = aNode;
+ node2 = this;
+ } else {
+ diff = level1 - level2;
+ node1 = this;
+ node2 = aNode;
+ }
+
+ // Go up the tree until the nodes are at the same level
+ while (diff > 0) {
+ node1 = node1.getParent();
+ diff--;
+ }
+
+ // Move up the tree until we find a common ancestor. Since we know
+ // that both nodes are at the same level, we won't cross paths
+ // unknowingly (if there is a common ancestor, both nodes hit it in
+ // the same iteration).
+
+ do {
+ if (node1 == node2) {
+ return node1;
+ }
+ node1 = node1.getParent();
+ node2 = node2.getParent();
+ } while (node1 != null);
+ /* Only need to check one -- they're at the same level so if one is
+ * null, so is the other one. */
+
+ if (node1 != null || node2 != null) {
+ throw new Error("nodes should be null");
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the number of levels above this node -- the distance from
+ * the root to this node. If this node is the root, returns 0.
+ * This implementation was liberated from {@link DefaultMutableTreeNode}).
+ * @return The number of levels above this node.
+ */
+ public int getLevel() {
+ int levels = 0;
+ AbstractOrderedTreeNode ancestor = this;
+ while ((ancestor = ancestor.getParent()) != null) {
+ levels++;
+ }
+ return levels;
+ }
+
+ /**
+ * A post-order iterator over the descendants of a given node.
+ */
+ public final class PostOrderDescendantIterator
+ implements java.util.Iterator<AbstractOrderedTreeNode> {
+
+ /** The root node whose descendants are being iterated. */
+ private AbstractOrderedTreeNode root;
+
+ /** The next post-order node to be returned. */
+ private AbstractOrderedTreeNode nextPostOrderNode;
+
+ /**
+ * Private constructor.
+ * @param root The node whose descendants should be iterated by this
+ * iterator.
+ */
+ private PostOrderDescendantIterator(
+ final AbstractOrderedTreeNode root) {
+ this.root = root;
+ if (root.getChildCount() < 1) {
+ this.nextPostOrderNode = null;
+ } else {
+ this.nextPostOrderNode =
+ this.root.getFirstChild().getFirstLeaf();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasNext() {
+ return this.nextPostOrderNode != null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AbstractOrderedTreeNode next() {
+ if (this.nextPostOrderNode == null) {
+ throw new NoSuchElementException("This iterator has no more "
+ + "nodes.");
+ }
+ final AbstractOrderedTreeNode returnNode = this.nextPostOrderNode;
+ this.setNextNode();
+ return returnNode;
+ }
+
+ /**
+ * Finds and records the next node to be returned by the iterator.
+ */
+ private void setNextNode() {
+ final AbstractOrderedTreeNode provisionalNextNode =
+ this.nextPostOrderNode.nextPostOrderNode();
+ if (provisionalNextNode == null) {
+ this.nextPostOrderNode = null;
+ return;
+ }
+ if (provisionalNextNode.isNodeAncestor(this.root)) {
+ this.nextPostOrderNode = provisionalNextNode;
+ } else {
+ this.nextPostOrderNode = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void remove() {
+ throw new UnsupportedOperationException("The \"remove\" operation "
+ + "is not supported by this iterator.");
+ }
+
+ }
+
+}
Deleted: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-04 23:51:01 UTC (rev 9701)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-06 15:29:53 UTC (rev 9702)
@@ -1,518 +0,0 @@
-/*
- * Copyright 2005 The FOray Project.
- * http://www.foray.org
- *
- * 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.
- *
- * This work is in part derived from the following work(s), used with the
- * permission of the licensor:
- * Apache FOP, licensed by the Apache Software Foundation
- *
- */
-
-/*
- * $LastChangedRevision$
- * $LastChangedDate$
- * $LastChangedBy$
- */
-
-package org.foray.common;
-
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeNode;
-
-/**
- * An implementation of the {@link TreeNode} interface that provides methods for
- * various traversal needs.
- *
- * <p>Consideration was given to using {@link DefaultMutableTreeNode} instead of
- * creating this class.
- * However, the data portion of that class was not deemed suitable.</p>
- */
-public abstract class OrderedTreeNode
- implements org.axsl.common.OrderedTreeNode {
-
- /**
- * Constructor.
- */
- public OrderedTreeNode() {
- }
-
- /**
- * {@inheritDoc}
- */
- public Enumeration<? extends OrderedTreeNode> children() {
- return Collections.enumeration(this.getChildren());
- }
-
- /**
- * Returns an iterator that will iterate the descendant nodes of this node
- * in post-traversal (depth-first) order.
- * @return A post-traversal iterator of this node's descendants.
- */
- public Iterator<OrderedTreeNode> postOrderDescendantIterator() {
- return new PostOrderDescendantIterator(this);
- }
-
- /**
- * Return the List of this node's children.
- * @return The List of this node's children.
- */
- public abstract List<? extends OrderedTreeNode>
- getChildren();
-
- /**
- * {@inheritDoc}
- */
- public abstract boolean getAllowsChildren();
-
- /**
- * {@inheritDoc}
- */
- public OrderedTreeNode getChildAt(final int childIndex) {
- if (childIndex < 0) {
- return null;
- }
- if (childIndex >= getChildren().size()) {
- return null;
- }
- return getChildren().get(childIndex);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getChildCount() {
- if (getChildren() == null) {
- return 0;
- }
- return getChildren().size();
- }
-
- /**
- * {@inheritDoc}
- */
- public int getIndex(final TreeNode node) {
- if (getChildren() == null) {
- return -1;
- }
- return getChildren().indexOf(node);
- }
-
- /**
- * {@inheritDoc}
- */
- public abstract OrderedTreeNode getParent();
-
- /**
- * {@inheritDoc}
- */
- public boolean isLeaf() {
- if (getChildCount() < 1) {
- return true;
- }
- return false;
- }
-
- /**
- * Returns the List of this node's parent's children, which includes this
- * node.
- * @return The List of this node's parent's children.
- */
- public abstract List<? extends OrderedTreeNode> getSiblings();
-
- /**
- * {@inheritDoc}
- */
- public int siblingIndex() {
- final List<? extends OrderedTreeNode> siblings = getSiblings();
- if (siblings == null) {
- return -1;
- }
- return siblings.indexOf(this);
- }
-
- /**
- * {@inheritDoc}
- */
- public OrderedTreeNode getPreviousSibling() {
- final int mySiblingIndex = siblingIndex();
- if (mySiblingIndex < 1) {
- return null;
- }
- return getSiblings().get(mySiblingIndex - 1);
- }
-
- /**
- * {@inheritDoc}
- */
- public OrderedTreeNode getNextSibling() {
- final int mySiblingIndex = siblingIndex();
- if (mySiblingIndex < 0) {
- return null;
- }
- // If the above test was passed, then getSiblings() is not null.
- if (mySiblingIndex >= getSiblings().size() - 1) {
- return null;
- }
- return getSiblings().get(mySiblingIndex + 1);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasChildren() {
- if (getChildCount() > 0) {
- return true;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public OrderedTreeNode getFirstChild() {
- final List<? extends OrderedTreeNode> children = getChildren();
- if (children == null) {
- return null;
- }
- if (children.size() < 1) {
- return null;
- }
- return children.get(0);
- }
-
- /**
- * {@inheritDoc}
- */
- public OrderedTreeNode getLastChild() {
- final List<? extends OrderedTreeNode> children = getChildren();
- if (children == null) {
- return null;
- }
- if (children.size() < 1) {
- return null;
- }
- return children.get(children.size() - 1);
- }
-
- /**
- * {@inheritDoc}
- */
- public OrderedTreeNode nextPreOrderNode() {
- // Any children?
- if (getChildCount() > 0) {
- return getChildren().get(0);
- }
- OrderedTreeNode currentNode = this;
- while (currentNode != null) {
- currentNode = currentNode.getNextSibling();
- if (currentNode != null) {
- return currentNode;
- }
- // Go up a level and see if the parent has any siblings
- currentNode = this.getParent();
- }
- // Current node is null; we are at the root of the tree.
- return null;
- }
-
- /**
- * Returns the next node in the tree relative to the current node, in
- * post-order traversal order. This is also known as depth-first order.
- * @return The next post-order node, or null if there is none.
- */
- public OrderedTreeNode nextPostOrderNode() {
- /* All of the children would come before this. */
- /* If there are siblings, they or their descendants come next. */
- final OrderedTreeNode nextSibling = this.getNextSibling();
- if (nextSibling != null) {
- return nextSibling.getFirstLeaf();
- }
- /* If there are no siblings, then the parent's children are all
- * processed, and the parent is the next node. If that happens to be
- * null, then we are done, and null is what should be returned. */
- return this.getParent();
- }
-
- /**
- * {@inheritDoc}
- * This implementation was liberated from {@link DefaultMutableTreeNode}).
- */
- public OrderedTreeNode getFirstLeaf() {
- OrderedTreeNode node = this;
- while (!node.isLeaf()) {
- node = node.getFirstChild();
- }
- return node;
- }
-
- /**
- * {@inheritDoc}
- * This implementation was liberated from {@link DefaultMutableTreeNode}).
- */
- public OrderedTreeNode getLastLeaf() {
- OrderedTreeNode node = this;
- while (!node.isLeaf()) {
- node = node.getLastChild();
- }
- return node;
- }
-
- /**
- * {@inheritDoc}
- * This implementation was liberated from {@link DefaultMutableTreeNode}).
- ...
[truncated message content] |
|
From: <vic...@us...> - 2007-06-06 16:30:46
|
Revision: 9703
http://svn.sourceforge.net/foray/?rev=9703&view=rev
Author: victormote
Date: 2007-06-06 09:27:11 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Conform to axsl changes in the inheritance structure of the tree structures, including moving the OrderedTreeNode interface from axsl to foray.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBorder.java
trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -37,9 +37,8 @@
import org.foray.area.RegionRABody;
import org.foray.area.SpanRA;
import org.foray.area.TextArea;
+import org.foray.common.OrderedTreeNode;
-import org.axsl.common.OrderedTreeNode;
-
import java.util.Iterator;
import junit.framework.TestCase;
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -33,10 +33,9 @@
import org.foray.area.NormalBlockArea;
import org.foray.area.NormalFlowRA;
import org.foray.area.PageCollection;
+import org.foray.common.OrderedTreeNode;
import org.foray.core.FOrayException;
-import org.axsl.common.OrderedTreeNode;
-
/**
* Tests of various block-related concepts at the Area Tree level.
*/
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBorder.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBorder.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBorder.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -31,10 +31,9 @@
import org.foray.area.AreaTree;
import org.foray.area.NormalBlockArea;
import org.foray.area.NormalFlowRA;
+import org.foray.common.OrderedTreeNode;
import org.foray.core.FOrayException;
-import org.axsl.common.OrderedTreeNode;
-
/**
* Tests of various border-related concepts at the Area Tree level.
*/
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/NormalBlockArea.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -268,7 +268,7 @@
* actually have children. If the FONode has no children, then an empty
* area is needed in the area tree. */
if (! this.hasChildren()
- && this.traitGeneratedBy().hasChildren()) {
+ && this.traitGeneratedBy().getChildCount() != 0) {
return true;
}
return false;
Modified: trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -46,7 +46,7 @@
* However, the data portion of that class was not deemed suitable.</p>
*/
public abstract class AbstractOrderedTreeNode
- implements org.axsl.common.OrderedTreeNode {
+ implements OrderedTreeNode {
/**
* Constructor.
Added: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2006 The FOray Project.
+ * http://www.foray.org
+ *
+ * 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+
+/**
+ * A {@link TreeNode} that is aware of its relationships not only to its parents
+ * and children, but also to its siblings.
+ * The order and placement of children is significant.
+ */
+public interface OrderedTreeNode extends TreeNode {
+
+ /**
+ * Returns this node's position within the siblings.
+ * @return The index to "this" in the parent's children.
+ */
+ int siblingIndex();
+
+ /**
+ * Returns the previous sibling node.
+ * @return Return the sibling immediately preceding "this" in the parent's
+ * children, or null if this is the first child.
+ */
+ OrderedTreeNode getPreviousSibling();
+
+ /**
+ * Returns the next sibling node.
+ * @return Return the sibling immediately following "this" in the parent's
+ * children, or null if this is the last child.
+ */
+ OrderedTreeNode getNextSibling();
+
+ /**
+ * Reports whether this node has any children.
+ * @return True if this node has any children, false if it has none.
+ */
+ boolean hasChildren();
+
+ /**
+ * Returns the first child of this node.
+ * @return The first child of this node, or null if this node has no
+ * children.
+ */
+ OrderedTreeNode getFirstChild();
+
+ /**
+ * Returns the last child of this node.
+ * @return The last child of this node, or null if this node has no
+ * children.
+ */
+ OrderedTreeNode getLastChild();
+
+ /**
+ * Returns the next node in the tree relative to the current node, in
+ * pre-order traversal order. This is also known as breadth-first order.
+ * @return The next pre-order node, or null if there is none.
+ */
+ OrderedTreeNode nextPreOrderNode();
+
+ /**
+ * Returns the next node in the tree relative to the current node, in
+ * post-order traversal order. This is also known as depth-first order.
+ * @return The next post-order node, or null if there is none.
+ */
+ OrderedTreeNode nextPostOrderNode();
+
+ /**
+ * Finds and returns the first leaf that is a descendant of this node --
+ * either this node or its first child's first leaf.
+ * Returns this node if it is a leaf.
+ * (Liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see TreeNode#isLeaf
+ * @see DefaultMutableTreeNode#isNodeDescendant
+ * @return the first leaf in the subtree rooted at this node
+ */
+ OrderedTreeNode getFirstLeaf();
+
+
+ /**
+ * Finds and returns the last leaf that is a descendant of this node --
+ * either this node or its last child's last leaf.
+ * Returns this node if it is a leaf.
+ * (Liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see TreeNode#isLeaf
+ * @see DefaultMutableTreeNode#isNodeDescendant
+ * @return the last leaf in the subtree rooted at this node
+ */
+ OrderedTreeNode getLastLeaf();
+
+ /**
+ * Returns the leaf after this node or null if this node is the
+ * last leaf in the tree.
+ * <p>
+ * In this implementation of the <code>MutableNode</code> interface,
+ * this operation is very inefficient. In order to determine the
+ * next node, this method first performs a linear search in the
+ * parent's child-list in order to find the current node.
+ * <p>
+ * That implementation makes the operation suitable for short
+ * traversals from a known position. But to traverse all of the
+ * leaves in the tree, you should use <code>depthFirstEnumeration</code>
+ * to enumerate the nodes in the tree and use <code>isLeaf</code>
+ * on each node to determine which are leaves.
+ * (Liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see DefaultMutableTreeNode#depthFirstEnumeration
+ * @see TreeNode#isLeaf
+ * @return returns the next leaf past this node
+ */
+ OrderedTreeNode getNextLeaf();
+
+
+ /**
+ * Returns the leaf before this node or null if this node is the
+ * first leaf in the tree.
+ * <p>
+ * In this implementation of the <code>MutableNode</code> interface,
+ * this operation is very inefficient. In order to determine the
+ * previous node, this method first performs a linear search in the
+ * parent's child-list in order to find the current node.
+ * <p>
+ * That implementation makes the operation suitable for short
+ * traversals from a known position. But to traverse all of the
+ * leaves in the tree, you should use <code>depthFirstEnumeration</code>
+ * to enumerate the nodes in the tree and use <code>isLeaf</code>
+ * on each node to determine which are leaves.
+ * (Liberated from {@link DefaultMutableTreeNode}).
+ *
+ * @see DefaultMutableTreeNode#depthFirstEnumeration
+ * @see TreeNode#isLeaf
+ * @return returns the leaf before this node
+ */
+ OrderedTreeNode getPreviousLeaf();
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -71,7 +71,7 @@
// See if ancestor table has generated any areas yet.
final TableArea tableArea = areaNode.ancestorTableArea();
- if (tableArea != null && tableArea.getPreviousSibling() != null) {
+ if (tableArea != null && tableArea.siblingIndex() != 0) {
final int numChildren = this.label.getChildren().size();
for (int i = getProgress(); i < numChildren; i++) {
final FoNode fo = this.label.getChildren().get(i);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -118,7 +118,7 @@
final FootnoteRA footArea) throws AreaWException {
/* TODO: It seems like this logic should be done once when the
* PageCollection is first started, and cached there for reuse. */
- if (footArea.hasChildren()) {
+ if (footArea.getChildCount() != 0) {
return;
}
final PageSequence pageSeq = bac.getPage()
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2007-06-06 15:29:53 UTC (rev 9702)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java 2007-06-06 16:27:11 UTC (rev 9703)
@@ -274,7 +274,8 @@
switch (node.traitBreakBefore(area)) {
case PAGE: {
// if first ColumnArea, and empty, return OK
- if (!colArea.hasChildren() && (colArea.siblingIndex() == 0)) {
+ if (colArea.getChildCount() == 0
+ && (colArea.siblingIndex() == 0)) {
return Status.OK;
}
return Status.FORCE_PAGE_BREAK;
@@ -282,7 +283,8 @@
case ODD_PAGE: {
// if first ColumnArea, empty, _and_ in odd page,
// return OK
- if (!colArea.hasChildren() && (colArea.siblingIndex() == 0)
+ if (colArea.getChildCount() == 0
+ && (colArea.siblingIndex() == 0)
&& (colArea.getPage().getNumber() % 2 != 0)) {
return Status.OK;
}
@@ -291,7 +293,8 @@
case EVEN_PAGE: {
// if first ColumnArea, empty, _and_ in even page,
// return OK
- if (!colArea.hasChildren() && (colArea.siblingIndex() == 0)
+ if (colArea.getChildCount() == 0
+ && (colArea.siblingIndex() == 0)
&& (colArea.getPage().getNumber() % 2 == 0)) {
return Status.OK;
}
@@ -299,7 +302,7 @@
}
case COLUMN: {
// if ColumnArea is empty return OK
- if (!area.hasChildren()) {
+ if (colArea.getChildCount() == 0) {
return Status.OK;
}
return Status.FORCE_COLUMN_BREAK;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-06 21:03:22
|
Revision: 9705
http://svn.sourceforge.net/foray/?rev=9705&view=rev
Author: victormote
Date: 2007-06-06 14:00:10 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Reduce dependencies on getChildren() methods in the tree structures.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/StaticContentPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -222,9 +222,9 @@
final BookmarkTreeArea bmtArea = BookmarkTreeArea.makeBookmarkTreeArea(
bookmarkTree, this);
this.children.add(bmtArea);
- for (int i = 0; i < bookmarkTree.getChildren().size(); i++) {
+ for (int i = 0; i < bookmarkTree.getChildCount(); i++) {
final Bookmark bookmark = (Bookmark)
- bookmarkTree.getChildren().get(i);
+ bookmarkTree.getChildAt(i);
bmtArea.makeBookmarkArea(bookmark);
}
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BookmarkArea.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -30,7 +30,6 @@
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
-import org.axsl.foR.FoNode;
import org.axsl.foR.Fo;
import org.axsl.foR.fo.Bookmark;
import org.axsl.foR.fo.BookmarkTitle;
@@ -140,9 +139,8 @@
* @param bookmark The "generated-by" Bookmark.
*/
public void makeChildren(final Bookmark bookmark) {
- final List<? extends FoNode> children = bookmark.getChildren();
- for (int i = 0; i < children.size(); i++) {
- final Fo child = (Fo) children.get(i);
+ for (int i = 0; i < bookmark.getChildCount(); i++) {
+ final Fo child = (Fo) bookmark.getChildAt(i);
if (child instanceof Bookmark) {
this.makeBookmarkArea((Bookmark) child);
} else if (child instanceof BookmarkTitle) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/AbstractTablePartPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -113,11 +113,11 @@
}
List<TableRow> keepWith = new ArrayList<TableRow>();
- final int numChildren = node.getChildren().size();
+ final int numChildren = node.getChildCount();
TableRow lastRow = null;
boolean endKeepGroup = true;
for (int i = getProgress(); i < numChildren; i++) {
- final Object child = node.getChildren().get(i);
+ final Object child = node.getChildAt(i);
if (child instanceof Marker) {
final MarkerPL markerPL = (MarkerPL) getLayoutProxy(
(FoNode) child);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ContinuedLabelPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -72,9 +72,9 @@
// See if ancestor table has generated any areas yet.
final TableArea tableArea = areaNode.ancestorTableArea();
if (tableArea != null && tableArea.siblingIndex() != 0) {
- final int numChildren = this.label.getChildren().size();
+ final int numChildren = this.label.getChildCount();
for (int i = getProgress(); i < numChildren; i++) {
- final FoNode fo = this.label.getChildren().get(i);
+ final FoNode fo = this.label.getChildAt(i);
final Status status = getLayoutProxy(fo).layout(areaNode,
graftingPoint);
if (status.isIncomplete()) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FONodePL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -177,8 +177,8 @@
if (getProgress() == FONodePL.START) {
setProgress(0);
}
- for (int i = getProgress(); i < foNode.getChildren().size(); i++) {
- final FoNode fo = foNode.getChildren().get(i);
+ for (int i = getProgress(); i < foNode.getChildCount(); i++) {
+ final FoNode fo = foNode.getChildAt(i);
final Status status = getLayoutProxy(fo).layout(areaNode,
graftingPoint);
if (status.isIncomplete()) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FObjPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -128,8 +128,8 @@
if (start == FONodePL.START) {
start = 0;
}
- for (int i = start; i < node.getChildren().size(); i++) {
- final FoNode fo = node.getChildren().get(i);
+ for (int i = start; i < node.getChildCount(); i++) {
+ final FoNode fo = node.getChildAt(i);
final FONodePL nodePL = this.getLayoutProxy(fo);
final Status status = nodePL.layout(areaNode, graftingPoint);
if (status.isIncomplete()) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FlowPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -76,9 +76,9 @@
final RegionRABody bac = (RegionRABody) areaNode;
boolean prevChildMustKeepWithNext = false;
- final int numChildren = getFONode().getChildren().size();
+ final int numChildren = getFONode().getChildCount();
for (int i = getProgress(); i < numChildren; i++) {
- final Fo fo = (Fo) getFONode().getChildren().get(i);
+ final Fo fo = (Fo) getFONode().getChildAt(i);
if (bac.getMainRA().isBalancingRequired(fo)) {
// reset the the just-done span area in preparation
@@ -105,7 +105,7 @@
&& (getStatus().laidOutNone())) {
setProgress(i - 1);
final Fo prevChild =
- (Fo) getFONode().getChildren().get(getProgress());
+ (Fo) getFONode().getChildAt(getProgress());
final FObjPL prevChildPL = (FObjPL) getLayoutProxy(
prevChild);
prevChildPL.resetProgress();
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/FootnoteBodyPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -68,7 +68,7 @@
}
final FootnoteRA referenceArea = (FootnoteRA) areaNode;
- final int numChildren = this.node.getChildren().size();
+ final int numChildren = this.node.getChildCount();
for (int i = getProgress(); i < numChildren; i++) {
final FoNode fo = this.node.getChildAt(i);
final FONodePL foNodePL = getLayoutProxy(fo);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListBlockPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -79,9 +79,9 @@
final ListBlockArea blockArea = bcArea.makeListBlockArea(this.node,
graftingPoint);
- final int numChildren = this.node.getChildren().size();
+ final int numChildren = this.node.getChildCount();
for (int i = listBlockPL.getProgress(); i < numChildren; i++) {
- final ListItem listItem = (ListItem) this.node.getChildren().get(i);
+ final ListItem listItem = (ListItem) this.node.getChildAt(i);
final ListItemPL listItemPL = (ListItemPL) getLayoutProxy(
listItem);
Status status = listItemPL.layout(blockArea, graftingPoint);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemBodyPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -73,9 +73,9 @@
setProgress(0);
}
- final int numChildren = this.node.getChildren().size();
+ final int numChildren = this.node.getChildCount();
for (int i = getProgress(); i < numChildren; i++) {
- final Fo fo = (Fo) this.node.getChildren().get(i);
+ final Fo fo = (Fo) this.node.getChildAt(i);
final Status status = getLayoutProxy(fo).layout(container,
graftingPoint);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemLabelPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -72,9 +72,9 @@
if (getProgress() == FONodePL.START) {
setProgress(0);
}
- final int numChildren = this.node.getChildren().size();
+ final int numChildren = this.node.getChildCount();
for (int i = getProgress(); i < numChildren; i++) {
- final Fo fo = (Fo) this.node.getChildren().get(i);
+ final Fo fo = (Fo) this.node.getChildAt(i);
final Status status = getLayoutProxy(fo).layout(container,
graftingPoint);
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/ListItemPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -74,7 +74,7 @@
/* Lay out the list-item-label inside the new list-item area. */
final ListItemLabel label =
- (ListItemLabel) this.node.getChildren().get(0);
+ (ListItemLabel) this.node.getChildAt(0);
Status status;
/* What follows doesn't yet take into account whether the body failed
* completely or only got some text in. */
@@ -88,7 +88,7 @@
}
/* Lay out the list-item-body inside the new list-item area. */
- final ListItemBody body = (ListItemBody) this.node.getChildren().get(1);
+ final ListItemBody body = (ListItemBody) this.node.getChildAt(1);
final ListItemBodyPL bodyPL = (ListItemBodyPL) getLayoutProxy(body);
status = bodyPL.layout(group, graftingPoint);
if (status.isIncomplete()) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/RetrieveMarkerPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -72,8 +72,8 @@
// Necessary because the marker may get used multiple times.
markerPL.resetProgress();
markerPL.setProgress(0);
- for (int i = 0; i < bestMarker.getChildren().size(); i++) {
- final FoNode fo = bestMarker.getChildren().get(i);
+ for (int i = 0; i < bestMarker.getChildCount(); i++) {
+ final FoNode fo = bestMarker.getChildAt(i);
getLayoutProxy(fo).layout(areaNode, this.node);
}
return Status.OK;
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/StaticContentPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/StaticContentPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/StaticContentPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -58,10 +58,10 @@
*/
public Status layout(final AreaNode areaNode,
final GraftingPoint graftingPoint) throws AreaWException {
- final int numChildren = this.node.getChildren().size();
+ final int numChildren = this.node.getChildCount();
for (int i = 0; i < numChildren; i++) {
- final Fo fo = (Fo) this.node.getChildren().get(i);
+ final Fo fo = (Fo) this.node.getChildAt(i);
Status status = getLayoutProxy(fo).layout(areaNode, graftingPoint);
if (status.isIncomplete()) {
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -101,9 +101,9 @@
areaContainer = cellArea;
- final int numChildren = this.node.getChildren().size();
+ final int numChildren = this.node.getChildCount();
for (int i = getProgress(); bDone == false && i < numChildren; i++) {
- final Fo fo = (Fo) this.node.getChildren().get(i);
+ final Fo fo = (Fo) this.node.getChildAt(i);
// Overflows may cause a row to be re-layedout,
// need to pass already processed content.
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-06-06 19:46:38 UTC (rev 9704)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TablePL.java 2007-06-06 21:00:10 UTC (rev 9705)
@@ -102,7 +102,7 @@
/* Process the marker children. */
for (int i = getProgress(); i < table.qtyMarkerChildren(); i++) {
- final FoNode fo = table.getChildren().get(i);
+ final FoNode fo = table.getChildAt(i);
if (fo instanceof Marker) {
final MarkerPL markerPL = (MarkerPL) getLayoutProxy(fo);
markerPL.layout(areaNode, graftingPoint);
@@ -149,8 +149,8 @@
}
/* Process the table body(s). */
- for (int i = getProgress(); i < table.getChildren().size(); i++) {
- final FoNode fo = table.getChildren().get(i);
+ for (int i = getProgress(); i < table.getChildCount(); i++) {
+ final FoNode fo = table.getChildAt(i);
if (fo instanceof TableBody) {
status = getLayoutProxy(fo).layout(tableArea,
graftingPoint);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-06 21:40:18
|
Revision: 9706
http://svn.sourceforge.net/foray/?rev=9706&view=rev
Author: victormote
Date: 2007-06-06 14:34:43 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Conform to axsl changes requiring AreaNode to return an AreaNode for getChildAt(...).
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-06 21:00:10 UTC (rev 9705)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-06 21:34:43 UTC (rev 9706)
@@ -84,6 +84,19 @@
/**
* {@inheritDoc}
*/
+ public AreaNode getChildAt(final int childIndex) {
+ if (childIndex < 0) {
+ return null;
+ }
+ if (childIndex >= getChildren().size()) {
+ return null;
+ }
+ return getChildren().get(childIndex);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public List<? extends AreaNode> getSiblings() {
if (this.getParent() == null) {
return null;
Modified: trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 21:00:10 UTC (rev 9705)
+++ trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 21:34:43 UTC (rev 9706)
@@ -84,19 +84,6 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode getChildAt(final int childIndex) {
- if (childIndex < 0) {
- return null;
- }
- if (childIndex >= getChildren().size()) {
- return null;
- }
- return getChildren().get(childIndex);
- }
-
- /**
- * {@inheritDoc}
- */
public int getChildCount() {
if (getChildren() == null) {
return 0;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-06 21:00:10 UTC (rev 9705)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-06 21:34:43 UTC (rev 9706)
@@ -154,7 +154,13 @@
* {@inheritDoc}
*/
public FONode getChildAt(final int childIndex) {
- return (FONode) super.getChildAt(childIndex);
+ if (childIndex < 0) {
+ return null;
+ }
+ if (childIndex >= getChildren().size()) {
+ return null;
+ }
+ return getChildren().get(childIndex);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-06 22:48:47
|
Revision: 9709
http://svn.sourceforge.net/foray/?rev=9709&view=rev
Author: victormote
Date: 2007-06-06 15:46:35 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Cleanup of API for AbstractOrderedTreeNode, so that it returns and takes the interface type instead of the implementation type.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-06-06 22:21:00 UTC (rev 9708)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2007-06-06 22:46:35 UTC (rev 9709)
@@ -115,11 +115,10 @@
*/
protected String getText(final AreaNode node) {
final StringBuilder builder = new StringBuilder();
- final Iterator<org.foray.common.AbstractOrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode> iterator =
node.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final org.foray.common.AbstractOrderedTreeNode otn =
- iterator.next();
+ final OrderedTreeNode otn = iterator.next();
if (otn instanceof TextArea) {
final TextArea textArea = (TextArea) otn;
final char[] text = textArea.getRawText();
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-06-06 22:21:00 UTC (rev 9708)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-06-06 22:46:35 UTC (rev 9709)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.common.AbstractOrderedTreeNode;
+import org.foray.common.OrderedTreeNode;
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
@@ -160,10 +160,10 @@
}
this.optimized = true;
/* Resolve the page-number-citations. */
- final Iterator<AbstractOrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final AbstractOrderedTreeNode o = iterator.next();
+ final OrderedTreeNode o = iterator.next();
if (o instanceof PageNumberCitationArea) {
final PageNumberCitationArea pia = (PageNumberCitationArea) o;
pia.resolve();
@@ -219,10 +219,10 @@
if (leaderSpaceAvailable == 0) {
return;
}
- final Iterator<AbstractOrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final AbstractOrderedTreeNode object = iterator.next();
+ final OrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
boolean prorating = false;
@@ -248,10 +248,10 @@
private int computeLeaderCapacity(final int unusedSpace) {
// First, compute how much capacity the leaders have.
int leaderSpaceAvailable = 0;
- final Iterator<AbstractOrderedTreeNode> iterator =
+ final Iterator<OrderedTreeNode> iterator =
this.postOrderDescendantIterator();
while (iterator.hasNext()) {
- final AbstractOrderedTreeNode object = iterator.next();
+ final OrderedTreeNode object = iterator.next();
if (object instanceof LeaderArea) {
final LeaderArea leader = (LeaderArea) object;
if (unusedSpace > 0) {
Modified: trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 22:21:00 UTC (rev 9708)
+++ trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-06 22:46:35 UTC (rev 9709)
@@ -48,15 +48,9 @@
public abstract class AbstractOrderedTreeNode implements OrderedTreeNode {
/**
- * Constructor.
- */
- public AbstractOrderedTreeNode() {
- }
-
- /**
* {@inheritDoc}
*/
- public Enumeration<? extends AbstractOrderedTreeNode> children() {
+ public Enumeration<? extends OrderedTreeNode> children() {
return Collections.enumeration(this.getChildren());
}
@@ -65,7 +59,7 @@
* in post-traversal (depth-first) order.
* @return A post-traversal iterator of this node's descendants.
*/
- public Iterator<AbstractOrderedTreeNode> postOrderDescendantIterator() {
+ public Iterator<OrderedTreeNode> postOrderDescendantIterator() {
return new PostOrderDescendantIterator(this);
}
@@ -73,7 +67,7 @@
* Return the List of this node's children.
* @return The List of this node's children.
*/
- public abstract List<? extends AbstractOrderedTreeNode>
+ public abstract List<? extends OrderedTreeNode>
getChildren();
/**
@@ -104,7 +98,7 @@
/**
* {@inheritDoc}
*/
- public abstract AbstractOrderedTreeNode getParent();
+ public abstract OrderedTreeNode getParent();
/**
* {@inheritDoc}
@@ -121,13 +115,13 @@
* node.
* @return The List of this node's parent's children.
*/
- public abstract List<? extends AbstractOrderedTreeNode> getSiblings();
+ public abstract List<? extends OrderedTreeNode> getSiblings();
/**
* {@inheritDoc}
*/
public int siblingIndex() {
- final List<? extends AbstractOrderedTreeNode> siblings = getSiblings();
+ final List<? extends OrderedTreeNode> siblings = getSiblings();
if (siblings == null) {
return -1;
}
@@ -137,7 +131,7 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode getPreviousSibling() {
+ public OrderedTreeNode getPreviousSibling() {
final int mySiblingIndex = siblingIndex();
if (mySiblingIndex < 1) {
return null;
@@ -148,7 +142,7 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode getNextSibling() {
+ public OrderedTreeNode getNextSibling() {
final int mySiblingIndex = siblingIndex();
if (mySiblingIndex < 0) {
return null;
@@ -173,8 +167,8 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode getFirstChild() {
- final List<? extends AbstractOrderedTreeNode> children = getChildren();
+ public OrderedTreeNode getFirstChild() {
+ final List<? extends OrderedTreeNode> children = getChildren();
if (children == null) {
return null;
}
@@ -187,8 +181,8 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode getLastChild() {
- final List<? extends AbstractOrderedTreeNode> children = getChildren();
+ public OrderedTreeNode getLastChild() {
+ final List<? extends OrderedTreeNode> children = getChildren();
if (children == null) {
return null;
}
@@ -201,12 +195,12 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode nextPreOrderNode() {
+ public OrderedTreeNode nextPreOrderNode() {
// Any children?
if (getChildCount() > 0) {
return getChildren().get(0);
}
- AbstractOrderedTreeNode currentNode = this;
+ OrderedTreeNode currentNode = this;
while (currentNode != null) {
currentNode = currentNode.getNextSibling();
if (currentNode != null) {
@@ -224,10 +218,10 @@
* post-order traversal order. This is also known as depth-first order.
* @return The next post-order node, or null if there is none.
*/
- public AbstractOrderedTreeNode nextPostOrderNode() {
+ public OrderedTreeNode nextPostOrderNode() {
/* All of the children would come before this. */
/* If there are siblings, they or their descendants come next. */
- final AbstractOrderedTreeNode nextSibling = this.getNextSibling();
+ final OrderedTreeNode nextSibling = this.getNextSibling();
if (nextSibling != null) {
return nextSibling.getFirstLeaf();
}
@@ -241,8 +235,8 @@
* {@inheritDoc}
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
- public AbstractOrderedTreeNode getFirstLeaf() {
- AbstractOrderedTreeNode node = this;
+ public OrderedTreeNode getFirstLeaf() {
+ OrderedTreeNode node = this;
while (!node.isLeaf()) {
node = node.getFirstChild();
}
@@ -253,8 +247,8 @@
* {@inheritDoc}
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
- public AbstractOrderedTreeNode getLastLeaf() {
- AbstractOrderedTreeNode node = this;
+ public OrderedTreeNode getLastLeaf() {
+ OrderedTreeNode node = this;
while (!node.isLeaf()) {
node = node.getLastChild();
}
@@ -265,13 +259,13 @@
* {@inheritDoc}
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
- public AbstractOrderedTreeNode getNextLeaf() {
- final AbstractOrderedTreeNode myParent = getParent();
+ public OrderedTreeNode getNextLeaf() {
+ final OrderedTreeNode myParent = getParent();
if (myParent == null) {
return null;
}
/* Linear search. */
- final AbstractOrderedTreeNode nextSibling = getNextSibling();
+ final OrderedTreeNode nextSibling = getNextSibling();
if (nextSibling != null) {
return nextSibling.getFirstLeaf();
}
@@ -283,13 +277,13 @@
* {@inheritDoc}
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
- public AbstractOrderedTreeNode getPreviousLeaf() {
- final AbstractOrderedTreeNode myParent = getParent();
+ public OrderedTreeNode getPreviousLeaf() {
+ final OrderedTreeNode myParent = getParent();
if (myParent == null) {
return null;
}
/* Linear search. */
- final AbstractOrderedTreeNode previousSibling = getPreviousSibling();
+ final OrderedTreeNode previousSibling = getPreviousSibling();
if (previousSibling != null) {
return previousSibling.getLastLeaf();
}
@@ -304,7 +298,7 @@
if (anotherNode == null) {
return false;
}
- AbstractOrderedTreeNode ancestor = this;
+ OrderedTreeNode ancestor = this;
do {
if (ancestor == anotherNode) {
return true;
@@ -327,7 +321,7 @@
* @param anotherNode node to test as descendant of this node
* @return true if this node is an ancestor of <code>anotherNode</code>
*/
- public boolean isNodeDescendant(final AbstractOrderedTreeNode anotherNode) {
+ public boolean isNodeDescendant(final OrderedTreeNode anotherNode) {
if (anotherNode == null) {
return false;
}
@@ -347,8 +341,7 @@
* @return nearest ancestor common to this node and <code>aNode</code>,
* or null if none
*/
- public AbstractOrderedTreeNode getSharedAncestor(
- final AbstractOrderedTreeNode aNode) {
+ public OrderedTreeNode getSharedAncestor(final OrderedTreeNode aNode) {
if (aNode == this) {
return this;
} else if (aNode == null) {
@@ -358,8 +351,8 @@
int level1;
int level2;
int diff;
- AbstractOrderedTreeNode node1;
- AbstractOrderedTreeNode node2;
+ OrderedTreeNode node1;
+ OrderedTreeNode node2;
level1 = getLevel();
level2 = aNode.getLevel();
@@ -407,7 +400,7 @@
*/
public int getLevel() {
int levels = 0;
- AbstractOrderedTreeNode ancestor = this;
+ OrderedTreeNode ancestor = this;
while ((ancestor = ancestor.getParent()) != null) {
levels++;
}
@@ -418,13 +411,13 @@
* A post-order iterator over the descendants of a given node.
*/
public final class PostOrderDescendantIterator
- implements java.util.Iterator<AbstractOrderedTreeNode> {
+ implements java.util.Iterator<OrderedTreeNode> {
/** The root node whose descendants are being iterated. */
- private AbstractOrderedTreeNode root;
+ private OrderedTreeNode root;
/** The next post-order node to be returned. */
- private AbstractOrderedTreeNode nextPostOrderNode;
+ private OrderedTreeNode nextPostOrderNode;
/**
* Private constructor.
@@ -432,7 +425,7 @@
* iterator.
*/
private PostOrderDescendantIterator(
- final AbstractOrderedTreeNode root) {
+ final OrderedTreeNode root) {
this.root = root;
if (root.getChildCount() < 1) {
this.nextPostOrderNode = null;
@@ -452,12 +445,12 @@
/**
* {@inheritDoc}
*/
- public AbstractOrderedTreeNode next() {
+ public OrderedTreeNode next() {
if (this.nextPostOrderNode == null) {
throw new NoSuchElementException("This iterator has no more "
+ "nodes.");
}
- final AbstractOrderedTreeNode returnNode = this.nextPostOrderNode;
+ final OrderedTreeNode returnNode = this.nextPostOrderNode;
this.setNextNode();
return returnNode;
}
@@ -466,7 +459,7 @@
* Finds and records the next node to be returned by the iterator.
*/
private void setNextNode() {
- final AbstractOrderedTreeNode provisionalNextNode =
+ final OrderedTreeNode provisionalNextNode =
this.nextPostOrderNode.nextPostOrderNode();
if (provisionalNextNode == null) {
this.nextPostOrderNode = null;
Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-06 22:21:00 UTC (rev 9708)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-06 22:46:35 UTC (rev 9709)
@@ -39,6 +39,11 @@
public interface OrderedTreeNode extends TreeNode {
/**
+ * {@inheritDoc}
+ */
+ OrderedTreeNode getParent();
+
+ /**
* Returns this node's position within the siblings.
* @return The index to "this" in the parent's children.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-07 01:02:43
|
Revision: 9710
http://svn.sourceforge.net/foray/?rev=9710&view=rev
Author: victormote
Date: 2007-06-06 18:02:45 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
Conform to new axsl requirements for Iterable nodes by adding private inner class Iterator implementations.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-06 22:46:35 UTC (rev 9709)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-07 01:02:45 UTC (rev 9710)
@@ -39,7 +39,9 @@
import org.apache.commons.logging.Log;
+import java.util.Iterator;
import java.util.List;
+import java.util.NoSuchElementException;
/**
* Abstract superclass for all nodes in the AreaTree.
@@ -666,4 +668,46 @@
return area.crBPD();
}
+ /**
+ * {@inheritDoc}
+ */
+ public Iterator<org.axsl.areaR.AreaNode> iterator() {
+ return new ChildIterator();
+ }
+
+ /**
+ * Private inner class to provide an iterator over the children.
+ */
+ private class ChildIterator implements Iterator<org.axsl.areaR.AreaNode> {
+
+ /** Index to the next child element to be returned. */
+ private int nextIndex = 0;
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasNext() {
+ return nextIndex < getChildCount();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public AreaNode next() {
+ if (! hasNext()) {
+ throw new NoSuchElementException();
+ }
+ nextIndex ++;
+ return getChildAt(nextIndex - 1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-06 22:46:35 UTC (rev 9709)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-07 01:02:45 UTC (rev 9710)
@@ -33,12 +33,15 @@
import org.foray.fotree.fo.obj.Root;
import org.axsl.foR.FoContext;
+import org.axsl.foR.FoNode;
import org.axsl.foR.FoTreeException;
import org.axsl.foR.fo.GraftingPoint;
import org.apache.commons.logging.Log;
+import java.util.Iterator;
import java.util.List;
+import java.util.NoSuchElementException;
import javax.swing.tree.TreeNode;
@@ -244,4 +247,46 @@
return this.sequentialIndex;
}
+ /**
+ * {@inheritDoc}
+ */
+ public Iterator<FoNode> iterator() {
+ return new ChildIterator();
+ }
+
+ /**
+ * Private inner class to provide an iterator over the children.
+ */
+ private class ChildIterator implements Iterator<FoNode> {
+
+ /** Index to the next child element to be returned. */
+ private int nextIndex = 0;
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasNext() {
+ return nextIndex < getChildCount();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public FoNode next() {
+ if (! hasNext()) {
+ throw new NoSuchElementException();
+ }
+ nextIndex ++;
+ return getChildAt(nextIndex - 1);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-07 14:36:53
|
Revision: 9711
http://svn.sourceforge.net/foray/?rev=9711&view=rev
Author: victormote
Date: 2007-06-07 07:36:37 -0700 (Thu, 07 Jun 2007)
Log Message:
-----------
Add getOrderedParent method to the OrderedTreeNode interface to avoid casting conflicts with getParent.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -29,6 +29,7 @@
package org.foray.area;
import org.foray.common.AbstractOrderedTreeNode;
+import org.foray.common.OrderedTreeNode;
import org.axsl.areaW.AreaWException;
import org.axsl.foR.FoNode;
@@ -71,6 +72,13 @@
public abstract AreaNode getParent();
/**
+ * {@inheritDoc}
+ */
+ public OrderedTreeNode getOrderedParent() {
+ return this.getParent();
+ }
+
+ /**
* Sets the parent node.
* @param node The new parent node.
* @throws AreaWException If the parent node is not compatible with the
Modified: trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-common/src/java/org/foray/common/AbstractOrderedTreeNode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -98,11 +98,6 @@
/**
* {@inheritDoc}
*/
- public abstract OrderedTreeNode getParent();
-
- /**
- * {@inheritDoc}
- */
public boolean isLeaf() {
if (getChildCount() < 1) {
return true;
@@ -207,7 +202,7 @@
return currentNode;
}
// Go up a level and see if the parent has any siblings
- currentNode = this.getParent();
+ currentNode = this.getOrderedParent();
}
// Current node is null; we are at the root of the tree.
return null;
@@ -228,7 +223,7 @@
/* If there are no siblings, then the parent's children are all
* processed, and the parent is the next node. If that happens to be
* null, then we are done, and null is what should be returned. */
- return this.getParent();
+ return this.getOrderedParent();
}
/**
@@ -260,7 +255,7 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public OrderedTreeNode getNextLeaf() {
- final OrderedTreeNode myParent = getParent();
+ final OrderedTreeNode myParent = getOrderedParent();
if (myParent == null) {
return null;
}
@@ -278,7 +273,7 @@
* This implementation was liberated from {@link DefaultMutableTreeNode}).
*/
public OrderedTreeNode getPreviousLeaf() {
- final OrderedTreeNode myParent = getParent();
+ final OrderedTreeNode myParent = getOrderedParent();
if (myParent == null) {
return null;
}
@@ -303,7 +298,7 @@
if (ancestor == anotherNode) {
return true;
}
- } while((ancestor = ancestor.getParent()) != null);
+ } while((ancestor = ancestor.getOrderedParent()) != null);
return false;
}
@@ -369,7 +364,7 @@
// Go up the tree until the nodes are at the same level
while (diff > 0) {
- node1 = node1.getParent();
+ node1 = node1.getOrderedParent();
diff--;
}
@@ -382,8 +377,8 @@
if (node1 == node2) {
return node1;
}
- node1 = node1.getParent();
- node2 = node2.getParent();
+ node1 = node1.getOrderedParent();
+ node2 = node2.getOrderedParent();
} while (node1 != null);
/* Only need to check one -- they're at the same level so if one is
* null, so is the other one. */
@@ -401,7 +396,7 @@
public int getLevel() {
int levels = 0;
OrderedTreeNode ancestor = this;
- while ((ancestor = ancestor.getParent()) != null) {
+ while ((ancestor = ancestor.getOrderedParent()) != null) {
levels++;
}
return levels;
Modified: trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-common/src/java/org/foray/common/OrderedTreeNode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -39,9 +39,10 @@
public interface OrderedTreeNode extends TreeNode {
/**
- * {@inheritDoc}
+ * Returns the parent of this node, cast as an OrderedTreeNode.
+ * @return The parent of this node.
*/
- OrderedTreeNode getParent();
+ OrderedTreeNode getOrderedParent();
/**
* Returns this node's position within the siblings.
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-07 01:02:45 UTC (rev 9710)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FONode.java 2007-06-07 14:36:37 UTC (rev 9711)
@@ -29,6 +29,7 @@
package org.foray.fotree;
import org.foray.common.AbstractOrderedTreeNode;
+import org.foray.common.OrderedTreeNode;
import org.foray.fotree.fo.obj.Marker;
import org.foray.fotree.fo.obj.Root;
@@ -92,6 +93,13 @@
/**
* {@inheritDoc}
*/
+ public OrderedTreeNode getOrderedParent() {
+ return this.getParent();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public abstract List<? extends FONode> getChildren();
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-07 19:58:19
|
Revision: 9715
http://svn.sourceforge.net/foray/?rev=9715&view=rev
Author: victormote
Date: 2007-06-07 12:58:21 -0700 (Thu, 07 Jun 2007)
Log Message:
-----------
1. Add a jar file (from aXSL) containing the basic SVG java bindings.
2. Replace AreaTree dependency on Batik with a dependency on the SVG bindings.
Modified Paths:
--------------
trunk/foray/foray-areatree/.classpath
trunk/foray/foray-areatree/scripts/build.xml
Added Paths:
-----------
trunk/foray/lib/svg-1.1-readme.txt
trunk/foray/lib/svg-1.1.jar
Modified: trunk/foray/foray-areatree/.classpath
===================================================================
--- trunk/foray/foray-areatree/.classpath 2007-06-07 19:31:30 UTC (rev 9714)
+++ trunk/foray/foray-areatree/.classpath 2007-06-07 19:58:21 UTC (rev 9715)
@@ -12,7 +12,7 @@
<classpathentry kind="src" path="/axslText"/>
<classpathentry combineaccessrules="false" kind="src" path="/axslArea-W"/>
<classpathentry kind="lib" path="/FOray Lib-Build/junit/junit.jar"/>
- <classpathentry kind="lib" path="/FOray Lib/batik.jar"/>
<classpathentry kind="lib" path="/FOray Lib/commons-logging-1.1.jar" sourcepath="/FOray Lib-Build/commons-logging/commons-logging-1.1-src.zip"/>
+ <classpathentry kind="lib" path="/FOray Lib/svg-1.1.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-areatree/scripts/build.xml
===================================================================
--- trunk/foray/foray-areatree/scripts/build.xml 2007-06-07 19:31:30 UTC (rev 9714)
+++ trunk/foray/foray-areatree/scripts/build.xml 2007-06-07 19:58:21 UTC (rev 9715)
@@ -22,8 +22,7 @@
<include name="**/axsl*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
- <include name="xml-apis.jar"/>
- <include name="batik.jar"/>
+ <include name="svg-*.jar"/>
<include name="axsl*.jar"/>
<include name="commons-logging-*.jar"/>
</fileset>
Added: trunk/foray/lib/svg-1.1-readme.txt
===================================================================
--- trunk/foray/lib/svg-1.1-readme.txt (rev 0)
+++ trunk/foray/lib/svg-1.1-readme.txt 2007-06-07 19:58:21 UTC (rev 9715)
@@ -0,0 +1,23 @@
+Notes for svg-1.1.jar
+=====================
+There does not seem to be a standard jar file containing the SVG
+bindings for java.
+
+The SVG jar file distributed with FOray is the same as that
+distributed with aXSL, and is built using the "svg-lib" target of the
+aXSL Ant build script. See that script for documentation of the
+sources of the build. Essentially the build downloads the java
+bindings from www.w3c.org, then compiles a bare minimum subset of the
+classes needed for aXSL.
+
+The substance of the contents of this jar file can be found in other
+distributions. For example, Apache Batik contains these same class
+files. However, FOray's modular design does not allow for introduction
+of dependencies on Batik unless such a dependency is needed (for
+example in the Graphics module). Other modules which need access to
+the SVG java bindings, but do not need implementation details, should
+use this SVG jar.
+
+Victor Mote, April 29, 2006
+
+# Last Line of Memo. #
Property changes on: trunk/foray/lib/svg-1.1-readme.txt
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/lib/svg-1.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/foray/lib/svg-1.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-06-07 20:35:21
|
Revision: 9716
http://svn.sourceforge.net/foray/?rev=9716&view=rev
Author: victormote
Date: 2007-06-07 13:35:18 -0700 (Thu, 07 Jun 2007)
Log Message:
-----------
Remove a Batik dependency.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java
trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java 2007-06-07 19:58:21 UTC (rev 9715)
+++ trunk/foray/foray-common/src/java/org/foray/common/XMLUtil.java 2007-06-07 20:35:18 UTC (rev 9716)
@@ -34,6 +34,14 @@
public final class XMLUtil {
/**
+ * The namespace declaration to be assigned to the namespace definition
+ * in XML documents.
+ * @see "http://www.w3.org/2000/xmlns/"
+ */
+ public static final String XMLNS_NAMESPACE_URI =
+ "http://www.w3.org/2000/xmlns/";
+
+ /**
* This class should never be instantiated.
*/
private XMLUtil() { }
Modified: trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2007-06-07 19:58:21 UTC (rev 9715)
+++ trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2007-06-07 20:35:18 UTC (rev 9716)
@@ -29,6 +29,7 @@
package org.foray.render.svg;
import org.foray.common.WKConstants;
+import org.foray.common.XMLUtil;
import org.foray.output.OutputConfig;
import org.foray.render.Renderer;
@@ -49,7 +50,6 @@
import org.axsl.graphicR.SVGGraphic;
import org.apache.batik.dom.svg.SVGDOMImplementation;
-import org.apache.batik.dom.util.XMLSupport;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
@@ -589,7 +589,7 @@
// this fixes a problem where the xmlns is repeated sometimes
final Element ele = (Element) newsvg;
- ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
+ ele.setAttributeNS(XMLUtil.XMLNS_NAMESPACE_URI, "xmlns",
SVGRenderer.SVG_NS);
if (ele.hasAttributeNS(null, "xmlns")) {
ele.removeAttributeNS(null, "xmlns");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|