[FOray-commit] SF.net SVN: foray: [9920] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-07-03 22:25:05
|
Revision: 9920
http://svn.sourceforge.net/foray/?rev=9920&view=rev
Author: victormote
Date: 2007-07-03 15:25:04 -0700 (Tue, 03 Jul 2007)
Log Message:
-----------
Conform to axsl changes replacing method parameter with new method in FoContext.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/AbstractPropertyTest.java
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestColumnWidth.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/OverrideGraftingContext.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-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaNode.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -35,6 +35,7 @@
import org.axsl.fo.Fo;
import org.axsl.fo.FoNode;
import org.axsl.fo.fo.GraftingPoint;
+import org.axsl.fo.fo.Table;
import org.axsl.font.FontConsumer;
import org.axsl.text.TextServer;
@@ -516,6 +517,18 @@
}
/**
+ * Retujrns this if it is an instance of {@link TableRA}, or the nearest
+ * ancestor {@link TableRA} if it is not.
+ * @return This or the nearest ancestor Table.
+ */
+ public TableRA nearestTableArea() {
+ if (this instanceof TableRA) {
+ return (TableRA) this;
+ }
+ return this.ancestorTableArea();
+ }
+
+ /**
* Returns the ancestor page collection for this area.
* @return The ancestor page collection.
*/
@@ -719,4 +732,18 @@
}
+ /**
+ * {@inheritDoc}
+ */
+ public int widthNearestTable() {
+ final TableRA tableRA = this.nearestTableArea();
+ if (tableRA == null) {
+ throw new IllegalStateException("Attempted to get the width of "
+ + "the nearest table in a context that is not inside a "
+ + "table.");
+ }
+ final Table table = tableRA.traitGeneratedBy();
+ return table.traitIpDimensionOpt(tableRA);
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableRA.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -146,7 +146,7 @@
/**
* Returns the resolved width of a given column.
* The value returned here can be different from the nominal column-width
- * returned by {@link TableColumn#traitColumnWidth(FoContext, int)}
+ * returned by {@link TableColumn#traitColumnWidth(FoContext)}
* because of allocation of excesses or deficiencies in the table width.
* @param columnNumber The column whose resolved width is needed.
* @return The computed column-width, in millipoints.
@@ -280,7 +280,6 @@
*/
private int calcFixedColumnWidths(final int maxAllocationIPD) {
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
@@ -300,13 +299,11 @@
/* 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) {
+ && column.traitColumnWidth(this) == 0) {
tuMin = tu;
}
totalTableUnits += tu;
- totalFixedWidth += column.traitColumnWidth(this,
- tableWidth);
+ totalFixedWidth += column.traitColumnWidth(this);
}
}
@@ -406,7 +403,7 @@
* dUnitLength);
} else {
//Fixed width
- colWidth = column.traitColumnWidth(this, tableWidth);
+ colWidth = column.traitColumnWidth(this);
}
// Check minimum values and adjust if necessary
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -1008,17 +1008,15 @@
* @param fobj The FObj to which the property belongs.
* @param context An object that knows how to resolve FO Tree context
* issues.
- * @param tableWidth The width of the table, in millipoints.
* @return The <em>nominal</em> width.
*/
- public int getColumnWidth(final FObj fobj, final FoContext context,
- final int tableWidth) {
+ public int getColumnWidth(final FObj fobj, final FoContext context) {
final ColumnWidth property = (ColumnWidth) getProperty(
FoProperty.COLUMN_WIDTH);
if (property == null) {
return ColumnWidth.getValueNoInstance();
}
- return property.getValue(context, fobj, tableWidth);
+ return property.getValue(context, fobj);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableColumn.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -200,8 +200,8 @@
/**
* {@inheritDoc}
*/
- public int traitColumnWidth(final FoContext context, final int tableWidth) {
- return this.getPropertyList().getColumnWidth(this, context, tableWidth);
+ public int traitColumnWidth(final FoContext context) {
+ return this.getPropertyList().getColumnWidth(this, context);
}
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -87,12 +87,11 @@
* Returns the value of this property.
* @param context An object that knows how to resolve FO context issues.
* @param fobj The FO for which this value is needed.
- * @param tableWidth The width of the parent table area.
* @return The value of this property.
*/
- public int getValue(final FoContext context, final FObj fobj,
- final int tableWidth) {
+ public int getValue(final FoContext context, final FObj fobj) {
if (value().canEvalPercentage()) {
+ final int tableWidth = context.widthNearestTable();
final float percentage = value().evalPercentage();
return Math.round(percentage * tableWidth);
}
Modified: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/AbstractPropertyTest.java
===================================================================
--- trunk/foray/foray-fotree/src/javatest/org/foray/fotree/AbstractPropertyTest.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-fotree/src/javatest/org/foray/fotree/AbstractPropertyTest.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -52,6 +52,9 @@
public int bpdNearestBlockLevel() {
return 9 * 72000;
}
+ public int widthNearestTable() {
+ return 9 * 72000;
+ }
};
/**
Modified: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestColumnWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestColumnWidth.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestColumnWidth.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -56,8 +56,7 @@
*/
private int getPropertyValue(final ColumnWidth property,
final FObj testFobj) {
- final int testLength = property.getValue(STD_FO_CONTEXT, testFobj,
- 72000);
+ final int testLength = property.getValue(STD_FO_CONTEXT, testFobj);
return testLength;
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/OverrideGraftingContext.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/OverrideGraftingContext.java 2007-07-03 21:58:57 UTC (rev 9919)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/OverrideGraftingContext.java 2007-07-03 22:25:04 UTC (rev 9920)
@@ -83,4 +83,11 @@
return this.wrappedContext.bpdNearestBlockLevel();
}
+ /**
+ * {@inheritDoc}
+ */
+ public int widthNearestTable() {
+ return this.wrappedContext.widthNearestTable();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|