[FOray-commit] SF.net SVN: foray: [9928] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-07-05 21:37:03
|
Revision: 9928
http://svn.sourceforge.net/foray/?rev=9928&view=rev
Author: victormote
Date: 2007-07-05 14:36:16 -0700 (Thu, 05 Jul 2007)
Log Message:
-----------
Conform to axsl changes rolling up method parameters into new FoContext methods.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.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/prop/AbstractPadding.java
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/AbstractTestPadding.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-07-05 21:22:34 UTC (rev 9927)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-07-05 21:36:16 UTC (rev 9928)
@@ -896,37 +896,33 @@
/**
* Returns the padding-start trait for this area.
* @return The padding-start trait for this area.
- * @see Fo#traitPaddingStart(FoContext, boolean)
*/
public int traitPaddingStart() {
- return traitGeneratedBy().traitPaddingStart(this, traitIsFirst());
+ return traitGeneratedBy().traitPaddingStart(this);
}
/**
* Returns the padding-end trait for this area.
* @return The padding-end trait for this area.
- * @see Fo#traitPaddingEnd(FoContext, boolean)
*/
public int traitPaddingEnd() {
- return traitGeneratedBy().traitPaddingEnd(this, traitIsLast());
+ return traitGeneratedBy().traitPaddingEnd(this);
}
/**
* Returns the padding-before trait for this area.
* @return The padding-before trait for this area.
- * @see Fo#traitPaddingBefore(FoContext, boolean)
*/
public int traitPaddingBefore() {
- return traitGeneratedBy().traitPaddingBefore(this, traitIsFirst());
+ return traitGeneratedBy().traitPaddingBefore(this);
}
/**
* Returns the padding-after trait for this area.
* @return The padding-after trait for this area.
- * @see Fo#traitPaddingAfter(FoContext, boolean)
*/
public int traitPaddingAfter() {
- return traitGeneratedBy().traitPaddingAfter(this, traitIsLast());
+ return traitGeneratedBy().traitPaddingAfter(this);
}
/**
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-07-05 21:22:34 UTC (rev 9927)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-07-05 21:36:16 UTC (rev 9928)
@@ -118,7 +118,7 @@
* @return The total padding on the top of this cell.
*/
public int getPaddingBefore() {
- return this.traitGeneratedBy().traitPaddingBefore(this, true)
+ return this.traitGeneratedBy().traitPaddingBefore(this)
+ getCenteringPaddingBefore();
}
@@ -127,7 +127,7 @@
* @return The total padding on the left of this cell.
*/
public int getPaddingStart() {
- return this.traitGeneratedBy().traitPaddingStart(this, true)
+ return this.traitGeneratedBy().traitPaddingStart(this)
+ getCenteringPaddingStart();
}
@@ -136,7 +136,7 @@
* @return The total padding on the bottom of this cell.
*/
public int getPaddingAfter() {
- return this.traitGeneratedBy().traitPaddingAfter(this, true)
+ return this.traitGeneratedBy().traitPaddingAfter(this)
+ getCenteringPaddingAfter();
}
@@ -145,7 +145,7 @@
* @return The total padding on the right of this cell.
*/
public int getPaddingEnd() {
- return this.traitGeneratedBy().traitPaddingEnd(this, true)
+ return this.traitGeneratedBy().traitPaddingEnd(this)
+ getCenteringPaddingEnd();
}
@@ -239,10 +239,10 @@
if (tableCell.traitBorderCollapse(this) == BorderModel.SEPARATE) {
final int iSep = tableCell.traitBorderSeparationIpd(this);
return iSep / 2 + tableCell.traitBorderStartWidth(this)
- + tableCell.traitPaddingStart(this, true);
+ + tableCell.traitPaddingStart(this);
}
return tableCell.traitBorderStartWidth(this) / 2
- + tableCell.traitPaddingStart(this, true);
+ + tableCell.traitPaddingStart(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-07-05 21:22:34 UTC (rev 9927)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-07-05 21:36:16 UTC (rev 9928)
@@ -1853,36 +1853,29 @@
/**
* {@inheritDoc}
*/
- public int traitPaddingBefore(final FoContext context,
- final boolean isFirst) {
- return propertyList.getPadding(this, context, RelativeCompass.BEFORE,
- isFirst);
+ public int traitPaddingBefore(final FoContext context) {
+ return propertyList.getPadding(this, context, RelativeCompass.BEFORE);
}
/**
* {@inheritDoc}
*/
- public int traitPaddingAfter(final FoContext context,
- final boolean isLast) {
- return propertyList.getPadding(this, context, RelativeCompass.AFTER,
- isLast);
+ public int traitPaddingAfter(final FoContext context) {
+ return propertyList.getPadding(this, context, RelativeCompass.AFTER);
}
/**
* {@inheritDoc}
*/
- public int traitPaddingStart(final FoContext context,
- final boolean isFirst) {
- return propertyList.getPadding(this, context, RelativeCompass.START,
- isFirst);
+ public int traitPaddingStart(final FoContext context) {
+ return propertyList.getPadding(this, context, RelativeCompass.START);
}
/**
* {@inheritDoc}
*/
- public int traitPaddingEnd(final FoContext context, final boolean isLast) {
- return propertyList.getPadding(this, context, RelativeCompass.END,
- isLast);
+ public int traitPaddingEnd(final FoContext context) {
+ return propertyList.getPadding(this, context, RelativeCompass.END);
}
/**
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-05 21:22:34 UTC (rev 9927)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-07-05 21:36:16 UTC (rev 9928)
@@ -752,7 +752,7 @@
* qualify as "padding-corresponding" and "border-corresponding" as
* specified? Or do we need to look for the properties using just
* the absolute properties? */
- indent += this.getPadding(fobj, context, direction, false);
+ indent += this.getPadding(fobj, context, direction);
indent += this.getBorderWidth(fobj, context, direction);
return indent;
}
@@ -2955,15 +2955,10 @@
* @param context An object that knows how to resolve FO Tree context
* issues.
* @param direction The direction for which the padding width is needed.
- * @param isOuterEdge For "before" and "start", set this to "true" if the
- * area for which this width is computed "is-first" in the reference area.
- * For "after" and "end", set this to "true" if the area for which this
- * width is computed "is-last" in the reference area.
* @return The width, in millipoints, of the padding.
*/
public int getPadding(final FObj fobj, final FoContext context,
- final RelativeCompass direction,
- final boolean isOuterEdge) {
+ final RelativeCompass direction) {
AbstractPadding padding = null;
// Try the most explicit setting first, e.g "padding-top"
FoProperty rawPropertyType = AbstractPadding.rawPropertyType(direction);
@@ -2982,7 +2977,7 @@
if (padding == null) {
return AbstractPadding.getValueNoInstance();
}
- return padding.getValue(context, fobj, isOuterEdge);
+ return padding.getValue(context, fobj);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractPadding.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractPadding.java 2007-07-05 21:22:34 UTC (rev 9927)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbstractPadding.java 2007-07-05 21:36:16 UTC (rev 9928)
@@ -96,14 +96,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 isOuterEdge Indicates whether the direction sought is on the
- * outer edge of the area.
* @return The value of this property.
*/
- public int getValue(final FoContext context,
- final FObj fobj, final boolean isOuterEdge) {
+ public int getValue(final FoContext context, final FObj fobj) {
if (value().canEvalKeyword()) {
- return getKeywordValue(context, fobj, isOuterEdge);
+ return getKeywordValue(context, fobj);
}
if (value().canEvalLength()) {
final int length = this.convertValueToLength(value(), fobj,
@@ -128,7 +125,7 @@
* then the padding should be zero.
*/
if (condition == FoValue.DISCARD) {
- if (! isOuterEdge) {
+ if (! isOuterEdge(context, fobj)) {
return 0;
}
}
@@ -155,12 +152,9 @@
* is a keyword.
* @param context An object that knows how to resolve FO context issues.
* @param fobj The FO for which this value is needed.
- * @param isOuterEdge Indicates whether the direction sought is on the
- * outer edge of the area.
* @return The value of this property.
*/
- private int getKeywordValue(final FoContext context,
- final FObj fobj, final boolean isOuterEdge) {
+ private int getKeywordValue(final FoContext context, final FObj fobj) {
final FoPropertyKeyword kw = (FoPropertyKeyword) value();
final FObj effectiveParent = fobj.effectiveParent(context);
switch (kw.getValue()) {
@@ -168,16 +162,16 @@
final RelativeCompass direction = this.getRelativeCompass(context,
fobj);
if (direction == RelativeCompass.BEFORE) {
- return effectiveParent.traitPaddingBefore(context, isOuterEdge);
+ return effectiveParent.traitPaddingBefore(context);
}
if (direction == RelativeCompass.AFTER) {
- return effectiveParent.traitPaddingAfter(context, isOuterEdge);
+ return effectiveParent.traitPaddingAfter(context);
}
if (direction == RelativeCompass.START) {
- return effectiveParent.traitPaddingStart(context, isOuterEdge);
+ return effectiveParent.traitPaddingStart(context);
}
if (direction == RelativeCompass.END) {
- return effectiveParent.traitPaddingEnd(context, isOuterEdge);
+ return effectiveParent.traitPaddingEnd(context);
}
}
}
@@ -239,4 +233,30 @@
return value;
}
+ /**
+ * Indicates whether the context is on the outer edge of its parent
+ * reference area.
+ * @param context An object that knows how to resolve FO context issues.
+ * @param fobj The FO for which this property exists.
+ * @return True iff the context is on the outer edge of its parent reference
+ * area.
+ */
+ protected boolean isOuterEdge(final FoContext context, final FObj fobj) {
+ final RelativeCompass direction = this.getRelativeCompass(context,
+ fobj);
+ switch (direction) {
+ case BEFORE:
+ case START: {
+ return context.isFirst();
+ }
+ case AFTER:
+ case END: {
+ return context.isLast();
+ }
+ default: {
+ throw new NullPointerException("RelativeCompass cannot be null");
+ }
+ }
+ }
+
}
Modified: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/AbstractTestPadding.java
===================================================================
--- trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/AbstractTestPadding.java 2007-07-05 21:22:34 UTC (rev 9927)
+++ trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/AbstractTestPadding.java 2007-07-05 21:36:16 UTC (rev 9928)
@@ -52,8 +52,7 @@
*/
private int getPropertyValue(final AbstractPadding property,
final FObj testFobj) {
- final int testLength = property.getValue(STD_FO_CONTEXT, testFobj,
- false);
+ final int testLength = property.getValue(STD_FO_CONTEXT, testFobj);
return testLength;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|