Thread: [FOray-commit] SF.net SVN: foray: [9181] trunk/foray (Page 11)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-04-13 17:45:09
|
Revision: 9181
http://svn.sourceforge.net/foray/?rev=9181&view=rev
Author: victormote
Date: 2007-04-13 10:45:10 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
Conform to axsl changes removing the absolute traitBorder??Width methods in favor of their relative equivalents.
Modified Paths:
--------------
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/BorderWidth.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
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-13 17:33:09 UTC (rev 9180)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-04-13 17:45:10 UTC (rev 9181)
@@ -238,10 +238,10 @@
final TableCell tableCell = traitGeneratedBy();
if (tableCell.traitBorderCollapse(this) == BorderModel.SEPARATE) {
final int iSep = tableCell.traitBorderSeparationIPD(this);
- return iSep / 2 + tableCell.traitBorderLeftWidth(this)
+ return iSep / 2 + tableCell.traitBorderStartWidth(this, true)
+ tableCell.traitPaddingLeft(this);
}
- return tableCell.traitBorderLeftWidth(this) / 2
+ return tableCell.traitBorderStartWidth(this, true) / 2
+ tableCell.traitPaddingLeft(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-04-13 17:33:09 UTC (rev 9180)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-13 17:45:10 UTC (rev 9181)
@@ -1896,38 +1896,6 @@
/**
* {@inheritDoc}
*/
- public int traitBorderLeftWidth(final FoContext context) {
- return propertyList.getBorderWidth(context, AbsoluteCompass.LEFT,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
- public int traitBorderRightWidth(final FoContext context) {
- return propertyList.getBorderWidth(context, AbsoluteCompass.RIGHT,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
- public int traitBorderTopWidth(final FoContext context) {
- return propertyList.getBorderWidth(context, AbsoluteCompass.TOP,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
- public int traitBorderBottomWidth(final FoContext context) {
- return propertyList.getBorderWidth(context, AbsoluteCompass.BOTTOM,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
public int traitPaddingBefore(final FoContext context,
final boolean isFirst) {
return propertyList.getPadding(context, RelativeCompass.BEFORE,
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-04-13 17:33:09 UTC (rev 9180)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-04-13 17:45:10 UTC (rev 9181)
@@ -2663,7 +2663,8 @@
* width is computed "is-last" in the reference area.
* @return The width, in millipoints, of the border.
*/
- public int getBorderWidth(final FoContext context, final Compass direction,
+ public int getBorderWidth(final FoContext context,
+ final RelativeCompass direction,
final boolean isOuterEdge) {
// If the border-style is "none", the width is zero
if (getBorderStyle(context, direction) == FoValue.NONE) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java 2007-04-13 17:33:09 UTC (rev 9180)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java 2007-04-13 17:45:10 UTC (rev 9181)
@@ -125,7 +125,8 @@
return collection;
}
- public int getValue(final FoContext context, final Compass direction,
+ public int getValue(final FoContext context,
+ final RelativeCompass direction,
final FObj fobj, final boolean isOuterEdge) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(context, direction, fobj, isOuterEdge);
@@ -166,7 +167,7 @@
}
private int getCollectionValue(final FoContext context,
- final Compass direction, final FObj fobj,
+ final RelativeCompass direction, final FObj fobj,
final boolean isOuterEdge) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
@@ -178,7 +179,7 @@
}
private int getKeywordValue(final FoContext context,
- final Compass direction,
+ final RelativeCompass direction,
final FObj fobj, final boolean isOuterEdge) {
final PropertyKeyword kw = (PropertyKeyword) value();
switch (kw.getValue()) {
@@ -209,18 +210,6 @@
return effectiveParent.traitBorderEndWidth(context,
isOuterEdge);
}
- if (direction == AbsoluteCompass.LEFT) {
- return effectiveParent.traitBorderLeftWidth(context);
- }
- if (direction == AbsoluteCompass.RIGHT) {
- return effectiveParent.traitBorderRightWidth(context);
- }
- if (direction == AbsoluteCompass.TOP) {
- return effectiveParent.traitBorderTopWidth(context);
- }
- if (direction == AbsoluteCompass.BOTTOM) {
- return effectiveParent.traitBorderBottomWidth(context);
- }
}
}
return getValueNoInstance();
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java 2007-04-13 17:33:09 UTC (rev 9180)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/TableCellPL.java 2007-04-13 17:45:10 UTC (rev 9181)
@@ -76,8 +76,8 @@
public int getHeight(final FoContext context) {
return areaContainer.crBPD()
+ this.node.traitBorderSeparationBPD(context)
- - (this.node.traitBorderTopWidth(context)
- + this.node.traitBorderBottomWidth(context))
+ - (this.node.traitBorderBeforeWidth(context, true)
+ + this.node.traitBorderAfterWidth(context, true))
/ 2;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-13 18:02:43
|
Revision: 9182
http://svn.sourceforge.net/foray/?rev=9182&view=rev
Author: victormote
Date: 2007-04-13 11:02:35 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
Conform to axsl changes removing the absolute traitPadding?? methods in favor of their relative equivalents.
Modified Paths:
--------------
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/Padding.java
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-13 17:45:10 UTC (rev 9181)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TableCellRA.java 2007-04-13 18:02:35 UTC (rev 9182)
@@ -65,21 +65,21 @@
* by the parent row. */
private int contentPD = 0;
- /** Adjustment to the top padding due to centering from the "display-align"
- * property. */
- private int centeringPaddingTop = 0;
+ /** Adjustment to the before padding due to centering from the
+ * "display-align" property. */
+ private int centeringPaddingBefore = 0;
- /** Adjustment to the bottom padding due to centering from the
+ /** Adjustment to the after padding due to centering from the
* "display-align" property. */
- private int centeringPaddingBottom = 0;
+ private int centeringPaddingAfter = 0;
- /** Adjustment to the left padding due to centering from the "display-align"
- * property. */
- private int centeringPaddingLeft = 0;
+ /** Adjustment to the start padding due to centering from the
+ * "display-align" property. */
+ private int centeringPaddingStart = 0;
- /** Adjustment to the right padding due to centering from the
+ /** Adjustment to the end padding due to centering from the
* "display-align" property. */
- private int centeringPaddingRight = 0;
+ private int centeringPaddingEnd = 0;
/**
* Private Constructor.
@@ -117,36 +117,36 @@
* Return the total padding on the top of this cell.
* @return The total padding on the top of this cell.
*/
- public int getPaddingTop() {
- return this.traitGeneratedBy().traitPaddingTop(this)
- + getCenteringPaddingTop();
+ public int getPaddingBefore() {
+ return this.traitGeneratedBy().traitPaddingBefore(this, true)
+ + getCenteringPaddingBefore();
}
/**
* Return the total padding on the left of this cell.
* @return The total padding on the left of this cell.
*/
- public int getPaddingLeft() {
- return this.traitGeneratedBy().traitPaddingLeft(this)
- + getCenteringPaddingLeft();
+ public int getPaddingStart() {
+ return this.traitGeneratedBy().traitPaddingStart(this, true)
+ + getCenteringPaddingStart();
}
/**
* Return the total padding on the bottom of this cell.
* @return The total padding on the bottom of this cell.
*/
- public int getPaddingBottom() {
- return this.traitGeneratedBy().traitPaddingBottom(this)
- + getCenteringPaddingBottom();
+ public int getPaddingAfter() {
+ return this.traitGeneratedBy().traitPaddingAfter(this, true)
+ + getCenteringPaddingAfter();
}
/**
* Return the total padding on the right of this cell.
* @return The total padding on the right of this cell.
*/
- public int getPaddingRight() {
- return this.traitGeneratedBy().traitPaddingRight(this)
- + getCenteringPaddingRight();
+ public int getPaddingEnd() {
+ return this.traitGeneratedBy().traitPaddingEnd(this, true)
+ + getCenteringPaddingEnd();
}
/**
@@ -169,64 +169,64 @@
* Returns the padding needed on the bottom of this cell to center it.
* @return Returns the centeringPaddingBottom.
*/
- public int getCenteringPaddingBottom() {
- return centeringPaddingBottom;
+ public int getCenteringPaddingAfter() {
+ return centeringPaddingAfter;
}
/**
* Returns the padding needed on the left of this cell to center it.
* @return Returns the centeringPaddingLeft.
*/
- public int getCenteringPaddingLeft() {
- return centeringPaddingLeft;
+ public int getCenteringPaddingStart() {
+ return centeringPaddingStart;
}
/**
* Returns the padding needed on the right of this cell to center it.
* @return Returns the centeringPaddingRight.
*/
- public int getCenteringPaddingRight() {
- return centeringPaddingRight;
+ public int getCenteringPaddingEnd() {
+ return centeringPaddingEnd;
}
/**
* Returns the padding needed on the top of this cell to center it.
* @return Returns the centeringPaddingTop.
*/
- public int getCenteringPaddingTop() {
- return centeringPaddingTop;
+ public int getCenteringPaddingBefore() {
+ return centeringPaddingBefore;
}
/**
* Sets the bottom padding value due to centering.
* @param padding The new centering bottom padding value.
*/
- public void setCenteringPaddingBottom(final int padding) {
- this.centeringPaddingBottom = padding;
+ public void setCenteringPaddingAfter(final int padding) {
+ this.centeringPaddingAfter = padding;
}
/**
* Sets the left padding value due to centering.
* @param padding The new centering left padding value.
*/
- public void setCenteringPaddingLeft(final int padding) {
- this.centeringPaddingLeft = padding;
+ public void setCenteringPaddingStart(final int padding) {
+ this.centeringPaddingStart = padding;
}
/**
* Sets the right padding value due to centering.
* @param padding The new centering right padding value.
*/
- public void setCenteringPaddingRight(final int padding) {
- this.centeringPaddingRight = padding;
+ public void setCenteringPaddingEnd(final int padding) {
+ this.centeringPaddingEnd = padding;
}
/**
* Sets the top padding value due to centering.
* @param padding The new centering top padding value.
*/
- public void setCenteringPaddingTop(final int padding) {
- this.centeringPaddingTop = padding;
+ public void setCenteringPaddingBefore(final int padding) {
+ this.centeringPaddingBefore = padding;
}
/**
@@ -239,10 +239,10 @@
if (tableCell.traitBorderCollapse(this) == BorderModel.SEPARATE) {
final int iSep = tableCell.traitBorderSeparationIPD(this);
return iSep / 2 + tableCell.traitBorderStartWidth(this, true)
- + tableCell.traitPaddingLeft(this);
+ + tableCell.traitPaddingStart(this, true);
}
return tableCell.traitBorderStartWidth(this, true) / 2
- + tableCell.traitPaddingLeft(this);
+ + tableCell.traitPaddingStart(this, true);
}
/**
@@ -354,16 +354,16 @@
switch (displayAlign) {
case CENTER:
/* Increase cell padding before and after. */
- this.setCenteringPaddingTop(delta / 2);
- this.setCenteringPaddingBottom(delta - delta / 2);
+ this.setCenteringPaddingBefore(delta / 2);
+ this.setCenteringPaddingAfter(delta - delta / 2);
break;
case AFTER:
/* Increase cell padding before. */
- this.setCenteringPaddingTop(delta);
+ this.setCenteringPaddingBefore(delta);
break;
case BEFORE:
/* Increase cell padding after. */
- this.setCenteringPaddingBottom(delta);
+ this.setCenteringPaddingAfter(delta);
break;
default:
/* No adjustment needed. */
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-13 17:45:10 UTC (rev 9181)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-13 18:02:35 UTC (rev 9182)
@@ -37,7 +37,6 @@
import org.foray.fotree.fo.obj.Table;
import org.axsl.common.value.AbsoluteAxis;
-import org.axsl.common.value.AbsoluteCompass;
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.Baseline;
@@ -1931,38 +1930,6 @@
/**
* {@inheritDoc}
*/
- public int traitPaddingLeft(final FoContext context) {
- return propertyList.getPadding(context, AbsoluteCompass.LEFT,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
- public int traitPaddingRight(final FoContext context) {
- return propertyList.getPadding(context, AbsoluteCompass.RIGHT,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
- public int traitPaddingTop(final FoContext context) {
- return propertyList.getPadding(context, AbsoluteCompass.TOP,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
- public int traitPaddingBottom(final FoContext context) {
- return propertyList.getPadding(context, AbsoluteCompass.BOTTOM,
- true);
- }
-
- /**
- * {@inheritDoc}
- */
public Color traitBackgroundColor(final FoContext context) {
return propertyList.getBackgroundColor(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-04-13 17:45:10 UTC (rev 9181)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-04-13 18:02:35 UTC (rev 9182)
@@ -2708,7 +2708,8 @@
* width is computed "is-last" in the reference area.
* @return The width, in millipoints, of the padding.
*/
- public int getPadding(final FoContext context, final Compass direction,
+ public int getPadding(final FoContext context,
+ final RelativeCompass direction,
final boolean isOuterEdge) {
Padding padding = null;
// Try the most explicit setting first, e.g "padding-top"
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java 2007-04-13 17:45:10 UTC (rev 9181)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java 2007-04-13 18:02:35 UTC (rev 9182)
@@ -116,7 +116,8 @@
return collection;
}
- public int getValue(final FoContext context, final Compass direction,
+ public int getValue(final FoContext context,
+ final RelativeCompass direction,
final FObj fobj, final boolean isOuterEdge) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(context, direction, fobj, isOuterEdge);
@@ -157,7 +158,7 @@
}
private int getCollectionValue(final FoContext context,
- final Compass direction, final FObj fobj,
+ final RelativeCompass direction, final FObj fobj,
final boolean isOuterEdge) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
@@ -168,7 +169,7 @@
}
private int getKeywordValue(final FoContext context,
- final Compass direction,
+ final RelativeCompass direction,
final FObj fobj, final boolean isOuterEdge) {
final PropertyKeyword kw = (PropertyKeyword) value();
final FObj effectiveParent = fobj.effectiveParent(context);
@@ -186,18 +187,6 @@
if (direction == RelativeCompass.END) {
return effectiveParent.traitPaddingEnd(context, isOuterEdge);
}
- if (direction == AbsoluteCompass.LEFT) {
- return effectiveParent.traitPaddingLeft(context);
- }
- if (direction == AbsoluteCompass.RIGHT) {
- return effectiveParent.traitPaddingRight(context);
- }
- if (direction == AbsoluteCompass.TOP) {
- return effectiveParent.traitPaddingTop(context);
- }
- if (direction == AbsoluteCompass.BOTTOM) {
- return effectiveParent.traitPaddingBottom(context);
- }
}
}
return getValueNoInstance();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-13 19:32:42
|
Revision: 9184
http://svn.sourceforge.net/foray/?rev=9184&view=rev
Author: victormote
Date: 2007-04-13 12:32:34 -0700 (Fri, 13 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/BlockContainerRA.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.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-13 19:04:45 UTC (rev 9183)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-13 19:32:34 UTC (rev 9184)
@@ -34,6 +34,7 @@
import org.axsl.areaW.BlockContainerRA;
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
+import org.axsl.common.value.AbsolutePosition;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderStyle;
@@ -317,7 +318,7 @@
* {@link FoValue#ABSOLUTE}, or
* {@link FoValue#FIXED}.
*/
- public FoValue traitAbsolutePosition() {
+ public AbsolutePosition traitAbsolutePosition() {
return traitGeneratedBy().traitAbsolutePosition(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2007-04-13 19:04:45 UTC (rev 9183)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BlockContainerRA.java 2007-04-13 19:32:34 UTC (rev 9184)
@@ -31,11 +31,11 @@
import org.axsl.areaR.BlockContainerArea;
import org.axsl.areaR.RenderVisitor;
import org.axsl.areaW.AreaWException;
+import org.axsl.common.value.AbsolutePosition;
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.FoValue;
import org.axsl.foR.fo.ListBlock;
import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.foR.fo.Table;
@@ -94,7 +94,7 @@
* {@inheritDoc}
*/
public boolean isAbsolutelyPositioned() {
- if (this.traitAbsolutePosition() == FoValue.AUTO) {
+ if (this.traitAbsolutePosition() == AbsolutePosition.AUTO) {
return false;
}
return true;
@@ -104,7 +104,7 @@
* {@inheritDoc}
*/
public int crOriginBPDOffset() {
- if (this.traitAbsolutePosition() == FoValue.ABSOLUTE) {
+ if (this.traitAbsolutePosition() == AbsolutePosition.ABSOLUTE) {
final int top = this.traitTop();
if (top != Fo.ABSOLUTE_POSITION_AUTO) {
/* If "top" is specified, that is the offset needed. */
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-13 19:04:45 UTC (rev 9183)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-13 19:32:34 UTC (rev 9184)
@@ -38,6 +38,8 @@
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
+import org.axsl.common.value.AbsolutePosition;
+import org.axsl.common.value.BackgroundAttachment;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderModel;
@@ -2346,17 +2348,58 @@
}
/**
+ * Converts an {@link FoValue} absolute-position value to the more generic
+ * {@link AbsolutePosition} value.
+ * @param foAbsolutePosition The raw FO absolute-position to be converted.
+ * @return The matching AbsolutePosition instance.
+ */
+ private static AbsolutePosition convertAbsolutePosition(
+ final FoValue foAbsolutePosition) {
+ switch (foAbsolutePosition) {
+ case AUTO: return AbsolutePosition.AUTO;
+ case ABSOLUTE: return AbsolutePosition.ABSOLUTE;
+ case FIXED: return AbsolutePosition.FIXED;
+ default: throw new IllegalArgumentException(
+ "Illegal absolute-position: "
+ + foAbsolutePosition.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitAbsolutePosition(final FoContext context) {
- return propertyList.traitAbsolutePosition(context);
+ public AbsolutePosition traitAbsolutePosition(final FoContext context) {
+ final FoValue foAbsolutePosition = propertyList.traitAbsolutePosition(
+ context);
+ return convertAbsolutePosition(foAbsolutePosition);
}
/**
+ * Converts an {@link FoValue} background-attachment value to the more
+ * generic {@link BackgroundAttachment} value.
+ * @param foBackgroundAttachment The raw FO background-attachment to be
+ * converted.
+ * @return The matching BackgroundAttachment instance.
+ */
+ private static BackgroundAttachment convertBackgroundAttachment(
+ final FoValue foBackgroundAttachment) {
+ switch (foBackgroundAttachment) {
+ case SCROLL: return BackgroundAttachment.SCROLL;
+ case FIXED: return BackgroundAttachment.FIXED;
+ default: throw new IllegalArgumentException(
+ "Illegal background-attachment: "
+ + foBackgroundAttachment.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitBackgroundAttachment(final FoContext context) {
- return propertyList.traitBackgroundAttachment(context);
+ public BackgroundAttachment traitBackgroundAttachment(
+ final FoContext context) {
+ final FoValue foBackgroundAttachment =
+ propertyList.traitBackgroundAttachment(context);
+ return convertBackgroundAttachment(foBackgroundAttachment);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java 2007-04-13 19:04:45 UTC (rev 9183)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java 2007-04-13 19:32:34 UTC (rev 9184)
@@ -352,10 +352,10 @@
final FObj fobj) {
switch (getPropertyType()) {
case ABSOLUTE_POSITION: {
- return fobj.traitAbsolutePosition(context);
+ return fobj.getPropertyList().traitAbsolutePosition(context);
}
case BACKGROUND_ATTACHMENT: {
- return fobj.traitBackgroundAttachment(context);
+ return fobj.getPropertyList().traitBackgroundAttachment(context);
}
case BACKGROUND_REPEAT: {
return fobj.getPropertyList().getBackgroundRepeat(context);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-13 23:59:06
|
Revision: 9188
http://svn.sourceforge.net/foray/?rev=9188&view=rev
Author: victormote
Date: 2007-04-13 16:58:59 -0700 (Fri, 13 Apr 2007)
Log Message:
-----------
Conform to axsl changes using typesafe enums.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/BookmarkTitle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.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-13 20:18:09 UTC (rev 9187)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-13 23:58:59 UTC (rev 9188)
@@ -41,9 +41,12 @@
import org.axsl.common.value.DisplayAlign;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.Overflow;
+import org.axsl.common.value.ReferenceOrientation;
import org.axsl.common.value.RelativeAxis;
+import org.axsl.common.value.RelativePosition;
import org.axsl.common.value.Scaling;
import org.axsl.common.value.TextAlign;
+import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.common.value.WrapOption;
import org.axsl.common.value.WritingMode;
import org.axsl.foR.Fo;
@@ -307,7 +310,7 @@
* @return The relative-position for this area.
* @see Fo#traitRelativePosition(FoContext)
*/
- public FoValue traitRelativePosition() {
+ public RelativePosition traitRelativePosition() {
return traitGeneratedBy().traitRelativePosition(this);
}
@@ -1305,7 +1308,7 @@
* Returns the reference-orientation trait for this area.
* @return The reference-orientation trait for this area.
*/
- public FoValue traitReferenceOrientation() {
+ public ReferenceOrientation traitReferenceOrientation() {
return traitGeneratedBy().traitReferenceOrientation(this);
}
@@ -1345,7 +1348,7 @@
* @return The whitespace-treatment trait for this area.
* @see Fo#traitWhiteSpaceTreatment(FoContext)
*/
- public FoValue traitWhiteSpaceTreatment() {
+ public WhiteSpaceTreatment traitWhiteSpaceTreatment() {
return traitGeneratedBy().traitWhiteSpaceTreatment(this);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-04-13 20:18:09 UTC (rev 9187)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2007-04-13 23:58:59 UTC (rev 9188)
@@ -32,10 +32,10 @@
import org.foray.common.XMLCharacter;
import org.axsl.areaR.RenderVisitor;
-import org.axsl.foR.fo.FoValue;
+import org.axsl.common.value.WhiteSpaceTreatment;
+import org.axsl.foR.Fo;
import org.axsl.foR.FoNode;
import org.axsl.foR.FoTextContent;
-import org.axsl.foR.Fo;
import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.fontR.Font;
import org.axsl.fontR.FontUse;
@@ -423,17 +423,18 @@
*/
public static int ignoreAtStart(final char[] chars, final int start,
final int size, final boolean firstItemOnLine,
- final FoValue whiteSpaceTreatment) {
+ final WhiteSpaceTreatment whiteSpaceTreatment) {
// Only eat leading whitespaces if this is the first item on the line.
if (! firstItemOnLine) {
return 0;
}
- if (whiteSpaceTreatment == FoValue.IGNORE
- || whiteSpaceTreatment == FoValue.PRESERVE) {
+ if (whiteSpaceTreatment == WhiteSpaceTreatment.IGNORE
+ || whiteSpaceTreatment == WhiteSpaceTreatment.PRESERVE) {
// These situations were totally handled in FOTree
return 0;
}
- if (whiteSpaceTreatment == FoValue.IGNORE_IF_BEFORE_LINEFEED) {
+ if (whiteSpaceTreatment
+ == WhiteSpaceTreatment.IGNORE_IF_BEFORE_LINEFEED) {
// Handled in ignoreAtEnd();
return 0;
}
@@ -466,17 +467,18 @@
*/
public static int ignoreAtEnd(final char[] chars, final int start,
final int size, final boolean lastItemOnLine,
- final FoValue whiteSpaceTreatment) {
+ final WhiteSpaceTreatment whiteSpaceTreatment) {
// Only eat trailing whitespaces if this is the last item on the line.
if (! lastItemOnLine) {
return 0;
}
- if (whiteSpaceTreatment == FoValue.IGNORE
- || whiteSpaceTreatment == FoValue.PRESERVE) {
+ if (whiteSpaceTreatment == WhiteSpaceTreatment.IGNORE
+ || whiteSpaceTreatment == WhiteSpaceTreatment.PRESERVE) {
// These situations were totally handled in FOTree
return 0;
}
- if (whiteSpaceTreatment == FoValue.IGNORE_IF_AFTER_LINEFEED) {
+ if (whiteSpaceTreatment
+ == WhiteSpaceTreatment.IGNORE_IF_AFTER_LINEFEED) {
// Handled in ignoreAtStart();
return 0;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-04-13 20:18:09 UTC (rev 9187)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-04-13 23:58:59 UTC (rev 9188)
@@ -32,6 +32,9 @@
import org.foray.common.XMLCharacter;
import org.foray.fotree.fo.obj.BookmarkTitle;
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.TextTransform;
+import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.common.value.WrapOption;
import org.axsl.foR.FoContext;
import org.axsl.foR.FoLineText;
@@ -188,9 +191,9 @@
final char[] charArray = getPreTextTransformText(context);
// Now handle text-transform.
- final FoValue textTransform = effectiveParent.traitTextTransform(
+ final TextTransform textTransform = effectiveParent.traitTextTransform(
context);
- if (textTransform != FoValue.NONE) {
+ if (textTransform != TextTransform.NONE) {
for (int i = 0; i < charArray.length; i++) {
charArray[i] = applyTextTransform(context, charArray, i,
textTransform);
@@ -256,7 +259,7 @@
*/
private char applyTextTransform(final FoContext context,
final char[] charArray, final int index,
- final FoValue textTransform) {
+ final TextTransform textTransform) {
final char c = charArray[index];
switch (textTransform) {
/* This method not be entered if value is NONE. */
@@ -826,7 +829,7 @@
* should therefore never be in the input.
*/
public static char applyWhiteSpaceTreatment(final char[] charArray,
- final int index, final FoValue whiteSpaceTreatment) {
+ final int index, final WhiteSpaceTreatment whiteSpaceTreatment) {
final char c = charArray[index];
if (! XMLCharacter.isXMLWhitespace(c)) {
/* If it is not whitespace, it cannot be changed. */
@@ -908,8 +911,8 @@
* Otherwise, a new char array with the result is returned.
*/
public static char[] applyWhiteSpaceTreatment(final char[] charArray,
- final FoValue inputWhiteSpaceTreatment) {
- FoValue whiteSpaceTreatment = inputWhiteSpaceTreatment;
+ final WhiteSpaceTreatment inputWhiteSpaceTreatment) {
+ WhiteSpaceTreatment whiteSpaceTreatment = inputWhiteSpaceTreatment;
switch (whiteSpaceTreatment) {
case IGNORE:
case PRESERVE:
@@ -923,7 +926,7 @@
/* Invalid value. Silently convert to the default value as specified
* in the standard . */
whiteSpaceTreatment =
- FoValue.IGNORE_IF_SURROUNDING_LINEFEED;
+ WhiteSpaceTreatment.IGNORE_IF_SURROUNDING_LINEFEED;
}
}
@@ -971,7 +974,7 @@
* removed.
*/
public static char applyLinefeedTreatment(final char c,
- final FoValue linefeedTreatment) {
+ final LinefeedTreatment linefeedTreatment) {
assert c == WKConstants.LINEFEED : "Invalid linefeed-treatment input.";
switch (linefeedTreatment) {
case IGNORE: {
@@ -1005,8 +1008,8 @@
* result is returned.
*/
public static char[] applyLinefeedTreatment(final char[] charArray,
- final FoValue inputLinefeedTreatment) {
- FoValue linefeedTreatment = inputLinefeedTreatment;
+ final LinefeedTreatment inputLinefeedTreatment) {
+ LinefeedTreatment linefeedTreatment = inputLinefeedTreatment;
switch (linefeedTreatment) {
case PRESERVE: {
return charArray;
@@ -1020,7 +1023,7 @@
default: {
/* Invalid value. Silently convert to the default, as specified by
* the standard. */
- linefeedTreatment = FoValue.TREAT_AS_SPACE;
+ linefeedTreatment = LinefeedTreatment.TREAT_AS_SPACE;
}
}
@@ -1029,7 +1032,7 @@
for (int i = 0; i < charArray.length; i++) {
final char c = charArray[i];
if (c == WKConstants.LINEFEED) {
- if (linefeedTreatment == FoValue.IGNORE) {
+ if (linefeedTreatment == LinefeedTreatment.IGNORE) {
discardElements ++;
} else {
changeElements ++;
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-13 20:18:09 UTC (rev 9187)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-13 23:58:59 UTC (rev 9188)
@@ -39,29 +39,54 @@
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.AbsolutePosition;
+import org.axsl.common.value.ActiveState;
import org.axsl.common.value.BackgroundAttachment;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderModel;
import org.axsl.common.value.BorderStyle;
import org.axsl.common.value.Break;
+import org.axsl.common.value.Clear;
import org.axsl.common.value.Conditionality;
import org.axsl.common.value.DisplayAlign;
+import org.axsl.common.value.EmptyCells;
+import org.axsl.common.value.Float;
import org.axsl.common.value.ForcePageCount;
+import org.axsl.common.value.HyphenationKeep;
import org.axsl.common.value.LeaderAlignment;
import org.axsl.common.value.LeaderPattern;
+import org.axsl.common.value.LineHeightShiftAdjustment;
+import org.axsl.common.value.LineStackingStrategy;
+import org.axsl.common.value.LinefeedTreatment;
+import org.axsl.common.value.MediaUsage;
import org.axsl.common.value.Overflow;
+import org.axsl.common.value.ReferenceOrientation;
import org.axsl.common.value.RelativeAlign;
import org.axsl.common.value.RelativeAxis;
import org.axsl.common.value.RelativeCompass;
+import org.axsl.common.value.RelativePosition;
+import org.axsl.common.value.RenderingIntent;
import org.axsl.common.value.RuleStyle;
import org.axsl.common.value.Scaling;
+import org.axsl.common.value.ScalingMethod;
import org.axsl.common.value.ShadowEffect;
import org.axsl.common.value.Shape;
+import org.axsl.common.value.ShowDestination;
import org.axsl.common.value.Span;
+import org.axsl.common.value.Speak;
+import org.axsl.common.value.SpeakHeader;
+import org.axsl.common.value.SpeakNumeral;
+import org.axsl.common.value.SpeakPunctuation;
+import org.axsl.common.value.StartingState;
+import org.axsl.common.value.SuppressAtLineBreak;
+import org.axsl.common.value.SwitchTo;
import org.axsl.common.value.TableLayout;
import org.axsl.common.value.TextAlign;
import org.axsl.common.value.TextAlignLast;
+import org.axsl.common.value.TextTransform;
+import org.axsl.common.value.UnicodeBidi;
+import org.axsl.common.value.Visibility;
+import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.common.value.WrapOption;
import org.axsl.common.value.WritingMode;
import org.axsl.foR.FoContext;
@@ -2486,66 +2511,249 @@
}
/**
+ * Converts an {@link FoValue} hyphenation-keep value to the more
+ * generic {@link HyphenationKeep} value.
+ * @param foHyphenationKeep The raw FO hyphenation-keep to be converted.
+ * @return The matching HyphenationKeep instance.
+ */
+ private static HyphenationKeep convertHyphenationKeep(
+ final FoValue foHyphenationKeep) {
+ switch (foHyphenationKeep) {
+ case AUTO: return HyphenationKeep.AUTO;
+ case COLUMN: return HyphenationKeep.COLUMN;
+ case PAGE: return HyphenationKeep.PAGE;
+ default: throw new IllegalArgumentException("Illegal hyphenation-keep: "
+ + foHyphenationKeep.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitHyphenationKeep(final FoContext context) {
- return propertyList.traitHyphenationKeep(context);
+ public HyphenationKeep traitHyphenationKeep(final FoContext context) {
+ final FoValue foValue = propertyList.traitHyphenationKeep(context);
+ return convertHyphenationKeep(foValue);
}
/**
+ * Converts an {@link FoValue} linefeed-treatment value to the more
+ * generic {@link LinefeedTreatment} value.
+ * @param foLinefeedTreatment The raw FO linefeed-treatment to be converted.
+ * @return The matching LinefeedTreatment instance.
+ */
+ private static LinefeedTreatment convertLinefeedTreatment(
+ final FoValue foLinefeedTreatment) {
+ switch (foLinefeedTreatment) {
+ case IGNORE: return LinefeedTreatment.IGNORE;
+ case PRESERVE: return LinefeedTreatment.PRESERVE;
+ case TREAT_AS_SPACE: return LinefeedTreatment.TREAT_AS_SPACE;
+ case TREAT_AS_ZERO_WIDTH_SPACE:
+ return LinefeedTreatment.TREAT_AS_ZERO_WIDTH_SPACE;
+ default: throw new IllegalArgumentException(
+ "Illegal linefeed-treatment: "
+ + foLinefeedTreatment.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitLinefeedTreatment(final FoContext context) {
- return propertyList.traitLinefeedTreatment(context);
+ public LinefeedTreatment traitLinefeedTreatment(final FoContext context) {
+ final FoValue foValue = propertyList.traitLinefeedTreatment(context);
+ return convertLinefeedTreatment(foValue);
}
/**
+ * Converts an {@link FoValue} line-height-shift-adjustment value to the
+ * more generic {@link LineHeightShiftAdjustment} value.
+ * @param foLineHeightShiftAdjustment The raw FO
+ * line-height-shift-adjustment to be converted.
+ * @return The matching LineHeightShiftAdjustment instance.
+ */
+ private static LineHeightShiftAdjustment convertLineHeightShiftAdjustment(
+ final FoValue foLineHeightShiftAdjustment) {
+ switch (foLineHeightShiftAdjustment) {
+ case CONSIDER_SHIFTS: return LineHeightShiftAdjustment.CONSIDER_SHIFTS;
+ case DISREGARD_SHIFTS:
+ return LineHeightShiftAdjustment.DISREGARD_SHIFTS;
+ default: throw new IllegalArgumentException(
+ "Illegal line-height-shift-adjustment: "
+ + foLineHeightShiftAdjustment.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitLineHeightShiftAdjustment(final FoContext context) {
- return propertyList.traitLineHeightShiftAdjustment(context);
+ public LineHeightShiftAdjustment traitLineHeightShiftAdjustment(
+ final FoContext context) {
+ final FoValue foValue = propertyList.traitLineHeightShiftAdjustment(
+ context);
+ return convertLineHeightShiftAdjustment(foValue);
}
/**
+ * Converts an {@link FoValue} line-stacking-strategy value to the more
+ * generic {@link LineStackingStrategy} value.
+ * @param foLineStackingStrategy The raw FO line-stacking-strategy to be
+ * converted.
+ * @return The matching LineStackingStrategy instance.
+ */
+ private static LineStackingStrategy convertLineStackingStrategy(
+ final FoValue foLineStackingStrategy) {
+ switch (foLineStackingStrategy) {
+ case LINE_HEIGHT: return LineStackingStrategy.LINE_HEIGHT;
+ case FONT_HEIGHT: return LineStackingStrategy.FONT_HEIGHT;
+ case MAX_HEIGHT: return LineStackingStrategy.MAX_HEIGHT;
+ default: throw new IllegalArgumentException(
+ "Illegal line-stacking-strategy: "
+ + foLineStackingStrategy.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitLineStackingStrategy(final FoContext context) {
- return propertyList.traitLineStackingStrategy(context);
+ public LineStackingStrategy traitLineStackingStrategy(
+ final FoContext context) {
+ final FoValue foValue = propertyList.traitLineStackingStrategy(context);
+ return convertLineStackingStrategy(foValue);
}
/**
+ * Converts an {@link FoValue} relative-position value to the more
+ * generic {@link RelativePosition} value.
+ * @param foRelativePosition The raw FO relative-position to be converted.
+ * @return The matching RelativePosition instance.
+ */
+ private static RelativePosition convertRelativePosition(
+ final FoValue foRelativePosition) {
+ switch (foRelativePosition) {
+ case STATIC: return RelativePosition.STATIC;
+ case RELATIVE: return RelativePosition.RELATIVE;
+ default: throw new IllegalArgumentException(
+ "Illegal relative-position: "
+ + foRelativePosition.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitRelativePosition(final FoContext context) {
- return propertyList.traitRelativePosition(context);
+ public RelativePosition traitRelativePosition(final FoContext context) {
+ final FoValue foValue = propertyList.traitRelativePosition(context);
+ return convertRelativePosition(foValue);
}
/**
+ * Converts an {@link FoValue} scaling-method value to the more
+ * generic {@link ScalingMethod} value.
+ * @param foScalingMethod The raw FO scaling-method to be converted.
+ * @return The matching ScalingMethod instance.
+ */
+ private static ScalingMethod convertScalingMethod(
+ final FoValue foScalingMethod) {
+ switch (foScalingMethod) {
+ case AUTO: return ScalingMethod.AUTO;
+ case INTEGER_PIXELS: return ScalingMethod.INTEGER_PIXELS;
+ case RESAMPLE_ANY_METHOD: return ScalingMethod.RESAMPLE_ANY_METHOD;
+ default: throw new IllegalArgumentException("Illegal scaling-method: "
+ + foScalingMethod.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitScalingMethod(final FoContext context) {
- return propertyList.traitScalingMethod(context);
+ public ScalingMethod traitScalingMethod(final FoContext context) {
+ final FoValue foValue = propertyList.traitScalingMethod(context);
+ return convertScalingMethod(foValue);
}
/**
+ * Converts an {@link FoValue} suppress-at-line-break value to the more
+ * generic {@link SuppressAtLineBreak} value.
+ * @param foSuppressAtLineBreak The raw FO suppress-at-line-break to be
+ * converted.
+ * @return The matching SuppressAtLineBreak instance.
+ */
+ private static SuppressAtLineBreak convertSuppressAtLineBreak(
+ final FoValue foSuppressAtLineBreak) {
+ switch (foSuppressAtLineBreak) {
+ case AUTO: return SuppressAtLineBreak.AUTO;
+ case SUPPRESS: return SuppressAtLineBreak.SUPPRESS;
+ case RETAIN: return SuppressAtLineBreak.RETAIN;
+ default: throw new IllegalArgumentException(
+ "Illegal suppress-at-line-break: "
+ + foSuppressAtLineBreak.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitSuppressAtLineBreak(final FoContext context) {
- return propertyList.traitSuppressAtLineBreak(context);
+ public SuppressAtLineBreak traitSuppressAtLineBreak(
+ final FoContext context) {
+ final FoValue foValue = propertyList.traitSuppressAtLineBreak(context);
+ return convertSuppressAtLineBreak(foValue);
}
/**
+ * Converts an {@link FoValue} unicode-bidi value to the more
+ * generic {@link UnicodeBidi} value.
+ * @param foUnicodeBidi The raw FO unicode-bidi to be converted.
+ * @return The matching UnicodeBidi instance.
+ */
+ private static UnicodeBidi convertUnicodeBidi(
+ final FoValue foUnicodeBidi) {
+ switch (foUnicodeBidi) {
+ case NORMAL: return UnicodeBidi.NORMAL;
+ case EMBED: return UnicodeBidi.EMBED;
+ case BIDI_OVERRIDE: return UnicodeBidi.BIDI_OVERRIDE;
+ default: throw new IllegalArgumentException("Illegal unicode-bidi: "
+ + foUnicodeBidi.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitUnicodeBidi(final FoContext context) {
- return propertyList.traitUnicodeBidi(context);
+ public UnicodeBidi traitUnicodeBidi(final FoContext context) {
+ final FoValue foValue = propertyList.traitUnicodeBidi(context);
+ return convertUnicodeBidi(foValue);
}
/**
+ * Converts an {@link FoValue} white-space-treatment value to the more
+ * generic {@link WhiteSpaceTreatment} value.
+ * @param foWhiteSpaceTreatment The raw FO white-space-treatment to be
+ * converted.
+ * @return The matching WhiteSpaceTreatment instance.
+ */
+ private static WhiteSpaceTreatment convertWhiteSpaceTreatment(
+ final FoValue foWhiteSpaceTreatment) {
+ switch (foWhiteSpaceTreatment) {
+ case IGNORE: return WhiteSpaceTreatment.IGNORE;
+ case PRESERVE: return WhiteSpaceTreatment.PRESERVE;
+ case IGNORE_IF_BEFORE_LINEFEED:
+ return WhiteSpaceTreatment.IGNORE_IF_BEFORE_LINEFEED;
+ case IGNORE_IF_AFTER_LINEFEED:
+ return WhiteSpaceTreatment.IGNORE_IF_AFTER_LINEFEED;
+ case IGNORE_IF_SURROUNDING_LINEFEED:
+ return WhiteSpaceTreatment.IGNORE_IF_SURROUNDING_LINEFEED;
+ default: throw new IllegalArgumentException(
+ "Illegal white-space-treatment: "
+ + foWhiteSpaceTreatment.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitWhiteSpaceTreatment(final FoContext context) {
- return propertyList.traitWhiteSpaceTreatment(context);
+ public WhiteSpaceTreatment traitWhiteSpaceTreatment(
+ final FoContext context) {
+ final FoValue foValue = propertyList.traitWhiteSpaceTreatment(context);
+ return convertWhiteSpaceTreatment(foValue);
}
/**
@@ -2556,115 +2764,395 @@
}
/**
+ * Converts an {@link FoValue} active-state value to the more
+ * generic {@link ActiveState} value.
+ * @param foActiveState The raw FO active-state to be converted.
+ * @return The matching ActiveState instance.
+ */
+ private static ActiveState convertActiveState(
+ final FoValue foActiveState) {
+ switch (foActiveState) {
+ case LINK: return ActiveState.LINK;
+ case VISITED: return ActiveState.VISITED;
+ case ACTIVE: return ActiveState.ACTIVE;
+ case HOVER: return ActiveState.HOVER;
+ case FOCUS: return ActiveState.FOCUS;
+ default: throw new IllegalArgumentException("Illegal active-state: "
+ + foActiveState.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitActiveState(final FoContext context) {
- return propertyList.traitActiveState(context);
+ public ActiveState traitActiveState(final FoContext context) {
+ final FoValue foValue = propertyList.traitActiveState(context);
+ return convertActiveState(foValue);
}
/**
+ * Converts an {@link FoValue} clear value to the more
+ * generic {@link Clear} value.
+ * @param foClear The raw FO clear to be converted.
+ * @return The matching Clear instance.
+ */
+ private static Clear convertClear(final FoValue foClear) {
+ switch (foClear) {
+ case START: return Clear.START;
+ case END: return Clear.END;
+ case INSIDE: return Clear.INSIDE;
+ case OUTSIDE: return Clear.OUTSIDE;
+ case BOTH: return Clear.BOTH;
+ case NONE: return Clear.NONE;
+ default: throw new IllegalArgumentException("Illegal clear: "
+ + foClear.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitClear(final FoContext context) {
- return propertyList.traitClear(context);
+ public Clear traitClear(final FoContext context) {
+ final FoValue foValue = propertyList.traitClear(context);
+ return convertClear(foValue);
}
/**
+ * Converts an {@link FoValue} empty-cells value to the more
+ * generic {@link EmptyCells} value.
+ * @param foEmptyCells The raw FO empty-cells to be converted.
+ * @return The matching EmptyCells instance.
+ */
+ private static EmptyCells convertEmptyCells(final FoValue foEmptyCells) {
+ switch (foEmptyCells) {
+ case SHOW: return EmptyCells.SHOW;
+ case HIDE: return EmptyCells.HIDE;
+ default: throw new IllegalArgumentException("Illegal empty-cells: "
+ + foEmptyCells.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitEmptyCells(final FoContext context) {
- return propertyList.traitEmptyCells(context);
+ public EmptyCells traitEmptyCells(final FoContext context) {
+ final FoValue foValue = propertyList.traitEmptyCells(context);
+ return convertEmptyCells(foValue);
}
/**
+ * Converts an {@link FoValue} float value to the more
+ * generic {@link Float} value.
+ * @param foFloat The raw FO float to be converted.
+ * @return The matching Float instance.
+ */
+ private static Float convertFloat(
+ final FoValue foFloat) {
+ switch (foFloat) {
+ case BEFORE: return Float.BEFORE;
+ case START: return Float.START;
+ case END: return Float.END;
+ case INSIDE: return Float.INSIDE;
+ case OUTSIDE: return Float.OUTSIDE;
+ case NONE: return Float.NONE;
+ default: throw new IllegalArgumentException("Illegal float: "
+ + foFloat.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitFloat(final FoContext context) {
- return propertyList.traitFloat(context);
+ public org.axsl.common.value.Float traitFloat(final FoContext context) {
+ final FoValue foValue = propertyList.traitFloat(context);
+ return convertFloat(foValue);
}
/**
+ * Converts an {@link FoValue} media-usage value to the more
+ * generic {@link MediaUsage} value.
+ * @param foMediaUsage The raw FO media-usage to be converted.
+ * @return The matching MediaUsage instance.
+ */
+ private static MediaUsage convertMediaUsage(final FoValue foMediaUsage) {
+ switch (foMediaUsage) {
+ case PAGINATE: return MediaUsage.PAGINATE;
+ case BOUNDED_IN_ONE_DIMENSION:
+ return MediaUsage.BOUNDED_IN_ONE_DIMENSION;
+ case UNBOUNDED: return MediaUsage.UNBOUNDED;
+ default: throw new IllegalArgumentException("Illegal media-usage: "
+ + foMediaUsage.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitMediaUsage(final FoContext context) {
- return propertyList.traitMediaUsage(context);
+ public MediaUsage traitMediaUsage(final FoContext context) {
+ final FoValue foValue = propertyList.traitMediaUsage(context);
+ return convertMediaUsage(foValue);
}
/**
+ * Converts an {@link FoValue} reference-orientation value to the more
+ * generic {@link ReferenceOrientation} value.
+ * @param foReferenceOrientation The raw FO reference-orientation to be
+ * converted.
+ * @return The matching ReferenceOrientation instance.
+ */
+ private static ReferenceOrientation convertReferenceOrientation(
+ final FoValue foReferenceOrientation) {
+ switch (foReferenceOrientation) {
+ case NUM_ZERO: return ReferenceOrientation.NUM_ZERO;
+ case NUM_90: return ReferenceOrientation.NUM_90;
+ case NUM_180: return ReferenceOrientation.NUM_180;
+ case NUM_270: return ReferenceOrientation.NUM_270;
+ case NUM_NEGATIVE_90: return ReferenceOrientation.NUM_270;
+ case NUM_NEGATIVE_180: return ReferenceOrientation.NUM_180;
+ case NUM_NEGATIVE_270: return ReferenceOrientation.NUM_90;
+ default: throw new IllegalArgumentException(
+ "Illegal reference-orientation: "
+ + foReferenceOrientation.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitReferenceOrientation(final FoContext context) {
- /*
- * Per XSL-FO Standard 1.0, Section 7.20.3, reference-orientation is
- * only applied to FOs that establish a reference-area.
- */
+ public ReferenceOrientation traitReferenceOrientation(
+ final FoContext context) {
+ /* Per XSL-FO Standard 1.0, Section 7.20.3, reference-orientation is
+ * only applied to FOs...
[truncated message content] |
|
From: <vic...@us...> - 2007-04-14 18:31:16
|
Revision: 9189
http://svn.sourceforge.net/foray/?rev=9189&view=rev
Author: victormote
Date: 2007-04-14 11:31:17 -0700 (Sat, 14 Apr 2007)
Log Message:
-----------
Conform to axsl changes using typesafe enum.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.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-13 23:58:59 UTC (rev 9188)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-14 18:31:17 UTC (rev 9189)
@@ -35,6 +35,7 @@
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.AbsolutePosition;
+import org.axsl.common.value.AlignmentBaseline;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderStyle;
@@ -1407,7 +1408,7 @@
* @return The alignment-baseline trait for this area.
* @see Fo#traitAlignmentBaseline(FoContext)
*/
- public FoValue traitAlignmentBaseline() {
+ public AlignmentBaseline traitAlignmentBaseline() {
return traitGeneratedBy().traitAlignmentBaseline(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-04-13 23:58:59 UTC (rev 9188)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-14 18:31:17 UTC (rev 9189)
@@ -40,6 +40,7 @@
import org.axsl.common.value.AbsoluteDirection;
import org.axsl.common.value.AbsolutePosition;
import org.axsl.common.value.ActiveState;
+import org.axsl.common.value.AlignmentBaseline;
import org.axsl.common.value.BackgroundAttachment;
import org.axsl.common.value.BackgroundRepeat;
import org.axsl.common.value.Baseline;
@@ -2140,10 +2141,38 @@
}
/**
+ * Converts an {@link FoValue} alignment-baseline value to the more generic
+ * {@link AlignmentBaseline} value.
+ * @param foAlignmentBaseline The raw FO alignment-baseline to be converted.
+ * @return The matching AlignmentBaseline instance.
+ */
+ private static AlignmentBaseline convertAlignmentBaseline(
+ final FoValue foAlignmentBaseline) {
+ switch (foAlignmentBaseline) {
+ case AUTO: return AlignmentBaseline.AUTO;
+ case BASELINE: return AlignmentBaseline.BASELINE;
+ case BEFORE_EDGE: return AlignmentBaseline.BEFORE_EDGE;
+ case TEXT_BEFORE_EDGE: return AlignmentBaseline.TEXT_BEFORE_EDGE;
+ case CENTRAL: return AlignmentBaseline.CENTRAL;
+ case MIDDLE: return AlignmentBaseline.MIDDLE;
+ case AFTER_EDGE: return AlignmentBaseline.AFTER_EDGE;
+ case TEXT_AFTER_EDGE: return AlignmentBaseline.TEXT_AFTER_EDGE;
+ case IDEOGRAPHIC: return AlignmentBaseline.IDEOGRAPHIC;
+ case ALPHABETIC: return AlignmentBaseline.ALPHABETIC;
+ case HANGING: return AlignmentBaseline.HANGING;
+ case MATHEMATICAL: return AlignmentBaseline.MATHEMATICAL;
+ default: throw new IllegalArgumentException(
+ "Illegal alignment-baseline: "
+ + foAlignmentBaseline.toXslFo());
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
- public FoValue traitAlignmentBaseline(final FoContext context) {
- return propertyList.traitAlignmentBaseline(context);
+ public AlignmentBaseline traitAlignmentBaseline(final FoContext context) {
+ final FoValue foValue = propertyList.traitAlignmentBaseline(context);
+ return convertAlignmentBaseline(foValue);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2007-04-13 23:58:59 UTC (rev 9188)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java 2007-04-14 18:31:17 UTC (rev 9189)
@@ -83,7 +83,8 @@
final FoValue keyword = ((PropertyKeyword) value()).getValue();
switch (keyword) {
case INHERIT: {
- return fobj.effectiveParent(context).traitAlignmentBaseline(
+ final FObj parent = fobj.effectiveParent(context);
+ return parent.getPropertyList().traitAlignmentBaseline(
context);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-14 20:12:30
|
Revision: 9192
http://svn.sourceforge.net/foray/?rev=9192&view=rev
Author: victormote
Date: 2007-04-14 13:12:31 -0700 (Sat, 14 Apr 2007)
Log Message:
-----------
Move the mass fo enums from axsl to foray, as we have more specific enums for return types now.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/AbstractFoProperty.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/ObjectMakerFO.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/PropertyMakerFO.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/ConditionalPageMasterReference.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/RetrieveMarker.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentAdjust.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AlignmentBaseline.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AudioDial.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Azimuth.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Background.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundColor.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundImage.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BackgroundPosition.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BaselineShift.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Boolean.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSeparation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderSpacing.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/CaseTitle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Character.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Clip.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Color.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnCount.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnGap.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnNumber.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ColumnWidth.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ContentType.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Cue.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DestinationPlacementOffset.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Dimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DisplayAlign.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/DominantBaseline.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Elevation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Enumerated.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Extent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ExternalDestination.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Font.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontFamily.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSize.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontSizeAdjust.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStretch.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontStyle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontVariant.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/FontWeight.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ForcePageCount.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Format.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GlyphOrientation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/GroupingSize.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphLadderCount.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphPushCharCount.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/HyphRemainCharCount.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Id.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InitialPageNumber.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/InternalDestination.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Keep.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LastLineEndIndent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderLength.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LeaderPatternWidth.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LetterSpacing.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/LineHeight.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/MaximumRepeats.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Name.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsRepeated.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberColumnsSpanned.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/NumberRowsSpanned.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Orphans.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PageDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pause.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Pitch.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/PlayDuring.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvDistanceBetween.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ProvLabelSeparation.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RefId.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RegionName.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeDimension.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Role.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RuleThickness.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Size.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SourceDocument.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SpeechRate.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Src.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/SwitchTo.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TableLayout.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetPresentationContext.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetProcessingContext.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TargetStylesheet.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlign.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAlignLast.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextAltitude.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDecoration.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextDepth.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextIndent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TextShadow.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/TreatAsWordSpace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VerticalAlign.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/VoiceFamily.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Volume.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Widows.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WordSpacing.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/WritingMode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/ZIndex.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthConditional.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtSpace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnFromParent.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnInheritedProp.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/FnNearestSpecProp.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyKeyword.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/xml/prop/Lang.java
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestForcePageCount.java
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestLineHeight.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerLS.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoObject.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoProperty.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoValue.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-04-14 19:43:28 UTC (rev 9191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -30,6 +30,7 @@
import org.foray.common.WKConstants;
import org.foray.common.XMLCharacter;
+import org.foray.fotree.fo.FoValue;
import org.foray.fotree.fo.obj.BookmarkTitle;
import org.axsl.common.value.LinefeedTreatment;
@@ -40,7 +41,6 @@
import org.axsl.foR.FoLineText;
import org.axsl.foR.ProxyFactory;
import org.axsl.foR.fo.Block;
-import org.axsl.foR.fo.FoValue;
import org.axsl.foR.fo.Leader;
import org.axsl.foR.fo.Marker;
import org.axsl.foR.fo.RetrieveMarker;
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-14 19:43:28 UTC (rev 9191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -29,6 +29,7 @@
package org.foray.fotree;
import org.foray.common.XMLCharacter;
+import org.foray.fotree.fo.FoValue;
import org.foray.fotree.fo.obj.Flow;
import org.foray.fotree.fo.obj.ListBlock;
import org.foray.fotree.fo.obj.ListItem;
@@ -92,7 +93,6 @@
import org.axsl.common.value.WritingMode;
import org.axsl.foR.FoContext;
import org.axsl.foR.FoTreeException;
-import org.axsl.foR.fo.FoValue;
import org.axsl.foR.fo.Marker;
import org.axsl.fontR.Font;
import org.axsl.fontR.FontConsumer;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2007-04-14 19:43:28 UTC (rev 9191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/Property.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -28,6 +28,7 @@
package org.foray.fotree;
+import org.foray.fotree.fo.FoValue;
import org.foray.fotree.parse.PropertyParser;
import org.foray.fotree.value.DtInteger;
import org.foray.fotree.value.DtLength;
@@ -36,7 +37,6 @@
import org.foray.fotree.value.PropertyKeyword;
import org.foray.fotree.value.PropertyValue;
-import org.axsl.foR.fo.FoValue;
import org.axsl.foR.PropertyType;
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-04-14 19:43:28 UTC (rev 9191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -29,6 +29,8 @@
package org.foray.fotree;
import org.foray.common.WKConstants;
+import org.foray.fotree.fo.FoProperty;
+import org.foray.fotree.fo.FoValue;
import org.foray.fotree.fo.obj.Region;
import org.foray.fotree.fo.prop.AbsoluteDimension;
import org.foray.fotree.fo.prop.AbsoluteOffset;
@@ -153,8 +155,6 @@
import org.axsl.common.value.Shape;
import org.axsl.foR.FoContext;
import org.axsl.foR.PropertyType;
-import org.axsl.foR.fo.FoProperty;
-import org.axsl.foR.fo.FoValue;
import org.axsl.foR.xml.XmlProperty;
import org.axsl.fontR.FontException;
import org.axsl.graphicR.Graphic;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/AbstractFoProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/AbstractFoProperty.java 2007-04-14 19:43:28 UTC (rev 9191)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/AbstractFoProperty.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -32,8 +32,6 @@
import org.foray.fotree.PropertyList;
import org.foray.fotree.value.PropertyValue;
-import org.axsl.foR.fo.FoProperty;
-
/**
* Superclass for properties in the "fo:" namespace.
*/
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoObject.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoObject.java (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoObject.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -0,0 +1,316 @@
+/*
+ * 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: victormote $
+ */
+
+package org.foray.fotree.fo;
+
+import java.util.Arrays;
+
+/**
+ * An enumeration for XSL-FO objects.
+ */
+public enum FoObject {
+
+ /*
+ * This list is maintained in the same order as OBJECT_NAME_LIST to
+ * facilitate using a binary search on that array and having the index
+ * correspond to the ordinal value of the enumeration.
+ */
+
+ /** Constant indicating a "basic-link" FO. */
+ BASIC_LINK, // 0
+
+ /** Constant indicating a "bidi-override" FO. */
+ BIDI_OVERRIDE, // 1
+
+ /** Constant indicating a "block" FO. */
+ BLOCK, // 2
+
+ /** Constant indicating a "block-container" FO. */
+ BLOCK_CONTAINER, // 3
+
+ /** Constant indicating a "bookmark" FO. */
+ BOOKMARK, // 4
+
+ /** Constant indicating a "bookmark-title" FO. */
+ BOOKMARK_TITLE, // 5
+
+ /** Constant indicating a "bookmark-tree" FO. */
+ BOOKMARK_TREE, // 6
+
+ /** Constant indicating a "character" FO. */
+ CHARACTER, // 7
+
+ /** Constant indicating a "color-profile" FO. */
+ COLOR_PROFILE, // 8
+
+ /** Constant indicating a "conditional-page-master-reference" FO. */
+ CONDITIONAL_PAGE_MASTER_REFERENCE, // 9
+
+ /** Constant indicating a "declarations" FO. */
+ DECLARATIONS, // 10
+
+ /** Constant indicating an "external-graphic" FO. */
+ EXTERNAL_GRAPHIC, // 11
+
+ /** Constant indicating a "float" FO. */
+ FLOAT, // 12
+
+ /** Constant indicating a "flow" FO. */
+ FLOW, // 13
+
+ /** Constant indicating a "footnote" FO. */
+ FOOTNOTE, // 14
+
+ /** Constant indicating a "footnote-body" FO. */
+ FOOTNOTE_BODY, // 15
+
+ /** Constant indicating an "initial-property-set" FO. */
+ INITIAL_PROPERTY_SET, // 16
+
+ /** Constant indicating an "inline" FO. */
+ INLINE, // 17
+
+ /** Constant indicating an "inline-container" FO. */
+ INLINE_CONTAINER, // 18
+
+ /** Constant indicating an "instream-foreign-object" FO. */
+ INSTREAM_FOREIGN_OBJECT, // 19
+
+ /** Constant indicating a "layout-master-set" FO. */
+ LAYOUT_MASTER_SET, // 20
+
+ /** Constant indicating a "leader" FO. */
+ LEADER, // 21
+
+ /** Constant indicating a "list-block" FO. */
+ LIST_BLOCK, // 22
+
+ /** Constant indicating a "list-item" FO. */
+ LIST_ITEM, // 23
+
+ /** Constant indicating a "list-item-body". */
+ LIST_ITEM_BODY, // 24
+
+ /** Constant indicating a "list-item-label" FO. */
+ LIST_ITEM_LABEL, // 25
+
+ /** Constant indicating a "marker" FO. */
+ MARKER, // 26
+
+ /** Constant indicating a "multi-case" FO. */
+ MULTI_CASE, // 27
+
+ /** Constant indicating a "multi-properties" FO. */
+ MULTI_PROPERTIES, // 28
+
+ /** Constant indicating a "multi-property-set" FO. */
+ MULTI_PROPERTY_SET, // 29
+
+ /** Constant indicating a "multi-switch" FO. */
+ MULTI_SWITCH, // 30
+
+ /** Constant indicating a "multi-toggle" FO. */
+ MULTI_TOGGLE, // 31
+
+ /** Constant indicating a "page-number" FO. */
+ PAGE_NUMBER, // 32
+
+ /** Constant indicating a "page-number-citation" FO. */
+ PAGE_NUMBER_CITATION, // 33
+
+ /** Constant indicating a "page-sequence" FO. */
+ PAGE_SEQUENCE, // 34
+
+ /** Constant indicating a "page-sequence-master" FO. */
+ PAGE_SEQUENCE_MASTER, // 35
+
+ /** Constant indicating a "region-after" FO. */
+ REGION_AFTER, // 36
+
+ /** Constant indicating a "region-before" FO. */
+ REGION_BEFORE, // 37
+
+ /** Constant indicating a "region-body" FO. */
+ REGION_BODY, // 38
+
+ /** Constant indicating a "region-end" FO. */
+ REGION_END, // 39
+
+ /** Constant indicating a "region-start" FO. */
+ REGION_START, // 40
+
+ /** Constant indicating a "repeatable-page-master-alternatives" FO. */
+ REPEATABLE_PAGE_MASTER_ALTERNATIVES, // 41
+
+ /** Constant indicating a "repeatable-page-master-reference" FO. */
+ REPEATABLE_PAGE_MASTER_REFERENCE, // 42
+
+ /** Constant indicating a "retrieve-marker" FO. */
+ RETRIEVE_MARKER, // 43
+
+ /** Constant indicating a "root" FO. */
+ ROOT, // 44
+
+ /** Constant indicating a "simple-page-master". */
+ SIMPLE_PAGE_MASTER, // 45
+
+ /** Constant indicating a "single-page-master-reference" FO. */
+ SINGLE_PAGE_MASTER_REFERENCE, // 46
+
+ /** Constant indicating a "static-content" FO. */
+ STATIC_CONTENT, // 47
+
+ /** Constant indicating a "table" FO. */
+ TABLE, // 48
+
+ /** Constant indicating a "table-and-caption" FO. */
+ TABLE_AND_CAPTION, // 49
+
+ /** Constant indicating a "table-body" FO. */
+ TABLE_BODY, // 50
+
+ /** Constant indicating a "table-caption" FO. */
+ TABLE_CAPTION, // 51
+
+ /** Constant indicating a "table-cell" FO. */
+ TABLE_CELL, // 52
+
+ /** Constant indicating a "table-column" FO. */
+ TABLE_COLUMN, // 53
+
+ /** Constant indicating a "table-footer" FO. */
+ TABLE_FOOTER, // 54
+
+ /** Constant indicating a "table-header" FO. */
+ TABLE_HEADER, // 55
+
+ /** Constant indicating a "table-row" FO. */
+ TABLE_ROW, // 56
+
+ /** Constant indicating a "title" FO. */
+ TITLE, // 57
+
+ /** Constant indicating a "wrapper" FO. */
+ WRAPPER; // 58
+
+ /**
+ * A sorted list of valid object names.
+ * This list should always be maintained in sorted order, so that binary
+ * searches can be used.
+ */
+ private static final String[] OBJECT_NAME_LIST = {
+ "basic-link", // 0
+ "bidi-override", // 1
+ "block", // 2
+ "block-container", // 3
+ "bookmark", // 4
+ "bookmark-title", // 5
+ "bookmark-tree", // 6
+ "character", // 7
+ "color-profile", // 8
+ "conditional-page-master-reference", // 9
+ "declarations", // 10
+ "external-graphic", // 11
+ "float", // 12
+ "flow", // 13
+ "footnote", // 14
+ "footnote-body", // 15
+ "initial-property-set", // 16
+ "inline", // 17
+ "inline-container", // 18
+ "instream-foreign-object", // 19
+ "layout-master-set", // 20
+ "leader", // 21
+ "list-block", // 22
+ "list-item", // 23
+ "list-item-body", // 24
+ "list-item-label", // 25
+ "marker", // 26
+ "multi-case", // 27
+ "multi-properties", // 28
+ "multi-property-set", // 29
+ "multi-switch", // 30
+ "multi-toggle", // 31
+ "page-number", // 32
+ "page-number-citation", // 33
+ "page-sequence", // 34
+ "page-sequence-master", // 35
+ "region-after", // 36
+ "region-before", // 37
+ "region-body", // 38
+ "region-end", // 39
+ "region-start", // 40
+ "repeatable-page-master-alternatives", // 41
+ "repeatable-page-master-reference", // 42
+ "retrieve-marker", // 43
+ "root", // 44
+ "simple-page-master", // 45
+ "single-page-master-reference", // 46
+ "static-content", // 47
+ "table", // 48
+ "table-and-caption", // 49
+ "table-body", // 50
+ "table-caption", // 51
+ "table-cell", // 52
+ "table-column", // 53
+ "table-footer", // 54
+ "table-header", // 55
+ "table-row", // 56
+ "title", // 57
+ "wrapper", // 58
+ };
+
+ /**
+ * Converts an object name enumeration to its XSL-FO name.
+ * For example, the enumeration {@link FoObject#TABLE_ROW} converts to the
+ * XSL-FO name "table-row".
+ * @return The XSL-FO name for the object enumeration.
+ */
+ public String toXslFo() {
+ return FoObject.OBJECT_NAME_LIST[this.ordinal()];
+ }
+
+ /**
+ * Similar to the Java 1.5 Enum valueOf(String) method, but operates on the
+ * XSL-FO name of the object instead of its enumerated name.
+ * For example, for the XSL-FO object "table-row", the enum is
+ * {@link FoObject#TABLE_ROW}.
+ * The Java 1.5 Enum valueOf(String) method would operate on the enum name
+ * "TABLE_ROW".
+ * This method instead operates on "table-row".
+ * @param xslName The name of the XSL-FO object for which the enumerated
+ * value is needed.
+ * @return The enumerated value for <code>xslName</code>.
+ */
+ public static FoObject xslValueOf(final String xslName) {
+ final int ordinal = Arrays.binarySearch(FoObject.OBJECT_NAME_LIST,
+ xslName);
+ return FoObject.values()[ordinal];
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoObject.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoProperty.java (rev 0)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/FoProperty.java 2007-04-14 20:12:31 UTC (rev 9192)
@@ -0,0 +1,1078 @@
+/*
+ * 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$
+ * $LastChanged...
[truncated message content] |
|
From: <vic...@us...> - 2007-04-18 17:07:45
|
Revision: 9203
http://svn.sourceforge.net/foray/?rev=9203&view=rev
Author: victormote
Date: 2007-04-18 10:07:45 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Extract a standard method and move it to a utility class for reuse.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java
trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java 2007-04-18 16:01:52 UTC (rev 9202)
+++ trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java 2007-04-18 17:07:45 UTC (rev 9203)
@@ -29,6 +29,7 @@
package org.foray.common;
import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
@@ -59,4 +60,24 @@
}
}
+ /**
+ * Creates a SAX2 parser with a standard configuration. Specifically,
+ * the parser is namespace-aware and has the "namespace-prefixes" feature
+ * set to true.
+ * @return The newly-created SAX2 parser.
+ * @throws SAXException For errors creating the parser.
+ * @throws ParserConfigurationException For errors configuring the parser.
+ */
+ public static XMLReader createSax2Parser() throws SAXException,
+ ParserConfigurationException {
+ final SAXParserFactory spf =
+ javax.xml.parsers.SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = null;
+ xmlReader = spf.newSAXParser().getXMLReader();
+ xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes",
+ true);
+ return xmlReader;
+ }
+
}
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2007-04-18 16:01:52 UTC (rev 9202)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2007-04-18 17:07:45 UTC (rev 9203)
@@ -53,7 +53,7 @@
import java.util.ArrayList;
import java.util.List;
-import javax.xml.parsers.SAXParserFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
@@ -443,29 +443,14 @@
* @throws FOrayException For errors creating the parser.
*/
XMLReader createParser() throws FOrayException {
- final SAXParserFactory spf =
- javax.xml.parsers.SAXParserFactory.newInstance();
- spf.setNamespaceAware(true);
- XMLReader xmlReader = null;
+ XMLReader xmlReader;
try {
- xmlReader = spf.newSAXParser().getXMLReader();
- } catch (final javax.xml.parsers.ParserConfigurationException e) {
- throw new FOrayException(e);
+ xmlReader = XMLParser.createSax2Parser();
} catch (final SAXException e) {
throw new FOrayException(e);
+ } catch (final ParserConfigurationException e) {
+ throw new FOrayException(e);
}
- try {
- xmlReader.setFeature(
- "http://xml.org/sax/features/namespace-prefixes", true);
- } catch (final SAXException e) {
- throw new FOrayException("Error in setting up parser feature "
- + "namespace-prefixes\n"
- + "You need a parser which supports SAX version 2", e);
- }
- if (this.getLogger().isDebugEnabled()) {
- this.getLogger().debug("FO Parsing: Using "
- + xmlReader.getClass().getName() + " as SAX2 Parser.");
- }
return xmlReader;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-18 17:13:02
|
Revision: 9204
http://svn.sourceforge.net/foray/?rev=9204&view=rev
Author: victormote
Date: 2007-04-18 10:13:01 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Move and rename utility class, for clarity.
Modified Paths:
--------------
trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java
trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/sax/SaxParser.java
Removed Paths:
-------------
trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java
Deleted: trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java 2007-04-18 17:07:45 UTC (rev 9203)
+++ trunk/foray/foray-common/src/java/org/foray/common/XMLParser.java 2007-04-18 17:13:01 UTC (rev 9204)
@@ -1,83 +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 org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-/**
- * Utility class that provides information about an XML Parser.
- */
-public final class XMLParser {
-
- /**
- * Private constructor (should not be instantiated).
- */
- private XMLParser() {
- }
-
- /**
- * Returns the name of the SAX Parser class that is found in the classpath.
- * @return The name of the SAX Parser class that is found in the classpath.
- */
- public static String getParserClassName() {
- try {
- return SAXParserFactory.newInstance().newSAXParser()
- .getXMLReader().getClass().getName();
- } catch (final ParserConfigurationException e) {
- return null;
- } catch (final SAXException e) {
- return null;
- }
- }
-
- /**
- * Creates a SAX2 parser with a standard configuration. Specifically,
- * the parser is namespace-aware and has the "namespace-prefixes" feature
- * set to true.
- * @return The newly-created SAX2 parser.
- * @throws SAXException For errors creating the parser.
- * @throws ParserConfigurationException For errors configuring the parser.
- */
- public static XMLReader createSax2Parser() throws SAXException,
- ParserConfigurationException {
- final SAXParserFactory spf =
- javax.xml.parsers.SAXParserFactory.newInstance();
- spf.setNamespaceAware(true);
- XMLReader xmlReader = null;
- xmlReader = spf.newSAXParser().getXMLReader();
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes",
- true);
- return xmlReader;
- }
-
-}
Added: trunk/foray/foray-common/src/java/org/foray/common/sax/SaxParser.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/sax/SaxParser.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/sax/SaxParser.java 2007-04-18 17:13:01 UTC (rev 9204)
@@ -0,0 +1,83 @@
+/*
+ * 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: victormote $
+ */
+
+package org.foray.common.sax;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+/**
+ * Utility class that provides information about an XML Parser.
+ */
+public final class SaxParser {
+
+ /**
+ * Private constructor (should not be instantiated).
+ */
+ private SaxParser() {
+ }
+
+ /**
+ * Returns the name of the SAX Parser class that is found in the classpath.
+ * @return The name of the SAX Parser class that is found in the classpath.
+ */
+ public static String getParserClassName() {
+ try {
+ return SAXParserFactory.newInstance().newSAXParser()
+ .getXMLReader().getClass().getName();
+ } catch (final ParserConfigurationException e) {
+ return null;
+ } catch (final SAXException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Creates a SAX2 parser with a standard configuration. Specifically,
+ * the parser is namespace-aware and has the "namespace-prefixes" feature
+ * set to true.
+ * @return The newly-created SAX2 parser.
+ * @throws SAXException For errors creating the parser.
+ * @throws ParserConfigurationException For errors configuring the parser.
+ */
+ public static XMLReader createSax2Parser() throws SAXException,
+ ParserConfigurationException {
+ final SAXParserFactory spf =
+ javax.xml.parsers.SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = null;
+ xmlReader = spf.newSAXParser().getXMLReader();
+ xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes",
+ true);
+ return xmlReader;
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/sax/SaxParser.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java
===================================================================
--- trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2007-04-18 17:07:45 UTC (rev 9203)
+++ trunk/foray/foray-core/src/java/org/foray/core/FOrayDocument.java 2007-04-18 17:13:01 UTC (rev 9204)
@@ -28,9 +28,9 @@
package org.foray.core;
-import org.foray.common.XMLParser;
import org.foray.common.sax.DocumentInputSource;
import org.foray.common.sax.DocumentReader;
+import org.foray.common.sax.SaxParser;
import org.axsl.areaW.AreaTreeFactory;
import org.axsl.fontR.FontConsumer;
@@ -369,7 +369,7 @@
* @return The name of the SAX parser.
*/
public String getParserClassName() {
- return XMLParser.getParserClassName();
+ return SaxParser.getParserClassName();
}
/**
@@ -445,7 +445,7 @@
XMLReader createParser() throws FOrayException {
XMLReader xmlReader;
try {
- xmlReader = XMLParser.createSax2Parser();
+ xmlReader = SaxParser.createSax2Parser();
} catch (final SAXException e) {
throw new FOrayException(e);
} catch (final ParserConfigurationException e) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2007-04-18 17:07:45 UTC (rev 9203)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2007-04-18 17:13:01 UTC (rev 9204)
@@ -29,7 +29,7 @@
package org.foray.fotree;
import org.foray.common.ClassService;
-import org.foray.common.XMLParser;
+import org.foray.common.sax.SaxParser;
import org.foray.fotree.fo.NamespaceFO;
import org.foray.fotree.foray.NamespaceExtensions;
import org.foray.fotree.svg.NamespaceSVG;
@@ -121,7 +121,7 @@
registerNamespace(xml);
setXMLNamespace(xml);
final NamespaceSVG svg = new NamespaceSVG(
- XMLParser.getParserClassName());
+ SaxParser.getParserClassName());
registerNamespace(svg);
setSVGNamespace(svg);
final NamespaceExtensions extensions = new NamespaceExtensions();
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java 2007-04-18 17:07:45 UTC (rev 9203)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/FOrayGraphicServer.java 2007-04-18 17:13:01 UTC (rev 9204)
@@ -29,7 +29,7 @@
package org.foray.graphic;
import org.foray.common.Logging;
-import org.foray.common.XMLParser;
+import org.foray.common.sax.SaxParser;
import org.foray.common.url.URLUtil;
import org.foray.graphic.factory.BMPFactory;
import org.foray.graphic.factory.EPSFactory;
@@ -96,7 +96,7 @@
if (this.logger == null) {
this.logger = Logging.makeDefaultLogger();
}
- this.svgParserClassName = XMLParser.getParserClassName();
+ this.svgParserClassName = SaxParser.getParserClassName();
registerStandardFactories();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-18 20:51:09
|
Revision: 9209
http://svn.sourceforge.net/foray/?rev=9209&view=rev
Author: victormote
Date: 2007-04-18 13:51:08 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
1. Add more tests to TestInvalidXml.
2. Move the test files to the new directory.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java
Added Paths:
-----------
trunk/foray/resource/test/fo/
trunk/foray/resource/test/fo/invalid-xml-001.fo
trunk/foray/resource/test/fo/invalid-xml-002.fo
trunk/foray/resource/test/fo/invalid-xml-003.fo
Removed Paths:
-------------
trunk/foray/resource/test/errors/inavlidxml.fo
trunk/foray/resource/test/errors/inavlidxml1.fo
trunk/foray/resource/test/errors/inavlidxml2.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java 2007-04-18 20:41:51 UTC (rev 9208)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java 2007-04-18 20:51:08 UTC (rev 9209)
@@ -38,17 +38,45 @@
public class TestInvalidXml extends TestCase {
/**
- * Test of fo/invalidxml.fo.
+ * Test of fo/invalid-xml-001.fo.
* @throws FOrayException For errors creating the FO Tree.
*/
public void testDocument001() throws FOrayException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
- reader.buildFoTree("errors/inavlidxml.fo");
+ reader.buildFoTree("fo/invalid-xml-001.fo");
fail("Expected FOrayException indicating invalid XML content.");
} catch (final FOrayException e) {
/* Do nothing. This is the expected case. */
}
}
+ /**
+ * Test of fo/invalid-xml-002.fo.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testDocument002() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ try {
+ reader.buildFoTree("fo/invalid-xml-002.fo");
+ fail("Expected FOrayException indicating invalid XML content.");
+ } catch (final FOrayException e) {
+ /* Do nothing. This is the expected case. */
+ }
+ }
+
+ /**
+ * Test of fo/invalid-xml-003.fo.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testDocument003() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ try {
+ reader.buildFoTree("fo/invalid-xml-003.fo");
+ fail("Expected FOrayException indicating invalid XML content.");
+ } catch (final FOrayException e) {
+ /* Do nothing. This is the expected case. */
+ }
+ }
+
}
Deleted: trunk/foray/resource/test/errors/inavlidxml.fo
===================================================================
--- trunk/foray/resource/test/errors/inavlidxml.fo 2007-04-18 20:41:51 UTC (rev 9208)
+++ trunk/foray/resource/test/errors/inavlidxml.fo 2007-04-18 20:51:08 UTC (rev 9209)
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-fegsdfgdsgfsdgf
-
Deleted: trunk/foray/resource/test/errors/inavlidxml1.fo
===================================================================
--- trunk/foray/resource/test/errors/inavlidxml1.fo 2007-04-18 20:41:51 UTC (rev 9208)
+++ trunk/foray/resource/test/errors/inavlidxml1.fo 2007-04-18 20:51:08 UTC (rev 9209)
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<fo:root>
-<fo:page-sequence>
-<fo:root>
Deleted: trunk/foray/resource/test/errors/inavlidxml2.fo
===================================================================
--- trunk/foray/resource/test/errors/inavlidxml2.fo 2007-04-18 20:41:51 UTC (rev 9208)
+++ trunk/foray/resource/test/errors/inavlidxml2.fo 2007-04-18 20:51:08 UTC (rev 9209)
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-fegsdfgdsgfsdgf
-
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <!-- defines page layout -->
- <fo:layout-master-set>
- <fo:simple-page-master master-name="first"
- page-height="29.7cm" page-width="21cm"
- margin-top="1cm"
- margin-bottom="2cm"
- margin-left="2.5cm"
- margin-right="2.5cm">
- <fo:region-body margin-top="3cm"/>
- <fo:region-before extent="3cm"/>
- <fo:region-after extent="1.5cm"/>
- </fo:simple-page-master>
- </fo:layout-master-set>
- <!-- end: defines page layout -->
-
- <!-- actual layout -->
- <fo:page-sequence master-reference="first">
-
- <!-- text body -->
- <fo:flow flow-name="xsl-region-body">
-
- <!-- Normal text -->
- <fo:block text-align="center">0. Normal text without link
- </fo:block>
-</fo:flow>
-</fo:page-sequence>
-</fo:root>
-
Copied: trunk/foray/resource/test/fo/invalid-xml-001.fo (from rev 8434, trunk/foray/resource/test/errors/inavlidxml.fo)
===================================================================
--- trunk/foray/resource/test/fo/invalid-xml-001.fo (rev 0)
+++ trunk/foray/resource/test/fo/invalid-xml-001.fo 2007-04-18 20:51:08 UTC (rev 9209)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+fegsdfgdsgfsdgf
+
Copied: trunk/foray/resource/test/fo/invalid-xml-002.fo (from rev 8434, trunk/foray/resource/test/errors/inavlidxml1.fo)
===================================================================
--- trunk/foray/resource/test/fo/invalid-xml-002.fo (rev 0)
+++ trunk/foray/resource/test/fo/invalid-xml-002.fo 2007-04-18 20:51:08 UTC (rev 9209)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<fo:root>
+<fo:page-sequence>
+<fo:root>
Copied: trunk/foray/resource/test/fo/invalid-xml-003.fo (from rev 8434, trunk/foray/resource/test/errors/inavlidxml2.fo)
===================================================================
--- trunk/foray/resource/test/fo/invalid-xml-003.fo (rev 0)
+++ trunk/foray/resource/test/fo/invalid-xml-003.fo 2007-04-18 20:51:08 UTC (rev 9209)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+fegsdfgdsgfsdgf
+
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+
+ <!-- defines page layout -->
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="first"
+ page-height="29.7cm" page-width="21cm"
+ margin-top="1cm"
+ margin-bottom="2cm"
+ margin-left="2.5cm"
+ margin-right="2.5cm">
+ <fo:region-body margin-top="3cm"/>
+ <fo:region-before extent="3cm"/>
+ <fo:region-after extent="1.5cm"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <!-- end: defines page layout -->
+
+ <!-- actual layout -->
+ <fo:page-sequence master-reference="first">
+
+ <!-- text body -->
+ <fo:flow flow-name="xsl-region-body">
+
+ <!-- Normal text -->
+ <fo:block text-align="center">0. Normal text without link
+ </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-04-18 21:14:39
|
Revision: 9211
http://svn.sourceforge.net/foray/?rev=9211&view=rev
Author: victormote
Date: 2007-04-18 14:14:41 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Fix and use two more test files.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java
trunk/foray/resource/test/fo/invalid-fo-001.fo
trunk/foray/resource/test/fo/invalid-ns-001.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java 2007-04-18 21:07:43 UTC (rev 9210)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java 2007-04-18 21:14:41 UTC (rev 9211)
@@ -41,7 +41,7 @@
* Test of fo/invalid-xml-001.fo.
* @throws FOrayException For errors creating the FO Tree.
*/
- public void testDocument001() throws FOrayException {
+ public void testXml001() throws FOrayException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-xml-001.fo");
@@ -55,7 +55,7 @@
* Test of fo/invalid-xml-002.fo.
* @throws FOrayException For errors creating the FO Tree.
*/
- public void testDocument002() throws FOrayException {
+ public void testXml002() throws FOrayException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-xml-002.fo");
@@ -69,7 +69,7 @@
* Test of fo/invalid-xml-003.fo.
* @throws FOrayException For errors creating the FO Tree.
*/
- public void testDocument003() throws FOrayException {
+ public void testXml003() throws FOrayException {
final FoDocumentReader reader = FoDocumentReader.getInstance();
try {
reader.buildFoTree("fo/invalid-xml-003.fo");
@@ -79,4 +79,34 @@
}
}
+ /**
+ * Test of fo/invalid-ns-001.fo, which contains an unregistered namespace.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testNamespace001() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ try {
+ reader.buildFoTree("fo/invalid-ns-001.fo");
+ fail("Expected FOrayException indicating an unregistered "
+ + "namespace.");
+ } catch (final FOrayException e) {
+ /* Do nothing. This is the expected case. */
+ }
+ }
+
+ /**
+ * Test of fo/invalid-fo-001.fo, which has no root element.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testFo001() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ try {
+ reader.buildFoTree("fo/invalid-fo-001.fo");
+ fail("Expected FOrayException indicating that the root element "
+ + "is missing.");
+ } catch (final FOrayException e) {
+ /* Do nothing. This is the expected case. */
+ }
+ }
+
}
Modified: trunk/foray/resource/test/fo/invalid-fo-001.fo
===================================================================
--- trunk/foray/resource/test/fo/invalid-fo-001.fo 2007-04-18 21:07:43 UTC (rev 9210)
+++ trunk/foray/resource/test/fo/invalid-fo-001.fo 2007-04-18 21:14:41 UTC (rev 9211)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- defines page layout -->
- <fo:layout-master-set>
+ <fo:layout-master-set xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:simple-page-master master-name="first"
page-height="29.7cm" page-width="21cm"
margin-top="1cm"
Modified: trunk/foray/resource/test/fo/invalid-ns-001.fo
===================================================================
--- trunk/foray/resource/test/fo/invalid-ns-001.fo 2007-04-18 21:07:43 UTC (rev 9210)
+++ trunk/foray/resource/test/fo/invalid-ns-001.fo 2007-04-18 21:14:41 UTC (rev 9211)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<fo:root source-document="a" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
margin-right="1.5cm"
@@ -16,9 +16,9 @@
</fo:layout-master-set>
<fo:page-sequence master-reference="first">
- <fo:flow source-document="a" flow-name="xsl-region-body">
+ <fo:flow flow-name="xsl-region-body">
- <fo:block source-document="inherit" space-before.optimum="3pt" space-after.optimum="15pt">
+ <fo:block space-before.optimum="3pt" space-after.optimum="15pt">
The Counter Extension
</fo:block>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-18 21:20:56
|
Revision: 9212
http://svn.sourceforge.net/foray/?rev=9212&view=rev
Author: victormote
Date: 2007-04-18 14:20:58 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Move, rename, and use another test file.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java
Added Paths:
-----------
trunk/foray/resource/test/fo/invalid-ns-002.fo
Removed Paths:
-------------
trunk/foray/resource/test/errors/
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java 2007-04-18 21:14:41 UTC (rev 9211)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestInvalidXml.java 2007-04-18 21:20:58 UTC (rev 9212)
@@ -95,6 +95,22 @@
}
/**
+ * Test of fo/invalid-ns-002.fo, which contains an unregistered namespace
+ * inside some foreign xml.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testNamespace002() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ try {
+ reader.buildFoTree("fo/invalid-ns-002.fo");
+ fail("Expected FOrayException indicating an unregistered "
+ + "namespace.");
+ } catch (final FOrayException e) {
+ /* Do nothing. This is the expected case. */
+ }
+ }
+
+ /**
* Test of fo/invalid-fo-001.fo, which has no root element.
* @throws FOrayException For errors creating the FO Tree.
*/
Copied: trunk/foray/resource/test/fo/invalid-ns-002.fo (from rev 8434, trunk/foray/resource/test/errors/foreign.fo)
===================================================================
--- trunk/foray/resource/test/fo/invalid-ns-002.fo (rev 0)
+++ trunk/foray/resource/test/fo/invalid-ns-002.fo 2007-04-18 21:20:58 UTC (rev 9212)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master
+ margin-right="1.5cm"
+ margin-left="1.5cm"
+ margin-bottom="2cm"
+ margin-top="1cm"
+ page-width="21cm"
+ page-height="29.7cm"
+ master-name="first">
+ <fo:region-before extent="1cm"/>
+ <fo:region-body margin-top="1cm"/>
+ <fo:region-after extent="1.5cm"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+
+ <fo:page-sequence master-reference="first">
+ <fo:static-content flow-name="xsl-region-before">
+ <fo:block line-height="14pt" font-size="10pt"
+ text-align="end">Embedding SVG examples</fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block line-height="14pt" font-size="10pt"
+ text-align="end">Page <fo:page-number/></fo:block>
+ </fo:static-content>
+
+ <fo:flow flow-name="xsl-region-body">
+
+ <fo:block text-align="center" font-weight="bold" font-size="14pt" space-before.optimum="3pt" space-after.optimum="15pt">
+ Embedding SVG
+ </fo:block>
+
+ <fo:block space-before.optimum="3pt" space-after.optimum="20pt">
+<fo:instream-foreign-object>
+<foo xmlns="http://www.foo.com" width="20" height="20">
+ <g style="fill:red; stroke:#000000">
+ <rect x="0" y="0" width="15" height="15"/>
+ <rect x="5" y="5" width="15" height="15"/>
+ </g>
+</foo>
+</fo:instream-foreign-object>
+ </fo:block>
+
+ <fo:block space-before.optimum="5pt">
+<fo:instream-foreign-object xmlns:svg="http://www.w3.org/2000/svg">
+<svg:svg width="20" height="20">
+ <svg:g style="fill:red; stroke:#000000">
+ <svg:rect x="0" y="0" width="15" height="15"/>
+ <svg:rect x="5" y="5" width="15" height="15"/>
+ </svg:g>
+</svg:svg>
+</fo:instream-foreign-object>
+ </fo:block>
+
+<foo xmlns="http://www.foo.com" width="20" height="20">
+ <g style="fill:red; stroke:#000000">
+ <rect x="0" y="0" width="15" height="15"/>
+ <rect x="5" y="5" width="15" height="15"/>
+ </g>
+</foo>
+
+<foo width="20" height="20">
+ <rect x="5" y="5" width="15" height="15"/>
+</foo>
+
+<fo:foo width="20" height="20">
+ <fo:rect x="5" y="5" width="15" height="15"/>
+</fo:foo>
+ </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-04-18 21:45:18
|
Revision: 9213
http://svn.sourceforge.net/foray/?rev=9213&view=rev
Author: victormote
Date: 2007-04-18 14:45:19 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Move, rename, and use test file for font-size.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
Added Paths:
-----------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
trunk/foray/resource/test/fo/font-size-001.fo
Removed Paths:
-------------
trunk/foray/resource/test/xml/bugtests/font-size.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java 2007-04-18 21:20:58 UTC (rev 9212)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java 2007-04-18 21:45:19 UTC (rev 9213)
@@ -45,6 +45,7 @@
final TestSuite testSuite = new TestSuite();
testSuite.addTestSuite(TestInvalidXml.class);
+ testSuite.addTestSuite(TestFont.class);
return testSuite;
}
Added: trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java (rev 0)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java 2007-04-18 21:45:19 UTC (rev 9213)
@@ -0,0 +1,75 @@
+/*
+ * 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.app;
+
+import org.foray.core.FOrayException;
+import org.foray.fotree.FONode;
+import org.foray.fotree.FOTreeBuilder;
+import org.foray.fotree.fo.obj.Block;
+import org.foray.fotree.fo.obj.Flow;
+import org.foray.fotree.fo.obj.PageSequence;
+import org.foray.fotree.fo.obj.Root;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests of various font properties at the FO Tree level.
+ */
+public class TestFont extends TestCase {
+
+ /**
+ * Test of fo/font-size-001.fo.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testFontSize001() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ final FOTreeBuilder foTree = reader.buildFoTree("fo/font-size-001.fo");
+ final Root root = foTree.getRootFObj();
+ FONode node = root.getChildAt(1);
+ assertTrue(node instanceof PageSequence);
+ final PageSequence sequence = (PageSequence) node;
+ node = sequence.getChildAt(0);
+ assertTrue(node instanceof Flow);
+ final Flow flow = (Flow) node;
+
+ node = flow.getChildAt(0);
+ assertTrue(node instanceof Block);
+ Block block = (Block) node;
+ int fontSize = block.traitFontSize(null);
+ /* The default font size is 12 points. */
+ assertEquals(12000, fontSize);
+
+ node = flow.getChildAt(1);
+ assertTrue(node instanceof Block);
+ block = (Block) node;
+ fontSize = block.traitFontSize(null);
+ assertEquals(8000, fontSize);
+ }
+
+}
Property changes on: trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2007-04-18 21:20:58 UTC (rev 9212)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2007-04-18 21:45:19 UTC (rev 9213)
@@ -432,7 +432,7 @@
/**
* {@inheritDoc}
*/
- public org.axsl.foR.fo.Root getRootFObj() {
+ public Root getRootFObj() {
return this.rootFObj;
}
Copied: trunk/foray/resource/test/fo/font-size-001.fo (from rev 9211, trunk/foray/resource/test/xml/bugtests/font-size.fo)
===================================================================
--- trunk/foray/resource/test/fo/font-size-001.fo (rev 0)
+++ trunk/foray/resource/test/fo/font-size-001.fo 2007-04-18 21:45:19 UTC (rev 9213)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simplePM"
+ page-height="25cm"
+ page-width="20cm"
+ margin-top="1cm"
+ margin-bottom="1cm"
+ margin-left="1.5cm"
+ margin-right="1.5cm">
+ <fo:region-before extent="2.5cm"/>
+ <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
+ <fo:region-after extent="2.5cm"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+
+ <fo:page-sequence master-reference="simplePM">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ This is a simple fo text in the default font size and default font.
+ </fo:block>
+
+ <fo:block font-family="Courier" font-size="8pt">
+ This is a simple fo text in 8pt font Courier.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="10pt">
+ This is a simple fo text in 10pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="12pt">
+ This is a simple fo text in 12pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="14pt">
+ This is a simple fo text in 14pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="16pt">
+ This is a simple fo text in 16pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="18pt">
+ This is a simple fo text in 18pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="20pt">
+ This is a simple fo text in 20pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="24pt">
+ This is a simple fo text in 24pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="32pt">
+ This is a simple fo text in 32pt font.
+ </fo:block>
+
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>
Deleted: trunk/foray/resource/test/xml/bugtests/font-size.fo
===================================================================
--- trunk/foray/resource/test/xml/bugtests/font-size.fo 2007-04-18 21:20:58 UTC (rev 9212)
+++ trunk/foray/resource/test/xml/bugtests/font-size.fo 2007-04-18 21:45:19 UTC (rev 9213)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <fo:layout-master-set>
- <fo:simple-page-master master-name="simplePM"
- page-height="25cm"
- page-width="20cm"
- margin-top="1cm"
- margin-bottom="1cm"
- margin-left="1.5cm"
- margin-right="1.5cm">
- <fo:region-before extent="2.5cm"/>
- <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
- <fo:region-after extent="2.5cm"/>
- </fo:simple-page-master>
- </fo:layout-master-set>
-
- <fo:page-sequence master-reference="simplePM">
- <fo:flow flow-name="xsl-region-body">
- <fo:block>
- This is a simple fo text in the default font size and default font.
- </fo:block>
-
- <fo:block font-family="Courier" font-size="8pt">
- This is a simple fo text in 8pt font Courier.
- </fo:block>
- <fo:block font-family="Courier" font-size="10pt">
- This is a simple fo text in 10pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="12pt">
- This is a simple fo text in 12pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="14pt">
- This is a simple fo text in 14pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="16pt">
- This is a simple fo text in 16pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="18pt">
- This is a simple fo text in 18pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="20pt">
- This is a simple fo text in 20pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="24pt">
- This is a simple fo text in 24pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="32pt">
- This is a simple fo text in 32pt font.
- </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-04-18 22:33:35
|
Revision: 9217
http://svn.sourceforge.net/foray/?rev=9217&view=rev
Author: victormote
Date: 2007-04-18 15:33:36 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Move,rename and use font-family test file.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
Added Paths:
-----------
trunk/foray/resource/test/fo/font-family-001.fo
Removed Paths:
-------------
trunk/foray/resource/test/xml/bugtests/font-family.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java 2007-04-18 22:26:17 UTC (rev 9216)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java 2007-04-18 22:33:36 UTC (rev 9217)
@@ -41,6 +41,53 @@
public class TestFont extends AbstractFoTreeTest {
/**
+ * Test of fo/font-family-001.fo.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testFontFamily001() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ final FOTreeBuilder foTree = reader.buildFoTree(
+ "fo/font-family-001.fo");
+ final Flow flow = this.getFlow(foTree);
+
+ FONode node = flow.getChildAt(0);
+ assertTrue(node instanceof Block);
+ Block block = (Block) node;
+ String[] fontFamilies = block.traitFontFamily(null);
+ assertEquals(1, fontFamilies.length);
+ /* The default font-family is "serif". */
+ assertEquals("serif", fontFamilies[0]);
+
+ node = flow.getChildAt(1);
+ assertTrue(node instanceof Block);
+ block = (Block) node;
+ fontFamilies = block.traitFontFamily(null);
+ assertEquals(1, fontFamilies.length);
+ assertEquals("sans-serif", fontFamilies[0]);
+
+ node = flow.getChildAt(2);
+ assertTrue(node instanceof Block);
+ block = (Block) node;
+ fontFamilies = block.traitFontFamily(null);
+ assertEquals(1, fontFamilies.length);
+ assertEquals("serif", fontFamilies[0]);
+
+ node = flow.getChildAt(3);
+ assertTrue(node instanceof Block);
+ block = (Block) node;
+ fontFamilies = block.traitFontFamily(null);
+ assertEquals(1, fontFamilies.length);
+ assertEquals("monospace", fontFamilies[0]);
+
+ node = flow.getChildAt(4);
+ assertTrue(node instanceof Block);
+ block = (Block) node;
+ fontFamilies = block.traitFontFamily(null);
+ assertEquals(1, fontFamilies.length);
+ assertEquals("Courier", fontFamilies[0]);
+ }
+
+ /**
* Test of fo/font-size-001.fo.
* @throws FOrayException For errors creating the FO Tree.
*/
Copied: trunk/foray/resource/test/fo/font-family-001.fo (from rev 9215, trunk/foray/resource/test/xml/bugtests/font-family.fo)
===================================================================
--- trunk/foray/resource/test/fo/font-family-001.fo (rev 0)
+++ trunk/foray/resource/test/fo/font-family-001.fo 2007-04-18 22:33:36 UTC (rev 9217)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:layout-master-set>
+ <fo:simple-page-master
+ master-name="simplePM"
+ page-height="25cm"
+ page-width="20cm"
+ margin-top="1cm"
+ margin-bottom="1cm"
+ margin-left="1.5cm"
+ margin-right="1.5cm">
+ <fo:region-before extent="2.5cm"/>
+ <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
+ <fo:region-after extent="2.5cm"/>
+ </fo:simple-page-master>
+</fo:layout-master-set>
+
+<fo:page-sequence master-reference="simplePM">
+<fo:flow flow-name="xsl-region-body">
+
+<fo:block>The default font.</fo:block>
+<fo:block
+ font-family="sans-serif">font-family: sans-serif font.</fo:block>
+<fo:block
+ font-family="serif">font-family: sans-serif font.</fo:block>
+<fo:block
+ font-family="monospace">font-family: monospace.</fo:block>
+<fo:block
+ font-family="Courier">font-family: Courier.</fo:block>
+<fo:block
+ font-family="Helvetica">font-family: Helvetica.</fo:block>
+<fo:block
+ font-family="Times Roman">font-family: Times Roman.</fo:block>
+<fo:block
+ font-family="Symbol">font-family: Symbol.</fo:block>
+<fo:block
+ font-family="ZapfDingbats">font-family: ZapfDingBats.</fo:block>
+
+
+</fo:flow>
+</fo:page-sequence>
+</fo:root>
Deleted: trunk/foray/resource/test/xml/bugtests/font-family.fo
===================================================================
--- trunk/foray/resource/test/xml/bugtests/font-family.fo 2007-04-18 22:26:17 UTC (rev 9216)
+++ trunk/foray/resource/test/xml/bugtests/font-family.fo 2007-04-18 22:33:36 UTC (rev 9217)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
-<fo:layout-master-set>
- <fo:simple-page-master
- master-name="simplePM"
- page-height="25cm"
- page-width="20cm"
- margin-top="1cm"
- margin-bottom="1cm"
- margin-left="1.5cm"
- margin-right="1.5cm">
- <fo:region-before extent="2.5cm"/>
- <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
- <fo:region-after extent="2.5cm"/>
- </fo:simple-page-master>
-</fo:layout-master-set>
-
-<fo:page-sequence master-reference="simplePM">
-<fo:flow flow-name="xsl-region-body">
-
-<fo:block>The default font.</fo:block>
-<fo:block
- font-family="sans-serif">font-family: sans-serif font.</fo:block>
-<fo:block
- font-family="serif">font-family: sans-serif font.</fo:block>
-<fo:block
- font-family="monospace">font-family: monospace.</fo:block>
-<fo:block
- font-family="Courier">font-family: Courier.</fo:block>
-<fo:block
- font-family="Helvetica">font-family: Helvetica.</fo:block>
-<fo:block
- font-family="Times Roman">font-family: Times Roman.</fo:block>
-<fo:block
- font-family="Symbol">font-family: Symbol.</fo:block>
-<fo:block
- font-family="ZapfDingbats">font-family: ZapfDingBats.</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-04-18 22:35:48
|
Revision: 9218
http://svn.sourceforge.net/foray/?rev=9218&view=rev
Author: victormote
Date: 2007-04-18 15:35:49 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Simplify test.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
trunk/foray/resource/test/fo/font-family-001.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java 2007-04-18 22:33:36 UTC (rev 9217)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java 2007-04-18 22:35:49 UTC (rev 9218)
@@ -63,27 +63,6 @@
block = (Block) node;
fontFamilies = block.traitFontFamily(null);
assertEquals(1, fontFamilies.length);
- assertEquals("sans-serif", fontFamilies[0]);
-
- node = flow.getChildAt(2);
- assertTrue(node instanceof Block);
- block = (Block) node;
- fontFamilies = block.traitFontFamily(null);
- assertEquals(1, fontFamilies.length);
- assertEquals("serif", fontFamilies[0]);
-
- node = flow.getChildAt(3);
- assertTrue(node instanceof Block);
- block = (Block) node;
- fontFamilies = block.traitFontFamily(null);
- assertEquals(1, fontFamilies.length);
- assertEquals("monospace", fontFamilies[0]);
-
- node = flow.getChildAt(4);
- assertTrue(node instanceof Block);
- block = (Block) node;
- fontFamilies = block.traitFontFamily(null);
- assertEquals(1, fontFamilies.length);
assertEquals("Courier", fontFamilies[0]);
}
Modified: trunk/foray/resource/test/fo/font-family-001.fo
===================================================================
--- trunk/foray/resource/test/fo/font-family-001.fo 2007-04-18 22:33:36 UTC (rev 9217)
+++ trunk/foray/resource/test/fo/font-family-001.fo 2007-04-18 22:35:49 UTC (rev 9218)
@@ -20,21 +20,7 @@
<fo:block>The default font.</fo:block>
<fo:block
- font-family="sans-serif">font-family: sans-serif font.</fo:block>
-<fo:block
- font-family="serif">font-family: sans-serif font.</fo:block>
-<fo:block
- font-family="monospace">font-family: monospace.</fo:block>
-<fo:block
font-family="Courier">font-family: Courier.</fo:block>
-<fo:block
- font-family="Helvetica">font-family: Helvetica.</fo:block>
-<fo:block
- font-family="Times Roman">font-family: Times Roman.</fo:block>
-<fo:block
- font-family="Symbol">font-family: Symbol.</fo:block>
-<fo:block
- font-family="ZapfDingbats">font-family: ZapfDingBats.</fo:block>
</fo:flow>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-18 23:57:55
|
Revision: 9220
http://svn.sourceforge.net/foray/?rev=9220&view=rev
Author: victormote
Date: 2007-04-18 16:57:55 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Add some infrastructure for getting a completed AreaTree instance for testing.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java
trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java
Added Paths:
-----------
trunk/foray/foray-app/src/javatest/org/foray/app/area/
trunk/foray/foray-app/src/javatest/org/foray/app/area/AreaTreeCreator.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2007-04-18 22:49:48 UTC (rev 9219)
+++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2007-04-18 23:57:55 UTC (rev 9220)
@@ -226,7 +226,7 @@
* @return The newly-created AreaTreeFactory instance.
* @throws FOrayException For errors creating the server.
*/
- public static AreaTreeFactory makeAreaTreeFactory(final Log logger,
+ public static FOrayAreaTreeFactory makeAreaTreeFactory(final Log logger,
final TextServer textServer) throws FOrayException {
return new FOrayAreaTreeFactory(logger, textServer);
}
@@ -237,7 +237,7 @@
* @return The newly-created LayoutFactory instance.
* @throws FOrayException For errors creating the server.
*/
- public static LayoutFactory makeLayoutFactory(final Log logger)
+ public static PioneerFactory makeLayoutFactory(final Log logger)
throws FOrayException {
return new PioneerFactory(logger);
}
Added: trunk/foray/foray-app/src/javatest/org/foray/app/area/AreaTreeCreator.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/AreaTreeCreator.java (rev 0)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/AreaTreeCreator.java 2007-04-18 23:57:55 UTC (rev 9220)
@@ -0,0 +1,170 @@
+/*
+ * 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.app.area;
+
+import org.foray.app.FOraySpecific;
+import org.foray.app.fo.FoDocumentReader;
+import org.foray.area.AreaTree;
+import org.foray.area.FOrayAreaTreeFactory;
+import org.foray.area.PageCollection;
+import org.foray.common.Environment;
+import org.foray.common.sax.SaxParser;
+import org.foray.core.FOrayException;
+import org.foray.fotree.FOTreeBuilder;
+import org.foray.fotree.FOrayFOTreeServer;
+import org.foray.fotree.fo.obj.PageSequence;
+import org.foray.fotree.fo.obj.Root;
+import org.foray.pioneer.PioneerFactory;
+import org.foray.pioneer.PioneerLS;
+
+import org.axsl.areaW.AreaWException;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+/**
+ * Singleton Helper class for tests that parses an input file and returns an
+ * AreaTree instance for testing.
+ */
+public final class AreaTreeCreator {
+
+ /** The singleton instance. */
+ private static AreaTreeCreator theInstance;
+
+ /** The directory containing the testing files. */
+ private File testDirectory;
+
+ /** The fo tree server. */
+ private FOrayFOTreeServer treeServer;
+
+ /** The area tree factory. */
+ private FOrayAreaTreeFactory areaTreeFactory;
+
+ /** The layout factory. */
+ private PioneerFactory layoutFactory;
+
+ /**
+ * Constructor.
+ * @throws IOException For errors obtaining the build properties.
+ * @throws FOrayException For errors initializing the FOray-specific
+ * objects.
+ */
+ private AreaTreeCreator() throws IOException, FOrayException {
+ final Properties buildProperties = Environment.getBuildProperties();
+ final String foraySandbox = buildProperties.getProperty(
+ "foray.sandbox");
+ final String testDir = foraySandbox + "/resource/test/";
+ this.testDirectory = new File(testDir);
+
+ final FOrayFOTreeServer treeServer = FoDocumentReader.getInstance()
+ .getTreeServer();
+ this.treeServer = treeServer;
+ final FOrayAreaTreeFactory areaTreeFactory =
+ FOraySpecific.makeAreaTreeFactory(treeServer.getLogger(),
+ treeServer.getTextServer());
+ this.areaTreeFactory = areaTreeFactory;
+ final PioneerFactory layoutFactory = FOraySpecific.makeLayoutFactory(
+ treeServer.getLogger());
+ this.layoutFactory = layoutFactory;
+ }
+
+ /**
+ * Returns the singleton instance.
+ * @return The singleton instance.
+ * @throws FOrayException For errors creating the singleton instance.
+ */
+ public static AreaTreeCreator getInstance() throws FOrayException {
+ if (AreaTreeCreator.theInstance == null) {
+ try {
+ AreaTreeCreator.theInstance = new AreaTreeCreator();
+ } catch (final IOException e) {
+ throw new FOrayException(e);
+ }
+ }
+ return AreaTreeCreator.theInstance;
+ }
+
+ /**
+ * Converts a file in the test directory to an Fo Tree.
+ * @param file The file to be converted.
+ * @return The parsed FO Tree instance.
+ * @throws FOrayException For errors building the FO Tree.
+ */
+ public AreaTree buildAreaTree(final String file) throws FOrayException {
+ final File foFile = new File(this.testDirectory, file);
+ InputStream foInputStream;
+ try {
+ foInputStream = new FileInputStream(foFile);
+ } catch (final FileNotFoundException e) {
+ throw new FOrayException(e);
+ }
+ final InputSource foInputSource = new InputSource(foInputStream);
+ XMLReader xmlReader;
+ try {
+ xmlReader = SaxParser.createSax2Parser();
+ } catch (final SAXException e) {
+ throw new FOrayException(e);
+ } catch (final ParserConfigurationException e) {
+ throw new FOrayException(e);
+ }
+ final FOTreeBuilder foTree = this.treeServer.makeFOTree();
+ xmlReader.setContentHandler(foTree);
+ try {
+ xmlReader.parse(foInputSource);
+ } catch (final IOException e) {
+ throw new FOrayException(e);
+ } catch (final SAXException e) {
+ throw new FOrayException(e);
+ }
+ final Root root = foTree.getRootFObj();
+ final AreaTree areaTree = this.areaTreeFactory.makeAreaTree(root);
+ final PioneerLS layout = this.layoutFactory.makeLayout();
+ for (PageSequence pageSequence : root.getPageSequences()) {
+ try {
+ final PageCollection collection = areaTree.makePageCollection(
+ pageSequence);
+ layout.formatPageSequence(collection);
+ } catch (final AreaWException e) {
+ throw new FOrayException(e);
+ }
+ }
+ return areaTree;
+ }
+
+}
Property changes on: trunk/foray/foray-app/src/javatest/org/foray/app/area/AreaTreeCreator.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java 2007-04-18 22:49:48 UTC (rev 9219)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/fo/FoDocumentReader.java 2007-04-18 23:57:55 UTC (rev 9220)
@@ -151,4 +151,12 @@
return foTree;
}
+ /**
+ * Returns the tree server.
+ * @return The tree server.
+ */
+ public FOrayFOTreeServer getTreeServer() {
+ return this.treeServer;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2007-04-18 22:49:48 UTC (rev 9219)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOrayFOTreeServer.java 2007-04-18 23:57:55 UTC (rev 9220)
@@ -287,4 +287,12 @@
return this.logger;
}
+ /**
+ * Returns the text server.
+ * @return The text server.
+ */
+ public TextServer getTextServer() {
+ return this.textServer;
+ }
+
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java 2007-04-18 22:49:48 UTC (rev 9219)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/obj/Root.java 2007-04-18 23:57:55 UTC (rev 9220)
@@ -28,6 +28,7 @@
package org.foray.fotree.fo.obj;
+import org.foray.fotree.FONode;
import org.foray.fotree.FOTreeBuilder;
import org.foray.fotree.FObj;
import org.foray.fotree.Namespace;
@@ -39,7 +40,9 @@
import org.apache.commons.logging.Log;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -327,4 +330,25 @@
return null;
}
+ /**
+ * Returns the descendant page-sequence objects as a list. Note that this
+ * list is not necessarily complete until the entire document has been
+ * parsed.
+ * @return A list of descendant page-sequence objects.
+ */
+ public List<PageSequence> getPageSequences() {
+ final ArrayList<PageSequence> psList = new ArrayList<PageSequence>();
+ for (int i = 0; i < this.getChildCount(); i++) {
+ final FONode child = this.getChildAt(i);
+ if (child instanceof PageSequence) {
+ final PageSequence ps = (PageSequence) child;
+ psList.add(ps);
+ }
+ /* TODO: After we add a class for the page-sequence-wrapper
+ * object, we need to add logic here to include its children as
+ * well. */
+ }
+ return psList;
+ }
+
}
Modified: trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java
===================================================================
--- trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java 2007-04-18 22:49:48 UTC (rev 9219)
+++ trunk/foray/foray-pioneer/src/java/org/foray/pioneer/PioneerFactory.java 2007-04-18 23:57:55 UTC (rev 9220)
@@ -28,7 +28,6 @@
package org.foray.pioneer;
-import org.axsl.layout.Layout;
import org.axsl.layout.LayoutFactory;
import org.apache.commons.logging.Log;
@@ -52,7 +51,7 @@
/**
* {@inheritDoc}
*/
- public Layout makeLayout() {
+ public PioneerLS makeLayout() {
return new PioneerLS(this.logger);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-19 17:05:20
|
Revision: 9229
http://svn.sourceforge.net/foray/?rev=9229&view=rev
Author: victormote
Date: 2007-04-19 10:05:21 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Conform to axsl changes simplifying API for drawing rectangles.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBorder.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
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-04-19 17:02:51 UTC (rev 9228)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBorder.java 2007-04-19 17:05:21 UTC (rev 9229)
@@ -36,7 +36,7 @@
import org.axsl.common.OrderedTreeNode;
/**
- * Tests of various font properties at the FO Tree level.
+ * Tests of various border-related concepts at the Area Tree level.
*/
public class TestBorder extends AbstractAreaTreeTest {
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-04-19 17:02:51 UTC (rev 9228)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2007-04-19 17:05:21 UTC (rev 9229)
@@ -244,10 +244,10 @@
* {@inheritDoc}
*/
public void drawRectangle(final Rectangle2D.Float rectangle,
- final boolean stroke, final PDFPathPaint strokePaint,
- final boolean fill, final PDFPathPaint fillPaint) {
+ final PDFPathPaint strokePaint, final PDFPathPaint fillPaint) {
// Bail out if stroke and fill are both missing.
- if (stroke == false && fill == false) {
+ if (strokePaint == null
+ && fillPaint == null) {
return;
}
closeTextObject();
@@ -263,10 +263,11 @@
// Draw the rectangle.
add(rectangle.x + " " + rectangle.y + " " + rectangle.width + " "
+ rectangle.height + " re ");
- if (stroke && fill) {
+ if (strokePaint != null
+ && fillPaint != null) {
// Close, fill, and stroke the rectangle.
add("b");
- } else if (stroke) {
+ } else if (strokePaint != null) {
// Close and stroke the rectangle.
add("s");
} else {
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-04-19 17:02:51 UTC (rev 9228)
+++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-04-19 17:05:21 UTC (rev 9229)
@@ -230,8 +230,7 @@
}
final Rectangle2D.Float rectangle = new Rectangle2D.Float(toPoints(x),
toPoints(y), toPoints(w), toPoints(h));
- getContentStream().drawRectangle(rectangle, strokePaint != null,
- strokePaint, fillPaint != null, fillPaint);
+ getContentStream().drawRectangle(rectangle, strokePaint, fillPaint);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-19 20:32:37
|
Revision: 9235
http://svn.sourceforge.net/foray/?rev=9235&view=rev
Author: victormote
Date: 2007-04-19 13:32:31 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Add test document and test for nested blocks.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java
Added Paths:
-----------
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
trunk/foray/resource/test/fo/block-001.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java 2007-04-19 20:24:25 UTC (rev 9234)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java 2007-04-19 20:32:31 UTC (rev 9235)
@@ -28,6 +28,7 @@
package org.foray.app;
+import org.foray.app.area.TestBlock;
import org.foray.app.area.TestBorder;
import org.foray.app.fo.TestFont;
import org.foray.app.fo.TestInvalidXml;
@@ -54,6 +55,7 @@
/* Now the Area Tree tests. */
testSuite.addTestSuite(TestBorder.class);
+ testSuite.addTestSuite(TestBlock.class);
return testSuite;
}
Added: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java (rev 0)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java 2007-04-19 20:32:31 UTC (rev 9235)
@@ -0,0 +1,74 @@
+/*
+ * 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.app.area;
+
+import org.foray.area.AreaTree;
+import org.foray.area.LineArea;
+import org.foray.area.NormalBlockArea;
+import org.foray.area.NormalFlowRA;
+import org.foray.core.FOrayException;
+
+import org.axsl.common.OrderedTreeNode;
+
+/**
+ * Tests of various block-related concepts at the Area Tree level.
+ */
+public class TestBlock extends AbstractAreaTreeTest {
+
+ /**
+ * Test of fo/block-001.fo.
+ * @throws FOrayException For errors creating the FO Tree or Area Tree.
+ */
+ public void testBlock001() throws FOrayException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree areaTree = creator.buildAreaTree(
+ "fo/block-001.fo");
+ final NormalFlowRA firstNormalFlowArea = this.getFirstNormalFlowArea(
+ areaTree);
+
+ /* The outer block area. */
+ OrderedTreeNode node = firstNormalFlowArea.getChildAt(0);
+ assertTrue(node instanceof NormalBlockArea);
+ final NormalBlockArea outerBlockArea = (NormalBlockArea) node;
+ assertEquals(72000, outerBlockArea.crOriginX());
+ assertEquals(720000, outerBlockArea.crOriginY());
+ assertEquals(432000, outerBlockArea.crIPD());
+
+ /* The first child of the outer block area is a line. */
+ node = outerBlockArea.getChildAt(0);
+ assertTrue(node instanceof LineArea);
+ final LineArea lineArea = (LineArea) node;
+ assertEquals(72000, lineArea.crOriginX());
+ assertEquals(720000, lineArea.crOriginY());
+ assertEquals(432000, lineArea.crIPD());
+ assertEquals(12000, lineArea.crBPD());
+
+ }
+
+}
Property changes on: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/resource/test/fo/block-001.fo
===================================================================
--- trunk/foray/resource/test/fo/block-001.fo (rev 0)
+++ trunk/foray/resource/test/fo/block-001.fo 2007-04-19 20:32:31 UTC (rev 9235)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+This fo file contains one empty block nested inside another block and tests that
+the three resulting block areas exist and are positioned correctly.
+-->
+
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+
+<fo:layout-master-set>
+ <!-- layout for the first page -->
+ <fo:simple-page-master master-name="simple"
+ 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 block contains an empty block after this colon:<fo:block/>This content is
+part of the same block but should appear in a separate block-area, that is, it
+should look like there is a line-break above it.</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-04-20 20:18:29
|
Revision: 9244
http://svn.sourceforge.net/foray/?rev=9244&view=rev
Author: victormote
Date: 2007-04-20 13:18:19 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
1. Add a (failing) test for the nested block document.
2. Improvements to line-height and positioning.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java
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-04-20 16:46:00 UTC (rev 9243)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestBlock.java 2007-04-20 20:18:19 UTC (rev 9244)
@@ -56,19 +56,58 @@
OrderedTreeNode node = firstNormalFlowArea.getChildAt(0);
assertTrue(node instanceof NormalBlockArea);
final NormalBlockArea outerBlockArea = (NormalBlockArea) node;
+ /* 1 inch left margin. */
assertEquals(72000, outerBlockArea.crOriginX());
+ /* 10 inches from bottom (11 inches high, 1 inch top margin). */
assertEquals(720000, outerBlockArea.crOriginY());
+ /* Page is 8 inches wide, with 2 inches total margin.
+ * 6 * 72,000 = 432,000. */
assertEquals(432000, outerBlockArea.crIPD());
- /* The first child of the outer block area is a line. */
+ /* The first child of the outer block area is a line-area. */
node = outerBlockArea.getChildAt(0);
assertTrue(node instanceof LineArea);
- final LineArea lineArea = (LineArea) node;
+ LineArea lineArea = (LineArea) node;
+ /* Same as parent. */
assertEquals(72000, lineArea.crOriginX());
- assertEquals(720000, lineArea.crOriginY());
+ /* Same as parent, but adjusted for a half-leading space-before.
+ * Default leading is 20% of the font-size, which is 12 points.
+ * 50% * 20% * 12,000 = 1,200.
+ * 720,000 - 1,200 = 718,800. */
+ assertEquals(718800, lineArea.crOriginY());
+ /* Same as parent. */
assertEquals(432000, lineArea.crIPD());
+ /* Default font-size is 12 points. */
assertEquals(12000, lineArea.crBPD());
+ /* The second child of the outer block area is a block-area. */
+ node = outerBlockArea.getChildAt(1);
+ assertTrue(node instanceof NormalBlockArea);
+ final NormalBlockArea insideBlockArea = (NormalBlockArea) node;
+ /* Same as parent. */
+ assertEquals(72000, insideBlockArea.crOriginX());
+ /* Computed as that for the previous line, adjusted for one line,
+ * including another half-leading, the space-after for that line.
+ * 718,800 - 12,000 - 1,200 = 705,600. */
+ assertEquals(705600, insideBlockArea.crOriginY());
+ /* Same as parent. */
+ assertEquals(432000, insideBlockArea.crIPD());
+ /* Height of 0, as it has no content. */
+ assertEquals(0, insideBlockArea.crBPD());
+
+ /* The third child of the outer block area is another line-area. */
+ node = outerBlockArea.getChildAt(2);
+ assertTrue(node instanceof LineArea);
+ lineArea = (LineArea) node;
+ /* Same as parent. */
+ assertEquals(72000, insideBlockArea.crOriginX());
+ /* Same as the previous block, adjusted for an additional half-leading.
+ * 705,600 - 1,200 = 704,400. */
+ assertEquals(704400, insideBlockArea.crOriginY());
+ /* Same as parent. */
+ assertEquals(432000, insideBlockArea.crIPD());
+ /* Same as the first line. */
+ assertEquals(12000, insideBlockArea.crBPD());
}
}
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-20 16:46:00 UTC (rev 9243)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-20 20:18:19 UTC (rev 9244)
@@ -41,6 +41,7 @@
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderStyle;
import org.axsl.common.value.DisplayAlign;
+import org.axsl.common.value.LineStackingStrategy;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.Overflow;
import org.axsl.common.value.ReferenceOrientation;
@@ -1726,4 +1727,28 @@
return AreaClass.XSL_NORMAL;
}
+ /**
+ * Returns the line-stacking-strategy trait for this Area.
+ * @return The line-stacking-strategy trait.
+ */
+ public LineStackingStrategy traitLineStackingStrategy() {
+ return this.traitGeneratedBy().traitLineStackingStrategy(this);
+ }
+
+ /**
+ * Returns the text-altitude trait for this Area.
+ * @return The text-altitude trait.
+ */
+ public int traitTextAltitude() {
+ return this.traitGeneratedBy().traitTextAltitude(this);
+ }
+
+ /**
+ * Returns the text-depth trait for this Area.
+ * @return The text-depth trait.
+ */
+ public int traitTextDepth() {
+ return this.traitGeneratedBy().traitTextDepth(this);
+ }
+
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-04-20 16:46:00 UTC (rev 9243)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2007-04-20 20:18:19 UTC (rev 9244)
@@ -32,6 +32,7 @@
import org.axsl.areaW.AreaWException;
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.Baseline;
+import org.axsl.common.value.LineStackingStrategy;
import org.axsl.common.value.RelativeAxis;
import org.axsl.common.value.RelativeCompass;
import org.axsl.common.value.TextAlign;
@@ -1191,9 +1192,33 @@
*/
@Override
public void initializeProgressionDimension() {
+ /* See XSL-FO 1.1, Section 4.5 where the "height" of the allocation
+ * rectangle is defined in terms of the line-stacking-strategy.
+ * However, when the line is first created, it doesn't know what content
+ * it will have, so we set it here to its minimum size. */
+ int pd = this.nominalRequestedLrPd();
+ final LineStackingStrategy lineStackingStrategy
+ = traitLineStackingStrategy();
+ switch(lineStackingStrategy) {
+ case LINE_HEIGHT: {
+ /* The allocation-rectangle must be at least big enough to enclose
+ * the expanded-nominal-requested-line-rectangle, which is the
+ * nominal-requested-line-rectangle plus a half-leading at the
+ * before-edge, and a half-leading at the after-edge. */
+ pd += this.traitHalfLeadingOpt() * 2;
+ break;
+ }
+ case FONT_HEIGHT:
+ case MAX_HEIGHT:
+ default: {
+ /* The nominal-requested-line-rectangle is the starting value for
+ * all of these. */
+ break;
+ }
+ }
/* The progression dimension used by a line-area is exactly equal to the
* size of the em-box, i.e. exactly equal to the font-size. */
- this.setProgressionDimension(this.traitFontSize());
+ this.setProgressionDimension(pd);
}
/**
@@ -1209,4 +1234,23 @@
this.setAnteriorSpace(anteriorSpace);
}
+ /**
+ * Computes the progression-dimension of the
+ * nominal-requested-line-rectangle, as defined in XSL-FO 1.1, Section 4.5.
+ * @return The progression-dimension (height) of the
+ * nominal-requested-line-rectangle.
+ */
+ private int nominalRequestedLrPd() {
+ /* According to XSL-FO 1.1, Section 4.5, the "height" of the
+ * nominal-requested-line-rectangle should be the sum of the
+ * text-altitude and text-depth of the parent block-area.
+ * We think that this is essentially the em-square of the font,
+ * which is the same value as the size of the font.
+ * Also, the line-height is supposed to be the size of the em-square
+ * plus the leading, which agrees with this assumption.
+ * Therefore, we return the font-size value here.
+ * TODO: This issue needs to be revisited. */
+ return this.traitFontSize();
+ }
+
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java 2007-04-20 16:46:00 UTC (rev 9243)
+++ trunk/foray/foray-render/src/java/org/foray/render/xml/XMLRenderer.java 2007-04-20 20:18:19 UTC (rev 9244)
@@ -395,7 +395,8 @@
outputFontTraits(area, buffer);
writeStartTag(area, buffer);
/* Line areas have no border or padding, so write only the content
- * rectangle. */
+ * rectangle.
+ * See XSL-FO 1.1, Section 4.5. */
outputContentRectangle(area);
renderChildren(area);
writeEndTag(area);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-23 19:02:51
|
Revision: 9258
http://svn.sourceforge.net/foray/?rev=9258&view=rev
Author: victormote
Date: 2007-04-23 12:01:57 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
Javadoc improvements.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java
trunk/foray/scripts/checkstyle-suppressions.xml
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -58,13 +58,6 @@
}
/**
- * Set the value.
- */
- public void setValue(final String value) {
- this.value = value;
- }
-
- /**
* Determines whether a given country code is found in validCountries.
* @param countryCode A 2-letter or 3-letter ISO 3166 code.
* @return True if countryCode is found in validCountries, false otherwise.
@@ -73,6 +66,11 @@
return ISO3166.validCountry(countryCode);
}
+ /**
+ * Convert a String country descriptor to its DtCountry equivalent.
+ * @param countryCode The String country descriptor to be converted.
+ * @return The DtCountry instance for <code>countryCode</code>.
+ */
public static DtCountry makeCountryDT(final String countryCode) {
if (! validCountry(countryCode)) {
return null;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtInteger.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -54,26 +54,26 @@
}
/**
- * Set the value.
+ * {@inheritDoc}
*/
- public void setValue(final int value) {
- this.value = value;
- }
-
public double getNumericValue() {
return value;
}
- public DtInteger round() {
- return this;
- }
-
+ /**
+ * Ensures that the internal value is no less than a certain threshold.
+ * @param num The minimum value that the internal value is allowed to be.
+ */
public void setMinimumValue(final int num) {
if (num > this.value) {
this.value = num;
}
}
+ /**
+ * Ensures that the internal value is no greater than a certain threshold.
+ * @param num The maximum value that the internal value is allowed to be.
+ */
public void setMaximumValue(final int num) {
if (num < this.value) {
this.value = num;
@@ -106,14 +106,6 @@
return new DtInteger(value);
}
- public byte unitPower() {
- return 0;
- }
-
- public double evalNumeric() {
- return this.value;
- }
-
/**
* {@inheritDoc}
*/
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtKeep.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -35,12 +35,20 @@
*/
public class DtKeep extends Datatype {
+ /** The "within-line" component. */
private int withinLine;
+
+ /** The "within-column" component. */
private int withinColumn;
+
+ /** The "within-page" component. */
private int withinPage;
/**
* Constructor.
+ * @param withinLine The "within-line" component.
+ * @param withinColumn The "within-column" component.
+ * @param withinPage The "within-page" component.
*/
public DtKeep(final int withinLine, final int withinColumn,
final int withinPage) {
@@ -49,26 +57,50 @@
this.withinPage = withinPage;
}
+ /**
+ * Sets the "within-line" component.
+ * @param withinLine The new "within-line" value.
+ */
public void setWithinLine(final int withinLine) {
this.withinLine = withinLine;
}
+ /**
+ * Sets the "within-column" component.
+ * @param withinColumn The new "within-column" value.
+ */
public void setWithinColumn(final int withinColumn) {
this.withinColumn = withinColumn;
}
+ /**
+ * Sets the "within-page" component.
+ * @param withinPage The new "within-page" value.
+ */
public void setWithinPage(final int withinPage) {
this.withinPage = withinPage;
}
+ /**
+ * Returnw the "within-line" component.
+ * @return The "within-line" component.
+ */
public int getWithinLine() {
return this.withinLine;
}
+ /**
+ * Returnw the "within-column" component.
+ * @return The "within-column" component.
+ */
public int getWithinColumn() {
return this.withinColumn;
}
+ /**
+ * Returnw the "within-page" component.
+ * @return The "within-page" component.
+ */
public int getWithinPage() {
return this.withinPage;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -57,12 +57,10 @@
}
/**
- * Set the value.
+ * Convert a String language descriptor to its DtLanguage equivalent.
+ * @param languageCode The String language descriptor to be converted.
+ * @return The DtLanguage instance for <code>languageCode</code>.
*/
- public void setValue(final String value) {
- this.value = value;
- }
-
public static DtLanguage makeLanguageDT(final String languageCode) {
if (! ISO639.validLanguage(languageCode)) {
return null;
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLength.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -37,6 +37,7 @@
*/
public class DtLength extends Datatype implements ExprNumeric {
+ /** Array of valid string descriptions for length units. */
public static final String[] UNIT_ARRAY = {
"", //Leave the first item blank
"in",
@@ -55,13 +56,28 @@
"%",
};
+ /** Constant indicating units of "inches". */
public static final byte UNIT_INCHES = 1;
+
+ /** Constant indicating units of "centimeters". */
public static final byte UNIT_CENTIMETERS = 2;
+
+ /** Constant indicating units of "millimeters". */
public static final byte UNIT_MILLIMETERS = 3;
+
+ /** Constant indicating units of "points". */
public static final byte UNIT_POINTS = 4;
+
+ /** Constant indicating units of "picas". */
public static final byte UNIT_PICAS = 5;
+
+ /** Constant indicating units of "pixels". */
public static final byte UNIT_PIXELS = 6;
+
+ /** Constant indicating units of "ems". */
public static final byte UNIT_EMS = 7;
+
+ /** Constant indicating units of "percent". */
public static final byte UNIT_PERCENT = 8;
/** The signed length value. */
@@ -77,6 +93,7 @@
* @param value The signed length value.
* @param units A byte representation of the unit of measure (points,
* inches, etc.)
+ * @throws PropertyException For an invalid <code>units</code> descriptor.
*/
public DtLength(final float value, final String units)
throws PropertyException {
@@ -135,6 +152,11 @@
}
}
+ /**
+ * Converts a String unit descriptor to its internal byte equivalent.
+ * @param units The String descriptor of the units.
+ * @return The byte equivalent.
+ */
public static byte convertUnits(final String units) {
// Start at 1, not 0, as 0 is not a valid value.
for (byte i = 1; i < UNIT_ARRAY.length; i++) {
@@ -195,10 +217,6 @@
}
}
- public byte unitPower() {
- return 1;
- }
-
/**
* {@inheritDoc}
*/
@@ -206,6 +224,9 @@
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public int getLength(final int pointSize, final int percentBase) {
return getValue(pointSize, percentBase);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLengthBPIPDirection.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -36,11 +36,17 @@
*/
public class DtLengthBPIPDirection extends Datatype {
+ /** The BPD length component. */
private ExprNumeric bpdLength;
+
+ /** The IPD length component. */
private ExprNumeric ipdLength;
/**
* Constructor.
+ * @param bpdLength The BPD length component.
+ * @param ipdLength The IPD length component.
+ * @throws PropertyException For invalid parameters.
*/
public DtLengthBPIPDirection(final ExprNumeric bpdLength,
final ExprNumeric ipdLength) throws PropertyException {
@@ -54,6 +60,12 @@
this.ipdLength = ipdLength;
}
+ /**
+ * Sets the BPD length component.
+ * @param length The new BPD length.
+ * @throws PropertyException If <code>length</code> cannot evaluate to a
+ * length.
+ */
public void setBPDLength(final ExprNumeric length)
throws PropertyException {
if (! bpdLength.canEvaluateLength()) {
@@ -62,10 +74,20 @@
this.bpdLength = length;
}
+ /**
+ * Returns the BPD length component.
+ * @return The BPD length component.
+ */
public ExprNumeric getBPDLength() {
return this.bpdLength;
}
+ /**
+ * Sets the IPD length component.
+ * @param length The new IPD length.
+ * @throws PropertyException If <code>length</code> cannot evaluate to a
+ * length.
+ */
public void setIPDLength(final ExprNumeric length)
throws PropertyException {
if (! ipdLength.canEvaluateLength()) {
@@ -74,6 +96,10 @@
this.ipdLength = length;
}
+ /**
+ * Returns the IPD length component.
+ * @return The IPD length component.
+ */
public ExprNumeric getIPDLength() {
return this.ipdLength;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtNumber.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -45,10 +45,17 @@
this.value = value;
}
+ /**
+ * {@inheritDoc}
+ */
public double getNumericValue() {
return value;
}
+ /**
+ * Rounds this number.
+ * @return The rounded value of this number.
+ */
public DtInteger round() {
final int integer = (int) Math.round(this.value);
return new DtInteger(integer);
@@ -61,6 +68,11 @@
return 0;
}
+ /**
+ * Converts a string input into a DtNumber, if possible.
+ * @param input The String input describing the number.
+ * @return The DtNumber instance, or null if the input is not valid.
+ */
public static DtNumber makeNumberDT(final String input) {
double aNumber = 0;
try {
@@ -71,14 +83,6 @@
return new DtNumber(aNumber);
}
- public byte unitPower() {
- return 0;
- }
-
- public double evalNumeric() {
- return this.value;
- }
-
/**
* {@inheritDoc}
*/
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtPercentage.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -54,10 +54,16 @@
return value;
}
+ /**
+ * {@inheritDoc}
+ */
public double getNumericValue() {
return value;
}
+ /**
+ * {@inheritDoc}
+ */
public byte getUnitPower() {
return 0;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtRectangle.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -42,16 +42,31 @@
*/
public class DtRectangle extends DtShape {
+ /** The number of descriptor elements in a rectangle. */
private static final byte QTY_DESCRIPTOR_ELEMENTS = 4;
+ /** Constant indicating an invalid offset for the rectangle. */
private static final int INVALID_OFFSET = -2147483648;
+
+ /** The top offset component of the rectangle. */
private PropertyValue topOffset;
+
+ /** The right offset component of the rectangle. */
private PropertyValue rightOffset;
+
+ /** The bottom offset component of the rectangle. */
private PropertyValue bottomOffset;
+
+ /** The left offset component of the rectangle. */
private PropertyValue leftOffset;
/**
* Constructor.
+ * @param topOffset The top offset component of the rectangle.
+ * @param rightOffset The right offset component of the rectangle.
+ * @param bottomOffset The bottom offset component of the rectangle.
+ * @param leftOffset The left offset component of the rectangle.
+ * @throws PropertyException If any offset value is invalid.
*/
public DtRectangle(final PropertyValue topOffset,
final PropertyValue rightOffset,
@@ -67,6 +82,11 @@
this.leftOffset = leftOffset;
}
+ /**
+ * Tests the validity of a given offset.
+ * @param pv the offset to be tested.
+ * @return True iff the offset is valid.
+ */
private boolean validOffset(final PropertyValue pv) {
if (pv instanceof PropertyKeyword) {
final FoValue keyword = ((PropertyKeyword) pv).getValue();
@@ -81,22 +101,53 @@
return false;
}
+ /**
+ * Returns the top offset component of this rectangle.
+ * @param pointSize The font size.
+ * @param percentBase The percent base used for length calculations, if any.
+ * @return The top offset component of this rectangle.
+ */
public int getTopOffset(final int pointSize, final int percentBase) {
return getOffset(topOffset, pointSize, percentBase);
}
+ /**
+ * Returns the right offset component of this rectangle.
+ * @param pointSize The font size.
+ * @param percentBase The percent base used for length calculations, if any.
+ * @return The right offset component of this rectangle.
+ */
public int getRightOffset(final int pointSize, final int percentBase) {
return getOffset(rightOffset, pointSize, percentBase);
}
+ /**
+ * Returns the bottom offset component of this rectangle.
+ * @param pointSize The font size.
+ * @param percentBase The percent base used for length calculations, if any.
+ * @return The bottom offset component of this rectangle.
+ */
public int getBottomOffset(final int pointSize, final int percentBase) {
return getOffset(bottomOffset, pointSize, percentBase);
}
+ /**
+ * Returns the left offset component of this rectangle.
+ * @param pointSize The font size.
+ * @param percentBase The percent base used for length calculations, if any.
+ * @return The left offset component of this rectangle.
+ */
public int getLeftOffset(final int pointSize, final int percentBase) {
return getOffset(leftOffset, pointSize, percentBase);
}
+ /**
+ * Returns a given offset component of this rectangle.
+ * @param pv The offset component to be evaluated.
+ * @param pointSize The font size.
+ * @param percentBase The percent base used for length calculations, if any.
+ * @return The given offset component of this rectangle.
+ */
private int getOffset(final PropertyValue pv, final int pointSize,
final int percentBase) {
if (pv instanceof PropertyKeyword) {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtScript.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -169,13 +169,6 @@
}
/**
- * Set the String value of this script.
- */
- public void setValue(final String value) {
- this.value = value;
- }
-
- /**
* Determines whether a given script code is found in validScripts.
* @param scriptCode A 4-character ISO 15924 code.
* @return True if scriptCode is found in validScripts, false otherwise.
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtShadowEffect.java 2007-04-23 19:01:57 UTC (rev 9258)
@@ -76,6 +76,9 @@
this.color = color;
}
+ /**
+ * {@inheritDoc}
+ */
public int getHorizontalDistance(final int fontSize) {
if (this.horizontalDistance == null) {
return 0;
@@ -83,6 +86,9 @@
return horizontalDistance.getValue(fontSize, 0);
}
+ /**
+ * {@inheritDoc}
+ */
public int getVerticalDistance(final int fontSize) {
if (this.verticalDistance == null) {
return 0;
@@ -90,6 +96,9 @@
return verticalDistance.getValue(fontSize, 0);
}
+ /**
+ * {@inheritDoc}
+ */
public int getblurRadius(final int fontSize) {
if (this.blurRadius == null) {
return 0;
@@ -97,6 +106,9 @@
return blurRadius.getValue(fontSize, 0);
}
+ /**
+ * {@inheritDoc}
+ */
public Color getColor() {
if (this.color == null) {
return null;
Modified: trunk/foray/scripts/checkstyle-suppressions.xml
===================================================================
--- trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-23 17:37:03 UTC (rev 9257)
+++ trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-23 19:01:57 UTC (rev 9258)
@@ -11,8 +11,6 @@
<suppress checks="Javadoc[MV].*"
files="org.foray.fotree.fo.prop.*"/>
<suppress checks="Javadoc[MV].*"
- files="org.foray.fotree.value.*"/>
- <suppress checks="Javadoc[MV].*"
files="org.foray.render.awt.*"/>
<!-- Suppress Javadoc package documentation for test directories. -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-23 20:51:51
|
Revision: 9262
http://svn.sourceforge.net/foray/?rev=9262&view=rev
Author: victormote
Date: 2007-04-23 13:39:53 -0700 (Mon, 23 Apr 2007)
Log Message:
-----------
Javadoc improvements and removal of some unused methods.
Modified Paths:
--------------
trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java
trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java
trunk/foray/foray-render/.project
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java
trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Translator.java
Modified: trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2007-04-23 20:23:14 UTC (rev 9261)
+++ trunk/foray/foray-app/src/java/org/foray/app/AWTStarter.java 2007-04-23 20:39:53 UTC (rev 9262)
@@ -121,7 +121,6 @@
+ language);
userMessage.setTranslator(getResourceBundle(TRANSLATION_PATH
+ "messages." + language));
- resource.setMissingEmphasized(false);
final SessionConfig configuration = getOptions().getSessionConfig();
final FOraySession session = FOraySpecific.makeFOraySession(
Modified: trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java
===================================================================
--- trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2007-04-23 20:23:14 UTC (rev 9261)
+++ trunk/foray/foray-app/src/java/org/foray/demo/embed/DemoAWTViewer.java 2007-04-23 20:39:53 UTC (rev 9262)
@@ -133,7 +133,6 @@
final String language = System.getProperty("user.language");
final Translator translator = getResourceBundle(
TRANSLATION_PATH + "resources." + language);
- translator.setMissingEmphasized(false);
final UserMessage userMessage = new UserMessage(getLogger());
userMessage.setTranslator(getResourceBundle(
TRANSLATION_PATH + "messages." + language));
Modified: trunk/foray/foray-render/.project
===================================================================
--- trunk/foray/foray-render/.project 2007-04-23 20:23:14 UTC (rev 9261)
+++ trunk/foray/foray-render/.project 2007-04-23 20:39:53 UTC (rev 9262)
@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
</natures>
</projectDescription>
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2007-04-23 20:23:14 UTC (rev 9261)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/SecureResourceBundle.java 2007-04-23 20:39:53 UTC (rev 9262)
@@ -47,40 +47,29 @@
public class SecureResourceBundle extends ResourceBundle
implements Translator {
- // Fehlende keys mit einer Meldung zurückgeben.
- private boolean isMissingEmphasized = false;
-
- // private Properties lookup = new Properties();
private LoadableProperties lookup = new LoadableProperties(this);
- private boolean isSourceFound = true;
-
+ /** The logger. */
private Log logger;
/**
- * Kreiert ein ResourceBundle mit der Quelle in <strong>in</strong>.
+ * Constructor.
+ * @param in The input stream containing the unparsed resources.
+ * @param logger The logger.
*/
-
public SecureResourceBundle(final InputStream in, final Log logger) {
this.logger = logger;
try {
lookup.load(in);
} catch (final Exception ex) {
logger.info("Exception caught: " + ex.getMessage());
- isSourceFound = false;
}
}
- public void setMissingEmphasized(final boolean flag) {
- isMissingEmphasized = flag;
- }
-
public Enumeration<String> getKeys() {
return lookup.keys();
}
-
-
/**
* Händelt den abgefragten Key, liefert entweder den zugehörigen Wert oder
* eine Meldung.
@@ -106,29 +95,23 @@
if (obj != null) {
return obj;
}
- if (isMissingEmphasized) {
- this.logger.info(getClass().getName() + ": missing key: " + key);
- return getMissedRepresentation(key.toString());
- }
return key.toString();
}
/**
- * Stellt fest, ob es den Key gibt.
+ * {@inheritDoc}
*/
public boolean contains(final String key) {
- return (key == null || lookup.get(key) == null) ? false : true;
+ if (key == null) {
+ return false;
+ }
+ return lookup.get(key) != null;
}
-
- private String getMissedRepresentation(final String str) {
- return "<!" + str + "!>";
- }
-
- public boolean isSourceFound() {
- return isSourceFound;
- }
-
+ /**
+ * Returns the logger.
+ * @return The logger.
+ */
public Log getLogger() {
return logger;
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Translator.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Translator.java 2007-04-23 20:23:14 UTC (rev 9261)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/viewer/Translator.java 2007-04-23 20:39:53 UTC (rev 9262)
@@ -26,14 +26,15 @@
* $LastChangedBy$
*/
+/*
+ * Known contributors:
+ * Sta...@jC... (original author)
+ */
+
package org.foray.render.awt.viewer;
/**
* Definition für die Übersetzer-Klassen.
- *
- * @version 03.12.99
- * @author Sta...@jC...
- *
*/
public interface Translator {
@@ -43,17 +44,10 @@
String getString(String key);
/**
- * Ein Translator soll die fehlenden keys hervorheben können.
+ * Indicates whether a given key exists.
+ * @param key The key which is sought.
+ * @return True iff this key exists.
*/
- void setMissingEmphasized(boolean b);
-
- /**
- * Gibt an ob die Übersetzungsquelle gefunden ist.
- */
- boolean isSourceFound();
-
- /**
- * Gibt an ob ein Key in der Übersetzungsquelle vorhanden ist.
- */
boolean contains(String key);
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-24 16:08:23
|
Revision: 9267
http://svn.sourceforge.net/foray/?rev=9267&view=rev
Author: victormote
Date: 2007-04-24 09:03:50 -0700 (Tue, 24 Apr 2007)
Log Message:
-----------
Javadoc improvements.
Modified Paths:
--------------
trunk/foray/doc/web/app/using/release.html
trunk/foray/foray-render/.project
trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
trunk/foray/scripts/checkstyle-suppressions.xml
Modified: trunk/foray/doc/web/app/using/release.html
===================================================================
--- trunk/foray/doc/web/app/using/release.html 2007-04-23 22:23:42 UTC (rev 9266)
+++ trunk/foray/doc/web/app/using/release.html 2007-04-24 16:03:50 UTC (rev 9267)
@@ -53,9 +53,8 @@
methods.</li>
<li>Completion of javadoc API documentation for the FOrayGraphic,
FOrayHyphen-R, FOrayOutput, FOrayLayout, FOrayText, FOrayMIF, FOrayPDF,
- FOrayArea, FOrayRender (except the AWT Renderer), FOrayApp, and FOrayCore
- modules. Only the FOTree and AWT Renderer now lack comprehensive
- javadocs.</li>
+ FOrayArea, FOrayRender, FOrayApp, and FOrayCore modules.
+ Only the FOTree now lacks comprehensive javadocs.</li>
<li>The FOrayGraphicServer constructor no longer requires the name of the
parser class as a parameter.</li>
<li>JUnit tests have been introduced in most modules. Our testing is far
Modified: trunk/foray/foray-render/.project
===================================================================
--- trunk/foray/foray-render/.project 2007-04-23 22:23:42 UTC (rev 9266)
+++ trunk/foray/foray-render/.project 2007-04-24 16:03:50 UTC (rev 9267)
@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
</natures>
</projectDescription>
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2007-04-23 22:23:42 UTC (rev 9266)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2007-04-24 16:03:50 UTC (rev 9267)
@@ -67,7 +67,6 @@
import org.apache.batik.gvt.GraphicsNode;
import org.apache.commons.logging.Log;
-import org.w3c.dom.Document;
import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.svg.SVGSVGElement;
@@ -116,6 +115,9 @@
/** The list of pages processed. */
private Vector<PageArea> pageList = new Vector<PageArea>();
+ /** A color cached during processing. This could conceivably become a
+ * local variable, but is an instance variable in the hope of reducing
+ * unnecessary Color instance construction. */
private Color saveColor = null;
/** Image Object and Graphics Object. The Graphics Object is the Graphics
@@ -212,8 +214,8 @@
if (x1 == x2) {
/* vertical line */
height = y2 - y1;
- if (height > 0) // y coordinates are reversed between fo and AWT
- {
+ /* y coordinates are reversed between fo and AWT. */
+ if (height > 0) {
height = -height;
y = y2;
}
@@ -230,18 +232,13 @@
x = x2;
}
height = th;
- if (height > 0) // y coordinates are reversed between fo and AWT
- {
+ /* y coordinates are reversed between fo and AWT. */
+ if (height > 0) {
height = -height;
y -= height;
}
}
addRect(x, y, width, height, false);
-
- // // graphics.setColor(Color.red);
- // graphics.drawLine((int)(x1 / 1000f),
- // pageHeight - (int)(y1 / 1000f), (int)(x2 / 1000f),
- // pageHeight - (int)(y2 / 1000f));
}
/**
@@ -280,12 +277,9 @@
* @param g the green component
* @param b the blue component
*/
- // changed by aml/rlc to use helper function that
- // corrects for integer roundoff, and to remove 3D effect
protected void addRect(final int x, final int y, final int w, final int h,
final float r, final float g, final float b) {
graphics.setColor(new Color(r, g, b));
- // graphics.setColor(Color.green);
addRect(x, y, w, h, true);
}
@@ -302,9 +296,6 @@
* @param fg the green component of the fill
* @param fb the blue component of the fill
*/
-
- // changed by aml/rlc to use helper function that
- // corrects for integer roundoff
protected void addRect(final int x, final int y, final int w, final int h,
final float r, final float g, final float b, final float fr,
final float fg, final float fb) {
@@ -343,30 +334,24 @@
}
}
- protected void addFilledRect(final int x, final int y, final int w,
- final int h, final Color col) {
- final float r = colorToFloat(col.getRed());
- final float g = colorToFloat(col.getGreen());
- final float b = colorToFloat(col.getBlue());
- addRect(x, y, w, h, r, g, b, r, g, b);
- }
-
/**
- * To configure before print.
- *
- * Choose pages
- * Zoom factor
- * Page format / Landscape or Portrait
+ * Configures the zoom before display.
+ * @param zoomPercent The percentage zoom that should be applied to the
+ * page image.
+ * @param angle The angle at which the page should be rotated. Useful
+ * (eventually) for handling landscape/portrait issues.
*/
- public void transform(final Graphics2D g2d, final double zoomPercent,
- final double angle) {
- final AffineTransform at = g2d.getTransform();
+ private void transform(final double zoomPercent, final double angle) {
+ final AffineTransform at = this.graphics.getTransform();
at.rotate(angle);
at.scale(zoomPercent / WKConstants.PERCENT_CONVERSION,
zoomPercent / WKConstants.PERCENT_CONVERSION);
- g2d.setTransform(at);
+ this.graphics.setTransform(at);
}
+ /**
+ * Draws a frame around the page.
+ */
protected void drawFrame() {
final int width = pageWidth;
final int height = pageHeight;
@@ -442,7 +427,7 @@
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
- transform(graphics, scaleFactor, 0);
+ transform(scaleFactor, 0);
drawFrame();
renderPage(page);
@@ -500,14 +485,6 @@
/**
* {@inheritDoc}
*/
- protected void drawSVG(final GraphicArea area, final SVGGraphic graphic,
- final Rectangle contentRectangle, final Rectangle clipRectangle) {
- /* TODO: Implement this. */
- }
-
- /**
- * {@inheritDoc}
- */
public void render(final ExternalGraphicArea area) {
final int x = area.crOriginX();
final int y = area.crOriginY();
@@ -654,6 +631,19 @@
graphics.setColor(oldColor);
}
+ /**
+ * Renders text with its text decoration.
+ * @param x The x coordinate of the location at which rendering should
+ * occur, in millipoints.
+ * @param bl The y coordinate of the location at which rendering should
+ * occur, in millipoints.
+ * @param width The width of the text, in millipoints.
+ * @param font The font to be used to draw the text.
+ * @param text The text to be written.
+ * @param underline True if the text should be underlined.
+ * @param overline True if the text should be overlined.
+ * @param linethrough True if the text should have a line drawn through it.
+ */
protected void renderTextDecoration(final int x, final int bl,
final int width, final java.awt.Font font, final String text,
final boolean underline, final boolean overline,
@@ -730,16 +720,30 @@
* {@inheritDoc}
*/
public void render(final SVGArea area) {
- final Document doc = area.getSVGDocument();
+ final SVGDocument doc = area.getSVGDocument();
renderSVGDocument(area, doc);
}
- protected void renderSVGDocument(final Area area, final Document doc) {
+ /**
+ * {@inheritDoc}
+ */
+ protected void drawSVG(final GraphicArea area, final SVGGraphic graphic,
+ final Rectangle contentRectangle, final Rectangle clipRectangle) {
+ /* TODO: Implement this. This needs to be linked up with
+ * renderSVGDocument(Area, Document). */
+ }
+
+ /**
+ * Renders an SVG document.
+ * @param area The area containing the SVG document.
+ * @param doc The document to be rendered.
+ */
+ protected void renderSVGDocument(final Area area, final SVGDocument doc) {
final int x = area.crOriginX();
final int y = area.crOriginY();
final int w = area.crIPD();
final int h = area.crBPD();
- final GraphicsNode root = getGraphicsNode(area, doc);
+ final GraphicsNode root = getGraphicsNode(doc);
if (root == null) {
return;
}
@@ -747,7 +751,7 @@
graphics.translate(Math.round(toPoints(x)),
pageHeight - Math.round(toPoints(y)));
- final SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
+ final SVGSVGElement svg = doc.getRootElement();
final AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg,
toPoints(w), toPoints(h));
AffineTransform inverse = null;
@@ -773,8 +777,12 @@
}
- protected GraphicsNode getGraphicsNode(final Area area,
- final Document doc) {
+ /**
+ * Returns the Batik GraphicsNode to be used.
+ * @param doc The SVG document.
+ * @return The Batik GraphicsNode.
+ */
+ protected GraphicsNode getGraphicsNode(final SVGDocument doc) {
final BridgeContext ctx = makeBridgeContextAWT();
final GVTBuilder builder = new GVTBuilder();
try {
@@ -794,6 +802,9 @@
return;
}
+ /**
+ * {@inheritDoc}
+ */
public int print(final Graphics g, final PageFormat pageFormat,
final int pageIndex) throws PrinterException {
if (pageIndex >= pageList.size()) {
@@ -817,10 +828,16 @@
return PAGE_EXISTS;
}
+ /**
+ * {@inheritDoc}
+ */
public int getNumberOfPages() {
return pageList.size();
}
+ /**
+ * {@inheritDoc}
+ */
public PageFormat getPageFormat(final int pageIndex) {
if (pageIndex >= pageList.size()) {
return null;
@@ -848,50 +865,14 @@
return pageFormat;
}
+ /**
+ * {@inheritDoc}
+ */
public Printable getPrintable(final int pageIndex) {
return this;
}
/**
- * Draws an image.
- * TODO: protect other image formats (JIMI)
- */
- /*
- * public void renderImage(String href, float x, float y, float width,
- * float height, Vector transform) {
- * // What is with transformations?
- * try {
- * URL url = URLFactory.createURL(href);
- * ImageIcon imageIcon = new ImageIcon(url);
- * AffineTransform fullTransform = new AffineTransform();
- * AffineTransform aTransform;
- * transform = (transform == null) ? new Vector() : transform;
- * for (int i = 0; i < transform.size(); i++) {
- * org.w3c.dom.svg.SVGTransform t =
- * (org.w3c.dom.svg.SVGTransform)
- * transform.get(i);
- * SVGMatrix matrix = t.getMatrix();
- * aTransform = new AffineTransform(matrix.getA(),
- * matrix.getB(), matrix.getC(), matrix.getD(),
- * matrix.getE(), matrix.getF());
- * fullTransform.concatenate(aTransform);
- * }
- * BufferedImage bi = new BufferedImage((int) width, (int) height,
- * BufferedImage.TYPE_INT_RGB);
- * Graphics2D g2d = bi.createGraphics();
- * BufferedImageOp bop = new AffineTransformOp(fullTransform,
- * AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
- * g2d.drawImage(imageIcon.getImage(), 0, 0, (int) width,
- * (int) height, imageIcon.getImageObserver());
- * graphics.drawImage(bi, bop, (int) x, (int) y);
- * } catch (Exception ex) {
- * log.error("AWTRenderer: renderImage(): " +
- * ex.getMessage(), ex);
- * }
- * }
- */
-
- /**
* {@inheritDoc}
*/
public void render(final ForeignObjectArea area) {
Modified: trunk/foray/scripts/checkstyle-suppressions.xml
===================================================================
--- trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-23 22:23:42 UTC (rev 9266)
+++ trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-24 16:03:50 UTC (rev 9267)
@@ -10,8 +10,6 @@
<suppress checks="Javadoc[MV].*"
files="org.foray.fotree.fo.prop.*"/>
- <suppress checks="Javadoc[MV].*"
- files="org.foray.render.awt.*"/>
<!-- Suppress Javadoc package documentation for test directories. -->
<suppress checks="PackageHtml"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-25 20:59:41
|
Revision: 9272
http://svn.sourceforge.net/foray/?rev=9272&view=rev
Author: victormote
Date: 2007-04-25 13:58:34 -0700 (Wed, 25 Apr 2007)
Log Message:
-----------
Conform to axsl changes using new enum for country codes.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java
trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2007-04-24 20:44:58 UTC (rev 9271)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java 2007-04-25 20:58:34 UTC (rev 9272)
@@ -28,6 +28,7 @@
package org.foray.fotree;
+import org.axsl.common.value.Iso3166;
import org.axsl.foR.FoContext;
import org.axsl.foR.fo.RetrieveMarker;
import org.axsl.fontR.FontUse;
@@ -171,14 +172,14 @@
/**
* {@inheritDoc}
*/
- public String inlineCountry() {
+ public Iso3166 inlineCountry() {
return realLineText.inlineCountry(this.context);
}
/**
* {@inheritDoc}
*/
- public String inlineCountry(final FoContext context) {
+ public Iso3166 inlineCountry(final FoContext context) {
return realLineText.inlineCountry(context);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-04-24 20:44:58 UTC (rev 9271)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java 2007-04-25 20:58:34 UTC (rev 9272)
@@ -33,6 +33,7 @@
import org.foray.fotree.fo.FoValue;
import org.foray.fotree.fo.obj.BookmarkTitle;
+import org.axsl.common.value.Iso3166;
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
@@ -697,14 +698,14 @@
/**
* {@inheritDoc}
*/
- public String inlineCountry() {
+ public Iso3166 inlineCountry() {
return this.inlineCountry(null);
}
/**
* {@inheritDoc}
*/
- public String inlineCountry(final FoContext context) {
+ public Iso3166 inlineCountry(final FoContext context) {
final FObj effectiveParent = effectiveParent(context);
return effectiveParent.traitCountry(context);
}
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-24 20:44:58 UTC (rev 9271)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-25 20:58:34 UTC (rev 9272)
@@ -55,6 +55,7 @@
import org.axsl.common.value.Float;
import org.axsl.common.value.ForcePageCount;
import org.axsl.common.value.HyphenationKeep;
+import org.axsl.common.value.Iso3166;
import org.axsl.common.value.LeaderAlignment;
import org.axsl.common.value.LeaderPattern;
import org.axsl.common.value.LineHeightShiftAdjustment;
@@ -2000,8 +2001,9 @@
/**
* {@inheritDoc}
*/
- public String traitCountry(final FoContext context) {
- return propertyList.getCountry(context);
+ public Iso3166 traitCountry(final FoContext context) {
+ final String countryCode = propertyList.getCountry(context);
+ return Iso3166.findFromAlpha(countryCode);
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java 2007-04-24 20:44:58 UTC (rev 9271)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java 2007-04-25 20:58:34 UTC (rev 9272)
@@ -129,7 +129,7 @@
final FObj fobj) {
final FObj parent = fobj.effectiveParent(context);
if (parent != null) {
- return parent.traitCountry(context);
+ return parent.getPropertyList().getCountry(context);
}
return "";
}
Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2007-04-24 20:44:58 UTC (rev 9271)
+++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2007-04-25 20:58:34 UTC (rev 9272)
@@ -31,6 +31,7 @@
import org.foray.text.TextServer;
import org.foray.text.line.EagerLineBreaker;
+import org.axsl.common.value.Iso3166;
import org.axsl.fontR.FontConsumer;
import org.axsl.hyphenR.Hyphenation;
import org.axsl.hyphenR.HyphenationException;
@@ -389,17 +390,23 @@
final HyphenationServer server =
this.getTextServer().getHyphenationServer();
final String language = this.currentLineText.inlineLanguage();
- final String country = this.currentLineText.inlineCountry();
+ final Iso3166 country = this.currentLineText.inlineCountry();
+ final String countryCode;
+ if (country == null) {
+ countryCode = "";
+ } else {
+ countryCode = country.getAbbrev2();
+ }
// Count the number of chars at the beginning that should be ignored.
final int actualWordStart = server.wordStarts(this.currentChars,
- this.wordStart, language, country);
+ this.wordStart, language, countryCode);
if (actualWordStart < 0) {
return this.wordStart;
}
final int nonWordChars = actualWordStart - this.wordStart;
// Extract the word that should be evaluated by the hyphenation system.
final int wordSize = server.wordSize(this.currentChars, actualWordStart,
- language, country);
+ language, countryCode);
final String wordToHyphenate = new String(this.currentChars,
actualWordStart,
wordSize);
@@ -407,7 +414,7 @@
Hyphenation hyph = null;
try {
hyph = server.hyphenate(wordToHyphenate, 0,
- wordToHyphenate.length(), language, country,
+ wordToHyphenate.length(), language, countryCode,
this.currentLineText.inlineHyphenationRemainCount(),
this.currentLineText.inlineHyphenationPushCount(), false);
} catch (final HyphenationException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-25 21:17:29
|
Revision: 9273
http://svn.sourceforge.net/foray/?rev=9273&view=rev
Author: victormote
Date: 2007-04-25 14:17:26 -0700 (Wed, 25 Apr 2007)
Log Message:
-----------
1. Remove no-longer-needed class.
2. Take advantage of new axsl requirements that a null not be returned by traitCountry.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java
trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
Removed Paths:
-------------
trunk/foray/foray-common/src/java/org/foray/common/ISO3166.java
Deleted: trunk/foray/foray-common/src/java/org/foray/common/ISO3166.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/ISO3166.java 2007-04-25 20:58:34 UTC (rev 9272)
+++ trunk/foray/foray-common/src/java/org/foray/common/ISO3166.java 2007-04-25 21:17:26 UTC (rev 9273)
@@ -1,343 +0,0 @@
-/*
- * 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 java.util.Arrays;
-
-/**
- * Utility class for country codes using the ISO-3166 standard.
- */
-public final class ISO3166 {
-
- /**
- * This list is derived from
- * http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html.
- * Element 0 is the country name (in English), element 1 is the 2-letter
- * code, element 2 is the 3-letter code, and element 3 is the numeric code.
- */
- private static final String[][] RAW_CODES = {
- {"AALAND ISLANDS", "AX", "ALA", "248"},
- {"AFGHANISTAN", "AF", "AFG", "004"},
- {"ALBANIA", "AL", "ALB", "008"},
- {"ALGERIA", "DZ", "DZA", "012"},
- {"AMERICAN SAMOA", "AS", "ASM", "016"},
- {"ANDORRA", "AD", "AND", "020"},
- {"ANGOLA", "AO", "AGO", "024"},
- {"ANGUILLA", "AI", "AIA", "660"},
- {"ANTARCTICA", "AQ", "ATA", "010"},
- {"ANTIGUA AND BARBUDA", "AG", "ATG", "028"},
- {"ARGENTINA", "AR", "ARG", "032"},
- {"ARMENIA", "AM", "ARM", "051"},
- {"ARUBA", "AW", "ABW", "533"},
- {"AUSTRALIA", "AU", "AUS", "036"},
- {"AUSTRIA", "AT", "AUT", "040"},
- {"AZERBAIJAN", "AZ", "AZE", "031"},
- {"BAHAMAS", "BS", "BHS", "044"},
- {"BAHRAIN", "BH", "BHR", "048"},
- {"BANGLADESH", "BD", "BGD", "050"},
- {"BARBADOS", "BB", "BRB", "052"},
- {"BELARUS", "BY", "BLR", "112"},
- {"BELGIUM", "BE", "BEL", "056"},
- {"BELIZE", "BZ", "BLZ", "084"},
- {"BENIN", "BJ", "BEN", "204"},
- {"BERMUDA", "BM", "BMU", "060"},
- {"BHUTAN", "BT", "BTN", "064"},
- {"BOLIVIA", "BO", "BOL", "068"},
- {"BOSNIA AND HERZEGOWINA", "BA", "BIH", "070"},
- {"BOTSWANA", "BW", "BWA", "072"},
- {"BOUVET ISLAND", "BV", "BVT", "074"},
- {"BRAZIL", "BR", "BRA", "076"},
- {"BRITISH INDIAN OCEAN TERRITORY", "IO", "IOT", "086"},
- {"BRUNEI DARUSSALAM", "BN", "BRN", "096"},
- {"BULGARIA", "BG", "BGR", "100"},
- {"BURKINA FASO", "BF", "BFA", "854"},
- {"BURUNDI", "BI", "BDI", "108"},
- {"CAMBODIA", "KH", "KHM", "116"},
- {"CAMEROON", "CM", "CMR", "120"},
- {"CANADA", "CA", "CAN", "124"},
- {"CAPE VERDE", "CV", "CPV", "132"},
- {"CAYMAN ISLANDS", "KY", "CYM", "136"},
- {"CENTRAL AFRICAN REPUBLIC", "CF", "CAF", "140"},
- {"CHAD", "TD", "TCD", "148"},
- {"CHILE", "CL", "CHL", "152"},
- {"CHINA", "CN", "CHN", "156"},
- {"CHRISTMAS ISLAND", "CX", "CXR", "162"},
- {"COCOS (KEELING) ISLANDS", "CC", "CCK", "166"},
- {"COLOMBIA", "CO", "COL", "170"},
- {"COMOROS", "KM", "COM", "174"},
- {"CONGO, Democratic Republic of (was Zaire)", "CD", "COD", "180"},
- {"CONGO, Republic of", "CG", "COG", "178"},
- {"COOK ISLANDS", "CK", "COK", "184"},
- {"COSTA RICA", "CR", "CRI", "188"},
- {"COTE D'IVOIRE", "CI", "CIV", "384"},
- {"CROATIA (local name: Hrvatska)", "HR", "HRV", "191"},
- {"CUBA", "CU", "CUB", "192"},
- {"CYPRUS", "CY", "CYP", "196"},
- {"CZECH REPUBLIC", "CZ", "CZE", "203"},
- {"DENMARK", "DK", "DNK", "208"},
- {"DJIBOUTI", "DJ", "DJI", "262"},
- {"DOMINICA", "DM", "DMA", "212"},
- {"DOMINICAN REPUBLIC", "DO", "DOM", "214"},
- {"ECUADOR", "EC", "ECU", "218"},
- {"EGYPT", "EG", "EGY", "818"},
- {"EL SALVADOR", "SV", "SLV", "222"},
- {"EQUATORIAL GUINEA", "GQ", "GNQ", "226"},
- {"ERITREA", "ER", "ERI", "232"},
- {"ESTONIA", "EE", "EST", "233"},
- {"ETHIOPIA", "ET", "ETH", "231"},
- {"FALKLAND ISLANDS (MALVINAS)", "FK", "FLK", "238"},
- {"FAROE ISLANDS", "FO", "FRO", "234"},
- {"FIJI", "FJ", "FJI", "242"},
- {"FINLAND", "FI", "FIN", "246"},
- {"FRANCE", "FR", "FRA", "250"},
- {"FRENCH GUIANA", "GF", "GUF", "254"},
- {"FRENCH POLYNESIA", "PF", "PYF", "258"},
- {"FRENCH SOUTHERN TERRITORIES", "TF", "ATF", "260"},
- {"GABON", "GA", "GAB", "266"},
- {"GAMBIA", "GM", "GMB", "270"},
- {"GEORGIA", "GE", "GEO", "268"},
- {"GERMANY", "DE", "DEU", "276"},
- {"GHANA", "GH", "GHA", "288"},
- {"GIBRALTAR", "GI", "GIB", "292"},
- {"GREECE", "GR", "GRC", "300"},
- {"GREENLAND", "GL", "GRL", "304"},
- {"GRENADA", "GD", "GRD", "308"},
- {"GUADELOUPE", "GP", "GLP", "312"},
- {"GUAM", "GU", "GUM", "316"},
- {"GUATEMALA", "GT", "GTM", "320"},
- {"GUINEA", "GN", "GIN", "324"},
- {"GUINEA-BISSAU", "GW", "GNB", "624"},
- {"GUYANA", "GY", "GUY", "328"},
- {"HAITI", "HT", "HTI", "332"},
- {"HEARD AND MC DONALD ISLANDS", "HM", "HMD", "334"},
- {"HONDURAS", "HN", "HND", "340"},
- {"HONG KONG", "HK", "HKG", "344"},
- {"HUNGARY", "HU", "HUN", "348"},
- {"ICELAND", "IS", "ISL", "352"},
- {"INDIA", "IN", "IND", "356"},
- {"INDONESIA", "ID", "IDN", "360"},
- {"IRAN (ISLAMIC REPUBLIC OF)", "IR", "IRN", "364"},
- {"IRAQ", "IQ", "IRQ", "368"},
- {"IRELAND", "IE", "IRL", "372"},
- {"ISRAEL", "IL", "ISR", "376"},
- {"ITALY", "IT", "ITA", "380"},
- {"JAMAICA", "JM", "JAM", "388"},
- {"JAPAN", "JP", "JPN", "392"},
- {"JORDAN", "JO", "JOR", "400"},
- {"KAZAKHSTAN", "KZ", "KAZ", "398"},
- {"KENYA", "KE", "KEN", "404"},
- {"KIRIBATI", "KI", "KIR", "296"},
- {"KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF", "KP", "PRK", "408"},
- {"KOREA, REPUBLIC OF", "KR", "KOR", "410"},
- {"KUWAIT", "KW", "KWT", "414"},
- {"KYRGYZSTAN", "KG", "KGZ", "417"},
- {"LAO PEOPLE'S DEMOCRATIC REPUBLIC", "LA", "LAO", "418"},
- {"LATVIA", "LV", "LVA", "428"},
- {"LEBANON", "LB", "LBN", "422"},
- {"LESOTHO", "LS", "LSO", "426"},
- {"LIBERIA", "LR", "LBR", "430"},
- {"LIBYAN ARAB JAMAHIRIYA", "LY", "LBY", "434"},
- {"LIECHTENSTEIN", "LI", "LIE", "438"},
- {"LITHUANIA", "LT", "LTU", "440"},
- {"LUXEMBOURG", "LU", "LUX", "442"},
- {"MACAU", "MO", "MAC", "446"},
- {"MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF", "MK", "MKD", "807"},
- {"MADAGASCAR", "MG", "MDG", "450"},
- {"MALAWI", "MW", "MWI", "454"},
- {"MALAYSIA", "MY", "MYS", "458"},
- {"MALDIVES", "MV", "MDV", "462"},
- {"MALI", "ML", "MLI", "466"},
- {"MALTA", "MT", "MLT", "470"},
- {"MARSHALL ISLANDS", "MH", "MHL", "584"},
- {"MARTINIQUE", "MQ", "MTQ", "474"},
- {"MAURITANIA", "MR", "MRT", "478"},
- {"MAURITIUS", "MU", "MUS", "480"},
- {"MAYOTTE", "YT", "MYT", "175"},
- {"MEXICO", "MX", "MEX", "484"},
- {"MICRONESIA, FEDERATED STATES OF", "FM", "FSM", "583"},
- {"MOLDOVA, REPUBLIC OF", "MD", "MDA", "498"},
- {"MONACO", "MC", "MCO", "492"},
- {"MONGOLIA", "MN", "MNG", "496"},
- {"MONTSERRAT", "MS", "MSR", "500"},
- {"MOROCCO", "MA", "MAR", "504"},
- {"MOZAMBIQUE", "MZ", "MOZ", "508"},
- {"MYANMAR", "MM", "MMR", "104"},
- {"NAMIBIA", "NA", "NAM", "516"},
- {"NAURU", "NR", "NRU", "520"},
- {"NEPAL", "NP", "NPL", "524"},
- {"NETHERLANDS", "NL", "NLD", "528"},
- {"NETHERLANDS ANTILLES", "AN", "ANT", "530"},
- {"NEW CALEDONIA", "NC", "NCL", "540"},
- {"NEW ZEALAND", "NZ", "NZL", "554"},
- {"NICARAGUA", "NI", "NIC", "558"},
- {"NIGER", "NE", "NER", "562"},
- {"NIGERIA", "NG", "NGA", "566"},
- {"NIUE", "NU", "NIU", "570"},
- {"NORFOLK ISLAND", "NF", "NFK", "574"},
- {"NORTHERN MARIANA ISLANDS", "MP", "MNP", "580"},
- {"NORWAY", "NO", "NOR", "578"},
- {"OMAN", "OM", "OMN", "512"},
- {"PAKISTAN", "PK", "PAK", "586"},
- {"PALAU", "PW", "PLW", "585"},
- {"PALESTINIAN TERRITORY, Occupied", "PS", "PSE", "275"},
- {"PANAMA", "PA", "PAN", "591"},
- {"PAPUA NEW GUINEA", "PG", "PNG", "598"},
- {"PARAGUAY", "PY", "PRY", "600"},
- {"PERU", "PE", "PER", "604"},
- {"PHILIPPINES", "PH", "PHL", "608"},
- {"PITCAIRN", "PN", "PCN", "612"},
- {"POLAND", "PL", "POL", "616"},
- {"PORTUGAL", "PT", "PRT", "620"},
- {"PUERTO RICO", "PR", "PRI", "630"},
- {"QATAR", "QA", "QAT", "634"},
- {"REUNION", "RE", "REU", "638"},
- {"ROMANIA", "RO", "ROU", "642"},
- {"RUSSIAN FEDERATION", "RU", "RUS", "643"},
- {"RWANDA", "RW", "RWA", "646"},
- {"SAINT HELENA", "SH", "SHN", "654"},
- {"SAINT KITTS AND NEVIS", "KN", "KNA", "659"},
- {"SAINT LUCIA", "LC", "LCA", "662"},
- {"SAINT PIERRE AND MIQUELON", "PM", "SPM", "666"},
- {"SAINT VINCENT AND THE GRENADINES", "VC", "VCT", "670"},
- {"SAMOA", "WS", "WSM", "882"},
- {"SAN MARINO", "SM", "SMR", "674"},
- {"SAO TOME AND PRINCIPE", "ST", "STP", "678"},
- {"SAUDI ARABIA", "SA", "SAU", "682"},
- {"SENEGAL", "SN", "SEN", "686"},
- {"SERBIA AND MONTENEGRO", "CS", "SCG", "891"},
- {"SEYCHELLES", "SC", "SYC", "690"},
- {"SIERRA LEONE", "SL", "SLE", "694"},
- {"SINGAPORE", "SG", "SGP", "702"},
- {"SLOVAKIA", "SK", "SVK", "703"},
- {"SLOVENIA", "SI", "SVN", "705"},
- {"SOLOMON ISLANDS", "SB", "SLB", "090"},
- {"SOMALIA", "SO", "SOM", "706"},
- {"SOUTH AFRICA", "ZA", "ZAF", "710"},
- {"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS", "GS", "SGS", "239"},
- {"SPAIN", "ES", "ESP", "724"},
- {"SRI LANKA", "LK", "LKA", "144"},
- {"SUDAN", "SD", "SDN", "736"},
- {"SURINAME", "SR", "SUR", "740"},
- {"SVALBARD AND JAN MAYEN ISLANDS", "SJ", "SJM", "744"},
- {"SWAZILAND", "SZ", "SWZ", "748"},
- {"SWEDEN", "SE", "SWE", "752"},
- {"SWITZERLAND", "CH", "CHE", "756"},
- {"SYRIAN ARAB REPUBLIC", "SY", "SYR", "760"},
- {"TAIWAN", "TW", "TWN", "158"},
- {"TAJIKISTAN", "TJ", "TJK", "762"},
- {"TANZANIA, UNITED REPUBLIC OF", "TZ", "TZA", "834"},
- {"THAILAND", "TH", "THA", "764"},
- {"TIMOR-LESTE", "TL", "TLS", "626"},
- {"TOGO", "TG", "TGO", "768"},
- {"TOKELAU", "TK", "TKL", "772"},
- {"TONGA", "TO", "TON", "776"},
- {"TRINIDAD AND TOBAGO", "TT", "TTO", "780"},
- {"TUNISIA", "TN", "TUN", "788"},
- {"TURKEY", "TR", "TUR", "792"},
- {"TURKMENISTAN", "TM", "TKM", "795"},
- {"TURKS AND CAICOS ISLANDS", "TC", "TCA", "796"},
- {"TUVALU", "TV", "TUV", "798"},
- {"UGANDA", "UG", "UGA", "800"},
- {"UKRAINE", "UA", "UKR", "804"},
- {"UNITED ARAB EMIRATES", "AE", "ARE", "784"},
- {"UNITED KINGDOM", "GB", "GBR", "826"},
- {"UNITED STATES", "US", "USA", "840"},
- {"UNITED STATES MINOR OUTLYING ISLANDS", "UM", "UMI", "581"},
- {"URUGUAY", "UY", "URY", "858"},
- {"UZBEKISTAN", "UZ", "UZB", "860"},
- {"VANUATU", "VU", "VUT", "548"},
- {"VATICAN CITY STATE (HOLY SEE)", "VA", "VAT", "336"},
- {"VENEZUELA", "VE", "VEN", "862"},
- {"VIET NAM", "VN", "VNM", "704"},
- {"VIRGIN ISLANDS (BRITISH)", "VG", "VGB", "092"},
- {"VIRGIN ISLANDS (U.S.)", "VI", "VIR", "850"},
- {"WALLIS AND FUTUNA ISLANDS", "WF", "WLF", "876"},
- {"WESTERN SAHARA", "EH", "ESH", "732"},
- {"YEMEN", "YE", "YEM", "887"},
- {"ZAMBIA", "ZM", "ZMB", "894"},
- {"ZIMBABWE", "ZW", "ZWE", "716"},
- };
-
- /** The valid 3-letter country codes. */
- private static String[] codes3Letter;
-
- /** The valid 2-letter country codes. */
- private static String[] codes2Letter;
-
- static {
- /* Build the 3-letter codes array.*/
- int count2LetterCodes = 0;
- codes3Letter = new String[RAW_CODES.length];
- for (int i = 0; i < RAW_CODES.length; i++) {
- codes3Letter[i] = RAW_CODES[i][2];
- if (RAW_CODES[i][1] != null) {
- count2LetterCodes ++;
- }
- }
- Arrays.sort(codes3Letter);
-
- /* Build the 2-letter codes array. */
- codes2Letter = new String[count2LetterCodes];
- count2LetterCodes = 0;
- for (int i = 0; i < RAW_CODES.length; i++) {
- if (RAW_CODES[i][1] != null) {
- codes2Letter[count2LetterCodes] = RAW_CODES[i][1];
- count2LetterCodes ++;
- }
- }
- Arrays.sort(codes2Letter);
- }
- /**
- * Private constructor. This is a utility class, and should never be
- * instantiated.
- */
- private ISO3166() { }
-
- /**
- * Determines whether a given country code is a valid 2-character or
- * 3-character language code as defined in ISO 3166.
- * @param countryCode A 2-letter or 3-letter ISO 3166 code.
- * @return True iff <code>countryCode</code> is a valid 2- or 3-character
- * ISO 3166 country code.
- */
- public static boolean validCountry(final String countryCode) {
- /* Convert to uppercase, since the raw data is in that format. */
- final String normalizedCountryCode = countryCode.toUpperCase();
- int index = Arrays.binarySearch(codes3Letter, normalizedCountryCode);
- if (index >= 0) {
- return true;
- }
- index = Arrays.binarySearch(codes2Letter, normalizedCountryCode);
- if (index >= 0) {
- return true;
- }
- return false;
- }
-
-}
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-25 20:58:34 UTC (rev 9272)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-25 21:17:26 UTC (rev 9273)
@@ -2003,7 +2003,12 @@
*/
public Iso3166 traitCountry(final FoContext context) {
final String countryCode = propertyList.getCountry(context);
- return Iso3166.findFromAlpha(countryCode);
+ final Iso3166 iso3166 = Iso3166.findFromAlpha(countryCode);
+ if (iso3166 == null) {
+ return Iso3166.NULL;
+ } else {
+ return iso3166;
+ }
}
/**
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java 2007-04-25 20:58:34 UTC (rev 9272)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Country.java 2007-04-25 21:17:26 UTC (rev 9273)
@@ -89,8 +89,9 @@
if (pv instanceof PropertyKeyword) {
return pv;
}
- if (DtCountry.validCountry(value)) {
- return new DtCountry(value);
+ final DtCountry dtCountry = DtCountry.makeCountryDT(value);
+ if (dtCountry != null) {
+ return dtCountry;
}
throw unexpectedValue(value, propertyList);
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2007-04-25 20:58:34 UTC (rev 9272)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtCountry.java 2007-04-25 21:17:26 UTC (rev 9273)
@@ -28,11 +28,11 @@
package org.foray.fotree.value;
-import org.foray.common.ISO3166;
+import org.axsl.common.value.Iso3166;
/**
* A "country" datatype in XSL-FO. Countries must conform to the ISO 3166 codes.
- * @see org.foray.common.ISO3166
+ * @see org.axsl.common.value.Iso3166
*/
public class DtCountry extends Datatype {
/* TODO: Make this class immutable, make the constructor private, and create
@@ -58,21 +58,13 @@
}
/**
- * Determines whether a given country code is found in validCountries.
- * @param countryCode A 2-letter or 3-letter ISO 3166 code.
- * @return True if countryCode is found in validCountries, false otherwise.
- */
- public static boolean validCountry(final String countryCode) {
- return ISO3166.validCountry(countryCode);
- }
-
- /**
* Convert a String country descriptor to its DtCountry equivalent.
* @param countryCode The String country descriptor to be converted.
* @return The DtCountry instance for <code>countryCode</code>.
*/
public static DtCountry makeCountryDT(final String countryCode) {
- if (! validCountry(countryCode)) {
+ final Iso3166 iso3166 = Iso3166.findFromAlpha(countryCode);
+ if (iso3166 == null) {
return null;
}
return new DtCountry(countryCode);
Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2007-04-25 20:58:34 UTC (rev 9272)
+++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2007-04-25 21:17:26 UTC (rev 9273)
@@ -391,12 +391,7 @@
this.getTextServer().getHyphenationServer();
final String language = this.currentLineText.inlineLanguage();
final Iso3166 country = this.currentLineText.inlineCountry();
- final String countryCode;
- if (country == null) {
- countryCode = "";
- } else {
- countryCode = country.getAbbrev2();
- }
+ final String countryCode = country.getAbbrev2();
// Count the number of chars at the beginning that should be ignored.
final int actualWordStart = server.wordStarts(this.currentChars,
this.wordStart, language, countryCode);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2007-04-26 14:17:32
|
Revision: 9274
http://svn.sourceforge.net/foray/?rev=9274&view=rev
Author: victormote
Date: 2007-04-26 07:15:25 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Conform to axsl changes using new typesafe enum for language codes.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/Area.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOLineText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOText.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Language.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtLanguage.java
trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
Removed Paths:
-------------
trunk/foray/foray-common/src/java/org/foray/common/ISO639.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-25 21:17:26 UTC (rev 9273)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/Area.java 2007-04-26 14:15:25 UTC (rev 9274)
@@ -41,6 +41,7 @@
import org.axsl.common.value.Baseline;
import org.axsl.common.value.BorderStyle;
import org.axsl.common.value.DisplayAlign;
+import org.axsl.common.value.Iso639;
import org.axsl.common.value.LineStackingStrategy;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.Overflow;
@@ -1401,7 +1402,7 @@
* @return The language trait for this area.
* @see Fo#traitLanguage(FoContext)
*/
- public String traitLanguage() {
+ public Iso639 traitLanguage() {
return traitGeneratedBy().traitLanguage(this);
}
Deleted: trunk/foray/foray-common/src/java/org/foray/common/ISO639.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2007-04-25 21:17:26 UTC (rev 9273)
+++ trunk/foray/foray-common/src/java/org/foray/common/ISO639.java 2007-04-26 14:15:25 UTC (rev 9274)
@@ -1,648 +0,0 @@
-/*
- * 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 java.util.Arrays;
-
-/**
- * Utility class for language codes using the ISO-639 standard.
- */
-public final class ISO639 {
-
- /**
- * This list is derived from
- * http://www.loc.gov/standards/iso639-2/langcodes.html.
- * Element 0 is the 3-letter code, element 1 is the 2-letter code (if any),
- * element 2 is the English language name, and element 3 is the French
- * language name.
- */
- private static final String[][] RAW_CODES = {
- {"aar", "aa", "Afar", "afar"},
- {"abk", "ab", "Abkhazian", "abkhaze"},
- {"ace", null, "Achinese", "aceh"},
- {"ach", null, "Acoli", "acoli"},
- {"ada", null, "Adangme", "adangme"},
- {"ady", null, "Adyghe; Adygei", "adygh\xE9"},
- {"afa", null, "Afro-Asiatic (Other)",
- "afro-asiatiques, autres langues"},
- {"afh", null, "Afrihili", "afrihili"},
- {"afr", "af", "Afrikaans", "afrikaans"},
- {"ain", null, "Ainu", "a\xEFnou"},
- {"aka", "ak", "Akan", "akan"},
- {"akk", null, "Akkadian", "akkadien"},
- {"alb", "sq", "Albanian", "albanais"},
- {"ale", null, "Aleut", "al\xE9oute"},
- {"alg", null, "Algonquian languages", "algonquines, langues"},
- {"alt", null, "Southern Altai", "alta\xEF du Sud"},
- {"amh", "am", "Amharic", "amharique"},
- {"ang", null, "English, Old (ca.450-1100)",
- "anglo-saxon (ca.450-1100)"},
- {"anp", null, "Angika", "angika"},
- {"apa", null, "Apache languages", "apache"},
- {"ara", "ar", "Arabic", "arabe"},
- {"arc", null, "Aramaic", "aram\xE9en"},
- {"arg", "an", "Aragonese", "aragonais"},
- {"arm", "hy", "Armenian", "arm\xE9nien"},
- {"arn", null, "Araucanian", "araucan"},
- {"arp", null, "Arapaho", "rapaho"},
- {"art", null, "Artificial (Other)",
- "artificielles, autres langues"},
- {"arw", null, "Arawak", "arawak"},
- {"asm", "as", "Assamese", "assamais"},
- {"ast", null, "Asturian; Bable", " asturien; bable"},
- {"ath", null, "Athapascan languages", "athapascanes, langues"},
- {"aus", null, "Australian languages", "australiennes, langues"},
- {"ava", "av", "Avaric", "avar"},
- {"ave", "ae", "Avestan", "avestique"},
- {"awa", null, "Awadhi", "awadhi"},
- {"aym", "ay", "Aymara", "aymara"},
- {"aze", "az", "Azerbaijani", "az\xE9ri"},
- {"bad", null, "Banda", " banda"},
- {"bai", null, "Bamileke languages", "bamil\xE9k\xE9s, langues"},
- {"bak", "ba", "Bashkir", "bachkir"},
- {"bal", null, "Baluchi", "baloutchi"},
- {"bam", "bm", "Bambara", "bambara"},
- {"ban", null, "Balinese", "balinais"},
- {"baq", "eu", "Basque", "basque"},
- {"bas", null, "Basa", "basa"},
- {"bat", null, "Baltic (Other)", "baltiques, autres langues"},
- {"bej", null, "Beja", "bedja"},
- {"bel", "be", "Belarusian", "bi\xE9lorusse"},
- {"bem", null, "Bemba", "bemba"},
- {"ben", "bn", "Bengali", "bengali"},
- {"ber", null, "Berber (Other)", "berb\xE8res, autres langues"},
- {"bho", null, "Bhojpuri", "bhojpuri"},
- {"bih", "bh", "Bihari", "bihari"},
- {"bik", null, "Bikol", "bikol"},
- {"bin", null, "Bini", "bini"},
- {"bis", "bi", "Bislama", "bichlamar"},
- {"bla", null, "Siksika", "blackfoot"},
- {"bnt", null, "Bantu (Other)", "bantoues, autres langues"},
- {"tib", "bo", "Tibetan", "tib\xE9tain"},
- {"bos", "bs", "Bosnian", "bosniaque"},
- {"bra", null, "Braj", "braj"},
- {"bre", "br", "Breton", "breton"},
- {"btk", null, "Batak (Indonesia)", "batak (Indon\xE9sie)"},
- {"bua", null, "Buriat", "bouriate"},
- {"bug", null, "Buginese", "bugi"},
- {"bul", "bg", "Bulgarian", "bulgare"},
- {"bur", "my", "Burmese", "birman"},
- {"byn", null, "Blin; Bilin", "blin; bilen"},
- {"cad", null, "Caddo", "caddo"},
- {"cai", null, "Central American Indian (Other)",
- "indiennes d'Am\xE9rique centrale, autres langues"},
- {"car", null, "Carib", "caribe"},
- {"cat", "ca", "Catalan; Valencian", "catalan; valencien"},
- {"cau", null, "Caucasian (Other)", "caucasiennes, autres langues"},
- {"ceb", null, "Cebuano", "cebuano"},
- {"cel", null, "Celtic (Other)", "celtiques, autres langues"},
- {"cze", "cs", "Czech", "tch\xE8que"},
- {"cha", "ch", "Chamorro", "chamorro"},
- {"chb", null, "Chibcha", " chibcha"},
- {"che", "ce", "Chechen", "tch\xE9tch\xE8ne"},
- {"chg", null, "Chagatai", "djaghata\xEF"},
- {"chi", "zh", "Chinese", "chinois"},
- {"chk", null, "Chuukese", "chuuk"},
- {"chm", null, "Mari", "mari"},
- {"chn", null, "Chinook jargon", "chinook, jargon"},
- {"cho", null, "Choctaw", "choctaw"},
- {"chp", null, "Chipewyan", "chipewyan"},
- {"chr", null, "Cherokee", "cherokee"},
- {"chu", "cu", "Church Slavic; Old Slavonic; Church Slavonic; "
- + "Old Bulgarian; Old Church Slavonic",
- "slavon d'\xE9glise; vieux slave; slavon liturgique; vieux "
- + "bulgare"},
- {"chv", "cv", "Chuvash", "tchouvache"},
- {"chy", null, "Cheyenne", "cheyenne"},
- {"cmc", null, "Chamic languages", "chames, langues"},
- {"cop", null, "Coptic", "copte"},
- {"cor", "kw", "Cornish", "cornique"},
- {"cos", "co", "Corsican", "corse"},
- {"cpe", null, "Creoles and pidgins, English based (Other)",
- "cr\xE9oles et pidgins anglais, autres"},
- {"cpf", null, "Creoles and pidgins, French-based (Other)",
- "cr\xE9oles et pidgins fran\xE7ais, autres"},
- {"cpp", null, "Creoles and pidgins, Portuguese-based (Other)",
- "cr\xE9oles et pidgins portugais, autres"},
- {"cre", "cr", "Cree", "cree"},
- {"crh", null, "Crimean Tatar; Crimean Turkish", "tatar de Crim\xE9"},
- {"crp", null, "Creoles and pidgins (Other)",
- "cr\xE9oles et pidgins divers"},
- {"csb", null, "Kashubian", "kachoube"},
- {"cus", null, "Cushitic (Other)", "couchitiques, autres langues"},
- {"wel", "cy", "Welsh", "gallois"},
- {"cze", "cs", "Czech", "tch\xE8que"},
- {"dak", null, "Dakota", "dakota"},
- {"dan", "da", "Danish", "danois"},
- {"dar", null, "Dargwa", "dargwa"},
- {"day", null, "Dayak", "dayak"},
- {"del", null, "Delaware", "delaware"},
- {"den", null, "Slave (Athapascan)", "esclave (athapascan)"},
- {"ger", "de", "German", "allemand"},
- {"dgr", null, "Dogrib", "dogrib"},
- {"din", null, "Dinka", "dinka"},
- {"div", "dv", "Divehi; Dhivehi; Maldivian", " maldivien"},
- {"doi", null, "Dogri", "dogri"},
- {"dra", null, "Dravidian (Other)", "dravidiennes, autres langues"},
- {"dsb", null, "Lower Sorbian", "bas-sorabe"},
- {"dua", null, "Duala", "douala"},
- {"dum", null, "Dutch, Middle (ca.1050-1350)",
- "n\xE9erlandais moyen (ca. 1050-1350)"},
- {"dut", "nl", "Dutch; Flemish", "n\xE9erlandais; flamand"},
- {"dyu", null, "Dyula", "dioula"},
- {"dzo", "dz", "Dzongkha", "dzongkha"},
- {"efi", null, "Efik", "efik"},
- {"egy", null, "Egyptian (Ancient)", "\xE9gyptien"},
- {"eka", null, "Ekajuk", "ekajuk"},
- {"gre", "el", "Greek, Modern (1453-)", "grec moderne (apr\xE8s 1453)"},
- {"elx", null, "Elamite", "\xE9lamite"},
- {"eng", "en", "English", "anglais"},
- {"enm", null, "English, Middle (1100-1500)",
- "anglais moyen (1100-1500)"},
- {"epo", "eo", "Esperanto", "esp\xE9ranto"},
- {"est", "et", "Estonian", "estonien"},
- {"baq", "eu", "Basque", "basque"},
- {"ewe", "ee", "Ewe", "\xE9w\xE9"},
- {"ewo", null, "Ewondo", "\xE9wondo"},
- {"fan", null, "Fang", "fang"},
- {"fao", "fo", "Faroese", "f\xE9ro\xEFen"},
- {"per", "fa", "Persian", "persan"},
- {"fat", null, "Fanti", "fanti"},
- {"fij", "fj", "Fijian", "fidjien"},
- {"fil", null, "Filipino; Pilipino", "filipino; pilipino"},
- {"fin", "fi", "Finnish", "finnois"},
- {"fiu", null, "Finno-Ugrian (Other)",
- "finno-ougriennes, autres langues"},
- {"fon", null, "Fon", "fon"},
- {"fre", "fr", "French", "fran\xE7ais"},
- {"frm", null, "French, Middle (ca.1400-1600)",
- "fran\xE7ais moyen (1400-1600)"},
- {"fro", null, "French, Old (842-ca.1400)",
- "fran\xE7ais ancien (842-ca.1400)"},
- {"frr", null, "Northern Frisian", "frison septentrional"},
- {"frs", null, "Eastern Frisian", "frison oriental"},
- {"fry", "fy", "Western Frisian", "frison occidental"},
- {"ful", "ff", "Fulah", "peul"},
- {"fur", null, "Friulian", "frioulan"},
- {"gaa", null, "Ga", "ga"},
- {"gay", null, "Gayo", " gayo"},
- {"gba", null, "Gbaya", "gbaya"},
- {"gem", null, "Germanic (Other)", "germaniques, autres langues"},
- {"geo", "ka", "Georgian", "g\xE9orgien"},
- {"ger", "de", "German", "allemand"},
- {"gez", null, "Geez", "gu\xE8ze"},
- {"gil", null, "Gilbertese", "kiribati"},
- {"gla", "gd", "Gaelic; Scottish Gaelic",
- "ga\xE9lique; ga\xE9lique \xE9cossais"},
- {"gle", "ga", "Irish", "irlandais"},
- {"glg", "gl", "Galician galicien"},
- {"glv", "gv", "Manx", "manx; mannois"},
- {"gmh", null, "German, Middle High (ca.1050-1500)",
- "allemand, moyen haut (ca. 1050-1500)"},
- {"goh", null, "German, Old High (ca.750-1050)",
- "allemand, vieux haut (ca. 750-1050)"},
- {"gon", null, "Gondi", "gond"},
-
- {"gor", null, "Gorontalo", "gorontalo"},
- {"got", null, "Gothic", "gothique"},
- {"grb", null, "Grebo", "grebo"},
- {"grc", null, "Greek, Ancient (to 1453)",
- "grec ancien (jusqu'\xE0 1453)"},
- {"gre", "el", "Greek, Modern (1453-)", "grec moderne (apr\xE8s 1453)"},
- {"grn", "gn", "Guarani", "guarani"},
- {"gsw", null, "Alemanic; Swiss German", " al\xE9manique"},
- {"guj", "gu", "Gujarati", "goudjrati"},
- {"gwi", null, "Gwich\xB4in", "gwich\xB4in"},
- {"hai", null, "Haida", "haida"},
- {"hat", "ht", "Haitian; Haitian Creole", "ha\xEFtien; cr\xE9ole ha\xEFtien"},
- {"hau", "ha", "Hausa", "haoussa"},
- {"haw", null, "Hawaiian", "hawa\xEFen"},
- {"heb", "he", "Hebrew", "h\xE9breu"},
- {"her", "hz", "Herero", " herero"},
- {"hil", null, "Hiligaynon", "hiligaynon"},
- {"him", null, "Himachali", "himachali"},
- {"hin", "hi", "Hindi", "hindi"},
- {"hit", null, "Hittite", "hittite"},
- {"hmn", null, "Hmong", "hmong"},
- {"hmo", "ho", "Hiri Motu", "hiri motu"},
- {"scr", "hr", "Croatian", "croate"},
- {"hsb", null, "Upper Sorbian", "haut-sorabe"},
- {"hun", "hu", "Hungarian", "hongrois"},
- {"hup", null, "Hupa", "hupa"},
- {"arm", "hy", "Armenian", "arm\xE9nien"},
- {"iba", null, "Iban", "iban"},
- {"ibo", "ig", "Igbo", "igbo"},
- {"ice", "is", "Icelandic", "islandais"},
- {"ido", "io", "Ido", "ido"},
- {"iii", "ii", "Sichuan Yi", "yi de Sichuan"},
- {"ijo", null, "Ijo", "ijo"},
- {"iku", "iu", "Inuktitut", "inuktitut"},
- {"ile", "ie", "Interlingue", "interlingue"},
- {"ilo", null, "Iloko", "ilocano"},
- {"ina", "ia", "Interlingua (International Auxiliary Language "
- + "Association)",
- "interlingua (langue auxiliaire internationale)"},
- {"inc", null, "Indic (Other)", "indo-aryennes, autres langues"},
- {"ind", "id", "Indonesian", "indon\xE9sien"},
- {"ine", null, "Indo-European (Other)",
- "indo-europ\xE9ennes, autres langues"},
- {"inh", null, "Ingush", "ingouche"},
- {"ipk", "ik", "Inupiaq", "inupiaq"},
- {"ira", null, "Iranian (Other)", "iraniennes, autres langues"},
- {"iro", null, "Iroquoian languages",
- "iroquoises, langues (famille)"},
- {"ice", "is", "Icelandic", "islandais"},
- {"ita", "it", "Italian", "italien"},
- {"jav", "jv", "Javanese", "javanais"},
- {"jbo", null, "Lojban", "lojban"},
- {"jpn", "ja", "Japanese", "japonais"},
- {"jpr", null, "Judeo-Persian", "jud\xE9o-persan"},
- {"jrb", null, "Judeo-Arabic", "jud\xE9o-arabe"},
- {"kaa", null, "Kara-Kalpak", "karakalpak"},
- {"kab", null, "Kabyle", "kabyle"},
- {"kac", null, "Kachin", "kachin"},
- {"kal", "kl", "Kalaallisut; Greenlandic", "groenlandais"},
- {"kam", null, "Kamba", "kamba"},
- {"kan", "kn", "Kannada", "kannada"},
- {"kar", null, "Karen", "karen"},
- {"kas", "ks", "Kashmiri", "kashmiri"},
- {"geo", "ka", "Georgian", "g\xE9orgien"},
- {"kau", "kr", "Kanuri", "kanouri"},
- {"kaw", null, "Kawi", "kawi"},
- {"kaz", "kk", "Kazakh", "kazakh"},
- {"kbd", null, "Kabardian", "kabardien"},
- {"kha", null, "Khasi", "khasi"},
- {"khi", null, "Khoisan (Other)", "khoisan, autres langues"},
- {"khm", "km", "Khmer", "khmer"},
- {"kho", null, "Khotanese", "khotanais"},
- {"kik", "ki", "Kikuyu; Gikuyu", "kikuyu"},
- {"kin", "rw", "Kinyarwanda", "rwanda"},
- {"kir", "ky", "Kirghiz", "kirghize"},
- {"kmb", null, "Kimbundu", "kimbundu"},
- {"kok", null, "Konkani", "konkani"},
- {"kom", "kv", "Komi", "kom"},
- {"kon", "kg", "Kongo", "kongo"},
- {"kor", "ko", "Korean", "cor\xE9en"},
- {"kos", null, "Kosraean", "kosrae"},
- {"kpe", null, "Kpelle", "kpell\xE9"},
- {"krc", null, "Karachay-Balkar", "karatcha\xEF balkar"},
- {"krl", null, "Karelian", "car\xE9lien"},
- {"kro", null, "Kru", "krou"},
- {"kru", null, "Kurukh", "kurukh"},
- {"kua", "kj", "Kuanyama; Kwanyama", "kuanyama; kwanyama"},
- {"kum", null, "Kumyk", "koumyk"},
- {"kur", "ku", "Kurdish", "kurde"},
- {"kut", null, "Kutenai", "kutenai"},
- {"lad", null, "Ladino", "jud\xE9o-espagnol"},
- {"lah", null, "Lahnda", "lahnda"},
- {"lam", null, "Lamba", "lamba"},
- {"lao", "lo", "Lao", "lao"},
- {"lat", "la", "Latin", "latin"},
- {"lav", "lv", "Latvian", "letton"},
- {"lez", null, "Lezghian", "lezghien"},
- {"lim", "li", "Limburgan; Limburger;", "Limburgish limbourgeois"},
- {"lin", "ln", "Lingala", "lingala"},
- {"lit", "lt", "Lithuanian", "lituanien"},
- {"lol", null, "Mongo", "mongo"},
- {"loz", null, "Lozi", "lozi"},
- {"ltz", "lb", "Luxembourgish; Letzeburgesch", "luxembourgeois"},
- {"lua", null, "Luba-Lulua", "luba-lulua"},
- {"lub", "lu", "Luba-Katanga", "luba-katanga"},
- {"lug", "lg", "Ganda", "ganda"},
- {"lui", null, "Luiseno", "luiseno"},
- {"lun", null, "Lunda", "lunda"},
- {"luo", null, "Luo (Kenya and Tanzania)",
- "luo (Kenya et Tanzanie)"},
- {"lus", null, "lushai", "Lushai"},
- {"mac", "mk", "Macedonian", "mac\xE9donien"},
- {"mad", null, "Madurese", "madourais"},
- {"mag", null, "Magahi", "magahi"},
- {"mah", "mh", "Marshallese", "marshall"},
- {"mai", null, "Maithili", "maithili"},
- {"mak", null, "Makasar", "makassar"},
- {"mal", "ml", "Malayalam", "malayalam"},
- {"man", null, "Mandingo", "mandingue"},
- {"mao", "mi", "Maori", "maori"},
- {"map", null, "Austronesian (Other)",
- "malayo-polyn\xE9siennes, autres langues"},
- {"mar", "mr", "Marathi", "marathe"},
- {"mas", null, "Masai", "massa\xEF"},
- {"may", "ms", "Malay", "malais"},
- {"mdf", null, "Moksha", "moksa"},
- {"mdr", null, "Mandar", "mandar"},
- {"men", null, "Mende", "mend\xE9"},
- {"mga", null, "Irish, Middle (900-1200)",
- "irlandais moyen (900-1200)"},
- {"mic", null, "Mi'kmaq; Micmac", "mi'kmaq; micmac"},
- {"min", null, "Minangkabau", "minangkabau"},
- {"mis", null, "Miscellaneous languages", "diverses, langues"},
- {"mac", "mk", "Macedonian", "mac\xE9donien"},
- {"mkh", null, "Mon-Khmer (Other)", "m\xF4n-khmer, autres langues"},
- {"mlg", "mg", "Malagasy", "malgache"},
- {"mlt", "mt", "Maltese", "maltais"},
- {"mnc", null, "Manchu", "mandchou"},
- {"mni", null, "Manipuri", "manipuri"},
- {"mno", null, "Manobo languages", " manobo, langues"},
- {"moh", null, "Mohawk", "mohawk"},
- {"mol", "mo", "Moldavian", "moldave"},
- {"mon", "mn", "Mongolian", "mongol"},
- {"mos", null, "Mossi", "mor\xE9"},
- {"mao", "mi", "Maori", "maori"},
- {"may", "ms", "Malay", "malais"},
- {"mul", null, "Multiple languages", "multilingue"},
- {"mun", null, "Munda languages", "mounda, langues"},
- {"mus", null, "Creek", "muskogee"},
- {"mwl", null, "Mirandese", "mirandais"},
- {"mwr", null, "Marwari", "marvari"},
- {"bur", "my", "Burmese", "birman"},
- {"myn", null, "Mayan languages", "maya, langues"},
- {"myv", null, "Erzya", "erza"},
- {"nah", null, "Nahuatl", "nahuatl"},
- {"nai", null, "North American Indian",
- "indiennes d'Am\xE9rique du Nord, autres langues"},
- {"nap", null, "Neapolitan", "napolitain"},
- {"nau", "na", "Nauru", "nauruan"},
- {"nav", "nv", "Navajo; Navaho", "navaho"},
- {"nbl", "nr", "Ndebele, South; South Ndebele", "nd\xE9b\xE9l\xE9 du Sud"},
- {"nde", "nd", "Ndebele, North; North Ndebele", "nd\xE9b\xE9l\xE9 du Nord"},
- {"ndo", "ng", "Ndonga", "ndonga"},
- {"nds", null, "Low German; Low Saxon; German, Low; Saxon, Low",
- "bas allemand; bas saxon; allemand, bas; saxon, bas"},
- {"nep", "ne", "Nepali", "n\xE9palais"},
- {"new", null, "Newari; Nepal Bhasa", "newari; nepal bhasa"},
- {"nia", null, "Nias", "nias"},
- {"nic", null, "Niger-Kordofanian (Other)",
- "nig\xE9ro-congolaises, autres langues"},
- {"niu", null, "Niuean", "niu\xE9"},
- {"dut", "nl", "Dutch; Flemish", "n\xE9erlandais; flamand"},
- {"nno", "nn", "Norwegian Nynorsk; Nynorsk, Norwegian",
- "norv\xE9gien nynorsk; nynorsk, norv\xE9gien"},
- {"nob", "nb", "Norwegian Bokm\xE5l; Bokm\xE5l, Norwegian",
- "norv\xE9gien bokm\xE5l; bokm\xE5l, norv\xE9gien"},
- {"nog", null, "Nogai", "noga\xEF; nogay"},
- {"non", null, "Norse, Old", "norrois, vieux"},
- {"nor", "no", "Norwegian", "norv\xE9gien"},
- {"nqo", null, "N'ko", "n'ko"},
- {"nso", null, "Northern Sotho, Pedi; Sepedi",
- "sotho du Nord; pedi; sepedi"},
- {"nub", null, "Nubian languages", "nubiennes, langues"},
- {"nwc", null, "Classical Newari; Old Newari; Classical Nepal",
- "Bhasa newari classique"},
- {"nya", "ny", "Chichewa; Chewa; Nyanja", "chichewa; chewa; nyanja"},
- {"nym", null, "Nyamwezi", "nyamwezi"},
- {"nyn", null, "Nyankole", "nyankol\xE9"},
- {"nyo", null, "Nyoro", "nyoro"},
- {"nzi", null, "Nzima", "nzema"},
- {"oci", "oc", "Occitan (post 1500); Proven\xE7al",
- "occitan (apr\xE8s 1500); proven\xE7al"},
- {"oji", "oj", "Ojibwa", "ojibwa"},
- {"ori", "or", "Oriya", "oriya"},
- {"orm", "om", "Oromo", "galla"},
- {"osa", null, "Osage", "osage"},
- {"oss", "os", "Ossetian; Ossetic", "oss\xE8te"},
- {"ota", null, "Turkish, Ottoman (1500-1928)",
- "turc ottoman (1500-1928)"},
- {"oto", null, "Otomian languages", "otomangue, langues"},
- {"paa", null, "Papuan (Other)", "papoues, autres langues"},
- {"pag", null, "Pangasinan", "pangasinan"},
- {"pal", null, "Pahlavi", "pahlavi"},
- {"pam", null, "Pampanga", "pampangan"},
- {"pan", "pa", "Panjabi; Punjabi", "pendjabi"},
- {"pap", null, "Papiamento", "papiamento"},
- {"pau", null, "Palauan", "palau"},
- {"peo", null, "Persian, Old (ca.600-400 B.C.)",
- "perse, vieux (ca. 600-400 av. J.-C.)"},
- {"per", "fa", "Persian", "persan"},
- {"phi", null, "Philippine (Other)", "philippines, autres langues"},
- {"phn", null, "Phoenician", "ph\xE9nicien"},
- {"pli", "pi", "Pali", "pali"},
- {"pol", "pl", "Polish", "polonais"},
- {"pon", null, "Pohnpeian", "pohnpei"},
- {"por", "pt", "Portuguese", "portugais"},
- {"pra", null, "Prakrit languages", "pr\xE2krit"},
- {"pro", null, "Proven\xE7al, Old (to 1500)",
- "proven\xE7al ancien (jusqu'\xE0 1500)"},
- {"pus", "ps", "Pushto", "pachto"},
- {"que", "qu", "Quechua", "quechua"},
- {"raj", null, "Rajasthani", "rajasthani"},
- {"rap", null, "Rapanui", "rapanui"},
- {"rar", null, "Rarotongan", "rarotonga"},
- {"roa", null, "Romance (Other)", "romanes, autres langues"},
- {"roh", "rm", "Raeto-Romance", "rh\xE9to-roman"},
- {"rom", null, "Romany", "tsigane"},
- {"rum", "ro", "Romanian", "roumain"},
- {"run", "rn", "Rundi", "rundi"},
- {"rup", null, "Aromanian; Arumanian; Macedo-Romanian",
- "aroumain; mac\xE9do-roumain"},
- {"rus", "ru", "Russian", "russe"},
- {"sad", null, "Sandawe", "sandawe"},
- {"sag", "sg", "Sango", "sango"},
- {"sah", null, "Yakut", "iakoute"},
- {"sai", null, "South American Indian (Other)",
- "indiennes d'Am\xE9rique du Sud autres langues"},
- {"sal", null, "Salishan languages", "salish, langues"},
- {"sam", null, "Samaritan Aramaic", "samaritain"},
- {"san", "sa", "Sanskrit", "sanskrit"},
- {"sas", null, "Sasak", "sasak"},
- {"sat", null, "Santali", "santal"},
- {"scc", "sr", "Serbian", "serbe"},
- {"scn", null, "Sicilian", "sicilien"},
- {"sco", null, "Scots", "\xE9cossais"},
- {"scr", "hr", "Croatian", "croate"},
- {"sel", null, "Selkup", "selkoupe"},
- {"sem", null, "Semitic (Other)", "s\xE9mitiques, autres langues"},
- {"sga", null, "Irish, Old (to 900)",
- "irlandais ancien (jusqu'\xE0 900)"},
- {"sgn", null, "Sign Languages", "langues des signes"},
- {"shn", null, "Shan", "chan"},
- {"sid", null, "Sidamo", "sidamo"},
- {"sin", "si", "Sinhala; Sinhalese", "singhalais"},
- {"sio", null, "Siouan languages", "sioux, langues"},
- {"sit", null, "Sino-Tibetan (Other)",
- "sino-tib\xE9taines, autres langues"},
- {"sla", null, "Slavic (Other)", "slaves, autres langues"},
- {"slo", "sk", "Slovak", "slovaque"},
- {"slv", "sl", "Slovenian", "slov\xE8ne"},
- {"sma", null, "Southern Sami", "sami du Sud"},
- {"sme", "se", "Northern Sami", "sami du Nord"},
- {"smi", null, "Sami languages (Other)", "sami, autres langues"},
- {"smj", null, "Lule Sami", "sami de Lule"},
- {"smn", null, "Inari Sami", "sami d'Inari"},
- {"smo", "sm", "Samoan", "samoan"},
- {"sms", null, "Skolt Sami", "sami skolt"},
- {"sna", "sn", "Shona", "shona"},
- {"snd", "sd", "Sindhi", "sindhi"},
- {"snk", null, "Soninke", "sonink\xE9"},
- {"sog", null, "Sogdian", "sogdien"},
- {"som", "so", "Somali", "somali"},
- {"son", null, "Songhai", "songhai"},
- {"sot", "st", "Sotho, Southern", "sotho du Sud"},
- {"spa", "es", "Spanish; Castilian", "espagnol; castillan"},
- {"alb", "sq", "Albanian", "albanais"},
- {"srd", "sc", "Sardinian", "sarde"},
- {"srn", null, "Sranan Togo", "sranan togo"},
- {"scc", "sr", "Serbian", "serbe"},
- {"srr", null, "Serer", "s\xE9r\xE8re"},
- {"ssa", null, "Nilo-Saharan (Other)",
- "nilo-sahariennes, autres langues"},
- {"ssw", "ss", "Swati", "swati"},
- {"suk", null, "Sukuma", "sukuma"},
- {"sun", "su", "Sundanese", "soundanais"},
- {"sus", null, "Susu", "soussou"},
- {"sux", null, "Sumerian", "sum\xE9rien"},
- {"swa", "sw", "Swahili", "swahili"},
- {"swe", "sv", "Swedish", "su\xE9dois"},
- {"syr", null, "Syriac", "syriaque"},
- {"tah", "ty", "Tahitian", "tahitien"},
- {"tai", null, "Tai (Other)", "tha\xEFes, autres langues"},
- {"tam", "ta", "Tamil", "tamoul"},
- {"tat", "tt", "Tatar", "tatar"},
- {"tel", "te", "Telugu", "t\xE9lougou"},
- {"tem", null, "Timne", "temne"},
- {"ter", null, "Tereno", "tereno"},
- {"tet", null, "Tetum", "tetum"},
- {"tgk", "tg", "Tajik", "tadjik"},
- {"tgl", "tl", "Tagalog", "tagalog"},
- {"tha", "th", "Thai", "tha\xEF"},
- {"tib", "bo", "Tibetan", "tib\xE9tain"},
- ...
[truncated message content] |
|
From: <vic...@us...> - 2007-04-26 16:52:26
|
Revision: 9275
http://svn.sourceforge.net/foray/?rev=9275&view=rev
Author: victormote
Date: 2007-04-26 09:49:24 -0700 (Thu, 26 Apr 2007)
Log Message:
-----------
Conform to axsl changes using new typesafe enum for script codes.
Modified Paths:
--------------
trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java
Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java
===================================================================
--- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2007-04-26 14:15:25 UTC (rev 9274)
+++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2007-04-26 16:49:24 UTC (rev 9275)
@@ -33,6 +33,7 @@
import org.axsl.common.value.AbsoluteAxis;
import org.axsl.common.value.Baseline;
+import org.axsl.common.value.Iso15924;
import org.axsl.fontR.Font;
import org.apache.commons.logging.Log;
@@ -470,7 +471,7 @@
/**
* {@inheritDoc}
*/
- public Baseline baseline(final String script) {
+ public Baseline baseline(final Iso15924 script) {
/* TODO: Fix this. */
return Baseline.ALPHABETIC;
}
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-26 14:15:25 UTC (rev 9274)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FObj.java 2007-04-26 16:49:24 UTC (rev 9275)
@@ -55,6 +55,7 @@
import org.axsl.common.value.Float;
import org.axsl.common.value.ForcePageCount;
import org.axsl.common.value.HyphenationKeep;
+import org.axsl.common.value.Iso15924;
import org.axsl.common.value.Iso3166;
import org.axsl.common.value.Iso639;
import org.axsl.common.value.LeaderAlignment;
@@ -2212,7 +2213,7 @@
switch (rawValue) {
case AUTO: {
if (this.isBlockLevelFO()) {
- final String script = this.traitScript(context);
+ final Iso15924 script = this.traitScript(context);
final WritingMode writingMode = this.getWritingMode(context);
if (script.equals("auto")) {
if (writingMode.getAbsoluteAxis(
@@ -2282,7 +2283,7 @@
*/
private Baseline getBaselineFromScript(final FoContext context) {
final Font font = this.getPrimaryFont(context).getFont();
- final String script = this.traitScript(context);
+ final Iso15924 script = this.traitScript(context);
return font.baseline(script);
}
@@ -3391,11 +3392,33 @@
/**
* {@inheritDoc}
*/
- public String traitScript(final FoContext context) {
- return propertyList.traitScript(context);
+ public Iso15924 traitScript(final FoContext context) {
+ final String script = propertyList.traitScript(context);
+ if ("auto".equals(script)) {
+ return getAutoScript();
+ }
+ if ("none".equals(script)) {
+ return Iso15924.UNDETERMINED;
+ }
+ final Iso15924 iso15924 = Iso15924.findFromAlpha(script);
+ if (iso15924 == null) {
+ return Iso15924.UNDETERMINED;
+ } else {
+ return iso15924;
+ }
}
/**
+ * Computes the script to be used for this object based on its content.
+ * @return The content-based script for this object.
+ */
+ protected Iso15924 getAutoScript() {
+ /*TODO: This is incorrect. See XSL-FO 1.1, Section 7.10.3 for the
+ * algorithm. */
+ return Iso15924.UNDETERMINED;
+ }
+
+ /**
* Converts an {@link FoValue} switch-to value to the more
* generic {@link SwitchTo} value.
* @param foSwitchTo The raw FO switch-to to be converted.
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java 2007-04-26 14:15:25 UTC (rev 9274)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Script.java 2007-04-26 16:49:24 UTC (rev 9275)
@@ -129,7 +129,7 @@
final FObj fobj) {
final FObj parent = fobj.effectiveParent(context);
if (parent != null) {
- return parent.traitScript(context);
+ return parent.getPropertyList().traitScript(context);
}
return SCRIPT_AUTO;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|