[FOray-commit] SF.net SVN: foray: [9158] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-04-09 21:56:26
|
Revision: 9158
http://svn.sourceforge.net/foray/?rev=9158&view=rev
Author: victormote
Date: 2007-04-09 14:56:26 -0700 (Mon, 09 Apr 2007)
Log Message:
-----------
Conform to axsl change adding new typesafe enum.
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/fo/obj/ListItem.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.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-04-09 21:22:46 UTC (rev 9157)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-09 21:56:26 UTC (rev 9158)
@@ -36,6 +36,7 @@
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderStyle;
+import org.axsl.common.value.DisplayAlign;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.Overflow;
import org.axsl.common.value.RelativeAxis;
@@ -1675,4 +1676,12 @@
return traitGeneratedBy().traitBorderAfterStyle(this);
}
+ /**
+ * Returns the display-align trait for this Area.
+ * @return The display-align trait.
+ */
+ public DisplayAlign traitDisplayAlign() {
+ return this.traitGeneratedBy().traitDisplayAlign(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-04-09 21:22:46 UTC (rev 9157)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-04-09 21:56:26 UTC (rev 9158)
@@ -32,10 +32,10 @@
import org.axsl.areaR.TableCellArea;
import org.axsl.areaW.AreaWException;
import org.axsl.common.value.BorderModel;
+import org.axsl.common.value.DisplayAlign;
import org.axsl.common.value.RelativeAxis;
import org.axsl.foR.fo.Block;
import org.axsl.foR.fo.BlockContainer;
-import org.axsl.foR.fo.FoValue;
import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.foR.fo.Table;
@@ -350,13 +350,7 @@
if (delta <= 0) {
return;
}
- FoValue displayAlign = this.traitGeneratedBy().traitDisplayAlign(
- this);
- if (displayAlign == FoValue.AUTO) {
- /* TODO: This is not right. */
- displayAlign = this.traitGeneratedBy().traitAlignmentBaseline(
- this);
- }
+ final DisplayAlign displayAlign = this.traitDisplayAlign();
switch (displayAlign) {
case CENTER:
/* Increase cell padding before and after. */
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-09 21:22:46 UTC (rev 9157)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-09 21:56:26 UTC (rev 9158)
@@ -42,6 +42,7 @@
import org.axsl.common.value.BorderModel;
import org.axsl.common.value.BorderStyle;
import org.axsl.common.value.Compass;
+import org.axsl.common.value.DisplayAlign;
import org.axsl.common.value.LeaderPattern;
import org.axsl.common.value.Overflow;
import org.axsl.common.value.RelativeAxis;
@@ -670,7 +671,7 @@
* @param foSpan The raw FO span value to be converted.
* @return The matching Span instance.
*/
- private Span convertSpan(final FoValue foSpan) {
+ private static Span convertSpan(final FoValue foSpan) {
switch (foSpan) {
case NONE: return Span.NONE;
case ALL: return Span.ALL;
@@ -760,10 +761,36 @@
}
/**
+ * Converts an {@link FoValue} display-align value to the more generic
+ * {@link DisplayAlign} value.
+ * @param foDisplayAlign The raw FO display-align value to be converted.
+ * @return The matching DisplayAlign instance.
+ */
+ private static DisplayAlign convertDisplayAlign(
+ final FoValue foDisplayAlign) {
+ switch (foDisplayAlign) {
+ case BEFORE: return DisplayAlign.BEFORE;
+ case CENTER: return DisplayAlign.CENTER;
+ case AFTER: return DisplayAlign.AFTER;
+ default: throw new IllegalArgumentException(
+ "Illegal display-align value: " + foDisplayAlign.toXslFo());
+ }
+
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitDisplayAlign(final FoContext context) {
- return propertyList.getDisplayAlign(context);
+ public DisplayAlign traitDisplayAlign(final FoContext context) {
+ final FoValue foDisplayAlign = propertyList.getDisplayAlign(context);
+ if (this.relativeAlignApplies()) {
+ final FoValue foRelativeAlign = this.traitRelativeAlign(context);
+ switch (foRelativeAlign) {
+ case BEFORE: return DisplayAlign.BEFORE;
+ case BASELINE: return DisplayAlign.BASELINE;
+ }
+ }
+ return convertDisplayAlign(foDisplayAlign);
}
/**
@@ -2963,4 +2990,12 @@
return qtyMarkers;
}
+ /**
+ * Indicates whether the relative-align property applies to this Fo.
+ * @return True iff the relative-align property applies to this Fo.
+ */
+ public boolean relativeAlignApplies() {
+ return false;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2007-04-09 21:22:46 UTC (rev 9157)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ListItem.java 2007-04-09 21:56:26 UTC (rev 9158)
@@ -141,4 +141,13 @@
return this.parent;
}
+ /**
+ * {@inheritDoc}
+ * Overrides the standard implementation, because relative-align does apply
+ * to this object.
+ */
+ public boolean relativeAlignApplies() {
+ return true;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java 2007-04-09 21:22:46 UTC (rev 9157)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/TableCell.java 2007-04-09 21:56:26 UTC (rev 9158)
@@ -245,4 +245,13 @@
this.parent.addChild(this);
}
+ /**
+ * {@inheritDoc}
+ * Overrides the standard implementation, because relative-align does apply
+ * to this object.
+ */
+ public boolean relativeAlignApplies() {
+ return true;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java 2007-04-09 21:22:46 UTC (rev 9157)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java 2007-04-09 21:56:26 UTC (rev 9158)
@@ -75,7 +75,8 @@
final FoValue keyword = ((PropertyKeyword) value()).getValue();
switch (keyword) {
case INHERIT: {
- return fobj.effectiveParent(context).traitDisplayAlign(context);
+ final FObj parent = fobj.effectiveParent(context);
+ return parent.getPropertyList().getDisplayAlign(context);
}
default: {
return keyword;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|