[FOray-commit] SF.net SVN: foray: [8563] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-01-31 23:44:27
|
Revision: 8563
http://svn.sourceforge.net/foray/?rev=8563&view=rev
Author: victormote
Date: 2007-01-31 15:44:27 -0800 (Wed, 31 Jan 2007)
Log Message:
-----------
Conform to axsl changes for converting an enumeration to a typesafe enum.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.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/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/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/Indent.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/Padding.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageRA.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -35,6 +35,7 @@
import org.axsl.areaW.AreaWException;
import org.axsl.common.AbsoluteAxis;
import org.axsl.common.AbsoluteDirection;
+import org.axsl.common.Compass;
import org.axsl.common.FoValue;
import org.axsl.common.RelativeAxis;
import org.axsl.foR.FObj;
@@ -444,7 +445,7 @@
* computation. It is possible, for example, that landscape pages should
* be bound at the top/bottom instead of left/right.
*/
- public short getBindingEdge() {
+ public Compass getBindingEdge() {
// If it is an even-numbered page, binding is on the right.
if (this.getNumber() % 2 == 0) {
return getWritingMode().getRight();
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/PropertyList.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -346,7 +346,7 @@
* @return The margin value, in millipoints.
*/
public int getAbsoluteMargin(final FOContext context,
- final byte absoluteDirection, final int widthContainingBlock) {
+ final Compass absoluteDirection, final int widthContainingBlock) {
// Try the specific property first (e.g. "margin-top")
final short propertyType = Margin.rawPropertyType(absoluteDirection);
Margin property = (Margin) getProperty(propertyType);
@@ -373,8 +373,8 @@
* @return True if the property (or a shorthand) exists, false otherwise.
*/
private boolean correspondingMarginExists(final FOContext context,
- final byte relativeDirection) {
- final byte absoluteDirection = getWritingMode(context)
+ final Compass relativeDirection) {
+ final Compass absoluteDirection = getWritingMode(context)
.getAbsoluteDirection(relativeDirection);
final short propertyType = Margin.rawPropertyType(absoluteDirection);
Margin marginProperty = (Margin) getProperty(propertyType);
@@ -513,7 +513,7 @@
* a percentage.
* @return The start-indent value, in millipoints.
*/
- public int getIndent(final FOContext context, final byte direction,
+ public int getIndent(final FOContext context, final Compass direction,
final int ipdContainingRA) {
Indent indent = null;
final short rawPropertyType = Indent.rawPropertyType(direction);
@@ -1318,7 +1318,7 @@
}
public int getAbsoluteOffset(final FOContext context,
- final byte absoluteDirection,
+ final Compass absoluteDirection,
final int dimensionContainingBlock) {
final short propertyType = AbsoluteOffset.rawPropertyName(
absoluteDirection);
@@ -1811,7 +1811,7 @@
}
public java.awt.Color getBorderColor(final FOContext context,
- final byte direction) {
+ final Compass direction) {
BorderColor borderColor = null;
// Try the most explicit setting first, e.g "border-top-color"
short rawPropertyType = BorderColor.rawPropertyType(direction);
@@ -1828,8 +1828,8 @@
}
}
if (borderColor == null) {
- final int otherDirection = getWritingMode(context).getCorresponding(
- direction);
+ final Compass otherDirection = getWritingMode(
+ context).getCorresponding(direction);
rawPropertyType = BorderColor.rawPropertyType(otherDirection);
borderColor = (BorderColor) getProperty(rawPropertyType);
}
@@ -1839,7 +1839,8 @@
return borderColor.getValue(direction, fobj);
}
- public short getBorderStyle(final FOContext context, final byte direction) {
+ public short getBorderStyle(final FOContext context,
+ final Compass direction) {
BorderStyle borderStyle = null;
// Try the most explicit setting first, e.g "border-top-style"
short rawPropertyType = BorderStyle.rawPropertyType(direction);
@@ -1853,12 +1854,12 @@
final Border border = (Border) getProperty(FoProperty.BORDER);
if (border != null) {
//TODO: This needs to adjust the direction
- borderStyle = border.getBorderStyle(direction);
+ borderStyle = border.getBorderStyle();
}
}
if (borderStyle == null) {
- final int otherDirection = getWritingMode(context).getCorresponding(
- direction);
+ final Compass otherDirection = getWritingMode(
+ context).getCorresponding(direction);
rawPropertyType = BorderStyle.rawPropertyType(otherDirection);
borderStyle = (BorderStyle) getProperty(rawPropertyType);
}
@@ -1877,7 +1878,7 @@
* width is computed "is-last" in the reference area.
* @return The width, in millipoints, of the border.
*/
- public int getBorderWidth(final FOContext context, final byte direction,
+ public int getBorderWidth(final FOContext context, final Compass direction,
final boolean isOuterEdge) {
// If the border-style is "none", the width is zero
if (getBorderStyle(context, direction) == FoValue.NONE) {
@@ -1899,8 +1900,8 @@
}
}
if (borderWidth == null) {
- final int otherDirection = getWritingMode(context).getCorresponding(
- direction);
+ final Compass otherDirection = getWritingMode(
+ context).getCorresponding(direction);
rawPropertyType = BorderWidth.rawPropertyType(otherDirection);
borderWidth = (BorderWidth) getProperty(rawPropertyType);
}
@@ -1919,7 +1920,7 @@
* width is computed "is-last" in the reference area.
* @return The width, in millipoints, of the padding.
*/
- public int getPadding(final FOContext context, final byte direction,
+ public int getPadding(final FOContext context, final Compass direction,
final boolean isOuterEdge) {
Padding padding = null;
// Try the most explicit setting first, e.g "padding-top"
@@ -1931,8 +1932,8 @@
}
if (padding == null) {
// Now try the corresponding direction
- final int otherDirection = getWritingMode(context).getCorresponding(
- direction);
+ final Compass otherDirection = getWritingMode(
+ context).getCorresponding(direction);
rawPropertyType = Padding.rawPropertyType(otherDirection);
padding = (Padding) getProperty(rawPropertyType);
}
@@ -2885,7 +2886,7 @@
}
public int getBorderPrecedence(final FOContext context,
- final byte direction) {
+ final Compass direction) {
final short propertyType = BorderPrecedence.getPropertyType(direction);
final BorderPrecedence property = (BorderPrecedence)
getProperty(propertyType);
@@ -2959,13 +2960,13 @@
public double traitPauseBefore(final FOContext context) {
Pause property = (Pause) getProperty(FoProperty.PAUSE_BEFORE);
if (property != null) {
- return property.getValue(context, fobj, Compass.BEFORE);
+ return property.getValue(context, fobj, FoProperty.PAUSE_BEFORE);
}
// Try the shorthand
property = (Pause) getProperty(FoProperty.PAUSE);
if (property != null) {
return property.getShorthandValue(context, fobj,
- Compass.BEFORE);
+ FoProperty.PAUSE_BEFORE);
}
return Pause.getValueNoInstance();
}
@@ -2973,13 +2974,13 @@
public double traitPauseAfter(final FOContext context) {
Pause property = (Pause) getProperty(FoProperty.PAUSE_AFTER);
if (property != null) {
- return property.getValue(context, fobj, Compass.AFTER);
+ return property.getValue(context, fobj, FoProperty.PAUSE_AFTER);
}
// Try the shorthand
property = (Pause) getProperty(FoProperty.PAUSE);
if (property != null) {
return property.getShorthandValue(context, fobj,
- Compass.AFTER);
+ FoProperty.PAUSE_AFTER);
}
return Pause.getValueNoInstance();
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/AbsoluteOffset.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -126,21 +126,19 @@
* @param direction One of the absolute directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyName(final int direction) {
- switch (direction) {
- case Compass.TOP: {
+ public static short rawPropertyName(final Compass direction) {
+ if (direction == Compass.TOP) {
return FoProperty.TOP;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return FoProperty.BOTTOM;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return FoProperty.LEFT;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return FoProperty.RIGHT;
}
- }
return 0;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Border.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -130,7 +130,7 @@
return null;
}
- public BorderStyle getBorderStyle(final byte absoluteDirection) {
+ public BorderStyle getBorderStyle() {
if (! (value() instanceof PropertyCollection)) {
return null;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderColor.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -105,7 +105,7 @@
return collection;
}
- public Color getValue(final byte direction, final FObj fobj) {
+ public Color getValue(final Compass direction, final FObj fobj) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(direction, fobj);
}
@@ -115,7 +115,7 @@
return getValueNoInstance();
}
- private Color getCollectionValue(final byte direction, final FObj fobj) {
+ private Color getCollectionValue(final Compass direction, final FObj fobj) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
direction);
@@ -132,36 +132,32 @@
* @param direction One of the directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyType(final int direction) {
- switch (direction) {
- case Compass.BEFORE: {
+ public static short rawPropertyType(final Compass direction) {
+ if (direction == Compass.BEFORE) {
return FoProperty.BORDER_BEFORE_COLOR;
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return FoProperty.BORDER_AFTER_COLOR;
}
- case Compass.START: {
+ if (direction == Compass.START) {
return FoProperty.BORDER_START_COLOR;
}
- case Compass.END: {
+ if (direction == Compass.END) {
return FoProperty.BORDER_END_COLOR;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return FoProperty.BORDER_LEFT_COLOR;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return FoProperty.BORDER_RIGHT_COLOR;
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return FoProperty.BORDER_TOP_COLOR;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return FoProperty.BORDER_BOTTOM_COLOR;
}
- default: {
- return 0;
- }
- }
+ return 0;
}
protected short[] getValidKeywords() {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderPrecedence.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -98,7 +98,7 @@
}
public int getValue(final FOContext context, final FObj fobj,
- final byte direction) {
+ final Compass direction) {
if (value() instanceof DtInteger) {
return ((DtInteger) value()).getValue();
}
@@ -111,20 +111,18 @@
case FoValue.INHERIT: {
final FObj parent = fobj.effectiveParent(context);
if (parent != null) {
- switch (direction) {
- case Compass.BEFORE: {
+ if (direction == Compass.BEFORE) {
return parent.traitBorderBeforePrecedence(context);
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return parent.traitBorderAfterPrecedence(context);
}
- case Compass.START: {
+ if (direction == Compass.START) {
return parent.traitBorderStartPrecedence(context);
}
- case Compass.END: {
+ if (direction == Compass.END) {
return parent.traitBorderEndPrecedence(context);
}
- }
}
}
}
@@ -155,21 +153,19 @@
return VALID_KEYWORDS;
}
- public static short getPropertyType(final byte direction) {
- switch (direction) {
- case Compass.BEFORE: {
+ public static short getPropertyType(final Compass direction) {
+ if (direction == Compass.BEFORE) {
return FoProperty.BORDER_BEFORE_PRECEDENCE;
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return FoProperty.BORDER_AFTER_PRECEDENCE;
}
- case Compass.START: {
+ if (direction == Compass.START) {
return FoProperty.BORDER_START_PRECEDENCE;
}
- case Compass.END: {
+ if (direction == Compass.END) {
return FoProperty.BORDER_END_PRECEDENCE;
}
- }
return 0;
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderStyle.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -121,7 +121,7 @@
return collection;
}
- public short getValue(final FOContext context, final byte direction,
+ public short getValue(final FOContext context, final Compass direction,
final FObj fobj) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(context, direction, fobj);
@@ -131,37 +131,35 @@
return keyword;
}
final FObj effectiveParent = fobj.effectiveParent(context);
- switch (direction) {
- case Compass.BEFORE: {
+ if (direction == Compass.BEFORE) {
return effectiveParent.traitBorderBeforeStyle(context);
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return effectiveParent.traitBorderAfterStyle(context);
}
- case Compass.START: {
+ if (direction == Compass.START) {
return effectiveParent.traitBorderStartStyle(context);
}
- case Compass.END: {
+ if (direction == Compass.END) {
return effectiveParent.traitBorderEndStyle(context);
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return effectiveParent.traitBorderLeftStyle(context);
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return effectiveParent.traitBorderRightStyle(context);
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return effectiveParent.traitBorderTopStyle(context);
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return effectiveParent.traitBorderBottomStyle(context);
}
- }
return getValueNoInstance();
}
private short getCollectionValue(final FOContext context,
- final byte direction, final FObj fobj) {
+ final Compass direction, final FObj fobj) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
direction);
@@ -178,36 +176,32 @@
* @param direction One of the directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyType(final int direction) {
- switch (direction) {
- case Compass.BEFORE: {
+ public static short rawPropertyType(final Compass direction) {
+ if (direction == Compass.BEFORE) {
return FoProperty.BORDER_BEFORE_STYLE;
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return FoProperty.BORDER_AFTER_STYLE;
}
- case Compass.START: {
+ if (direction == Compass.START) {
return FoProperty.BORDER_START_STYLE;
}
- case Compass.END: {
+ if (direction == Compass.END) {
return FoProperty.BORDER_END_STYLE;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return FoProperty.BORDER_LEFT_STYLE;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return FoProperty.BORDER_RIGHT_STYLE;
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return FoProperty.BORDER_TOP_STYLE;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return FoProperty.BORDER_BOTTOM_STYLE;
}
- default: {
- return 0;
- }
- }
+ return 0;
}
protected short[] getValidKeywords() {
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-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/BorderWidth.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -120,7 +120,7 @@
return collection;
}
- public int getValue(final FOContext context, final byte direction,
+ public int getValue(final FOContext context, final Compass direction,
final FObj fobj, final boolean isOuterEdge) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(context, direction, fobj, isOuterEdge);
@@ -133,8 +133,7 @@
return Math.max(length, 0);
}
if (value() instanceof DtLengthConditional
- && direction >= Compass.START
- && direction <= Compass.AFTER) {
+ && direction.isRelative()) {
final DtLengthConditional lengthConditional
= (DtLengthConditional) value();
/*
@@ -162,7 +161,8 @@
}
private int getCollectionValue(final FOContext context,
- final byte direction, final FObj fobj, final boolean isOuterEdge) {
+ final Compass direction, final FObj fobj,
+ final boolean isOuterEdge) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
direction);
@@ -172,7 +172,8 @@
isOuterEdge);
}
- private int getKeywordValue(final FOContext context, final byte direction,
+ private int getKeywordValue(final FOContext context,
+ final Compass direction,
final FObj fobj, final boolean isOuterEdge) {
final PropertyKeyword kw = (PropertyKeyword) value();
switch (kw.getValue()) {
@@ -187,36 +188,34 @@
}
case FoValue.INHERIT: {
final FObj effectiveParent = fobj.effectiveParent(context);
- switch (direction) {
- case Compass.BEFORE: {
+ if (direction == Compass.BEFORE) {
return effectiveParent.traitBorderBeforeWidth(context,
isOuterEdge);
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return effectiveParent.traitBorderAfterWidth(context,
isOuterEdge);
}
- case Compass.START: {
+ if (direction == Compass.START) {
return effectiveParent.traitBorderStartWidth(context,
isOuterEdge);
}
- case Compass.END: {
+ if (direction == Compass.END) {
return effectiveParent.traitBorderEndWidth(context,
isOuterEdge);
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return effectiveParent.traitBorderLeftWidth(context);
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return effectiveParent.traitBorderRightWidth(context);
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return effectiveParent.traitBorderTopWidth(context);
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return effectiveParent.traitBorderBottomWidth(context);
}
- }
}
}
return getValueNoInstance();
@@ -230,36 +229,32 @@
* @param direction One of the directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyType(final int direction) {
- switch (direction) {
- case Compass.BEFORE: {
+ public static short rawPropertyType(final Compass direction) {
+ if (direction == Compass.BEFORE) {
return FoProperty.BORDER_BEFORE_WIDTH;
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return FoProperty.BORDER_AFTER_WIDTH;
}
- case Compass.START: {
+ if (direction == Compass.START) {
return FoProperty.BORDER_START_WIDTH;
}
- case Compass.END: {
+ if (direction == Compass.END) {
return FoProperty.BORDER_END_WIDTH;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return FoProperty.BORDER_LEFT_WIDTH;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return FoProperty.BORDER_RIGHT_WIDTH;
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return FoProperty.BORDER_TOP_WIDTH;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return FoProperty.BORDER_BOTTOM_WIDTH;
}
- default: {
- return 0;
- }
- }
+ return 0;
}
protected short[] getValidKeywords() {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Indent.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -92,7 +92,7 @@
}
public int getValue(final FOContext context, final FObj fobj,
- final byte direction, final int ipdContainingRA) {
+ final Compass direction, final int ipdContainingRA) {
if (value() instanceof PropertyKeyword) {
final short keyword = ((PropertyKeyword) value()).getValue();
if (keyword == FoValue.INHERIT) {
@@ -125,7 +125,8 @@
}
public static int getValueNoInstance(final FOContext context,
- final FObj fobj, final byte direction, final int ipdContainingRA) {
+ final FObj fobj, final Compass direction,
+ final int ipdContainingRA) {
final FObj parent = fobj.effectiveParent(context);
if (parent == null) {
return 0;
@@ -138,18 +139,14 @@
* @param direction One of the directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyType(final int direction) {
- switch (direction) {
- case Compass.START: {
+ public static short rawPropertyType(final Compass direction) {
+ if (direction == Compass.START) {
return FoProperty.START_INDENT;
}
- case Compass.END: {
+ if (direction == Compass.END) {
return FoProperty.END_INDENT;
}
- default: {
- return 0;
- }
- }
+ return 0;
}
protected short[] getValidKeywords() {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Margin.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -105,7 +105,7 @@
return collection;
}
- public int getValue(final FOContext context, final byte direction,
+ public int getValue(final FOContext context, final Compass direction,
final FObj fobj, final int widthContainingBlock) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(context, direction, fobj,
@@ -136,7 +136,7 @@
}
private int getCollectionValue(final FOContext context,
- final byte direction, final FObj fobj,
+ final Compass direction, final FObj fobj,
final int widthContainingBlock) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
@@ -147,54 +147,51 @@
widthContainingBlock);
}
- private int getKeywordValue(final FOContext context, final byte direction,
+ private int getKeywordValue(final FOContext context,
+ final Compass direction,
final FObj fobj, final int widthContainingBlock) {
final PropertyKeyword kw = (PropertyKeyword) value();
switch (kw.getValue()) {
case FoValue.INHERIT: {
final FObj effectiveParent = fobj.effectiveParent(context);
- switch (direction) {
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return effectiveParent.getMarginLeft(context,
widthContainingBlock);
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return effectiveParent.getMarginRight(
context, widthContainingBlock);
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return effectiveParent.getMarginTop(context,
widthContainingBlock);
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return effectiveParent.getMarginBottom(context,
widthContainingBlock);
}
- }
}
case FoValue.AUTO: {
- switch (direction) {
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
/* TODO: This needs to conform to the CSS2 Spec, Section 10.3.
*/
return 0;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
/* TODO: This needs to conform to the CSS2 Spec, Section 10.3.
*/
return 0;
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
/* TODO: This needs to conform to the CSS2 Spec, Section 10.6.
*/
return 0;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
/* TODO: This needs to conform to the CSS2 Spec, Section 10.6.
*/
return 0;
}
- }
}
}
return getValueNoInstance();
@@ -212,21 +209,19 @@
* @param direction One of the absolute directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyType(final int direction) {
- switch (direction) {
- case Compass.TOP: {
+ public static short rawPropertyType(final Compass direction) {
+ if (direction == Compass.TOP) {
return FoProperty.MARGIN_TOP;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return FoProperty.MARGIN_BOTTOM;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return FoProperty.MARGIN_LEFT;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return FoProperty.MARGIN_RIGHT;
}
- }
return 0;
}
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-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/Padding.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -112,7 +112,7 @@
return collection;
}
- public int getValue(final FOContext context, final byte direction,
+ public int getValue(final FOContext context, final Compass direction,
final FObj fobj, final boolean isOuterEdge) {
if (value() instanceof PropertyCollection) {
return getCollectionValue(context, direction, fobj, isOuterEdge);
@@ -125,8 +125,7 @@
return Math.max(length, 0);
}
if (value() instanceof DtLengthConditional
- && direction >= Compass.START
- && direction <= Compass.AFTER) {
+ && direction.isRelative()) {
final DtLengthConditional lengthConditional
= (DtLengthConditional) value();
/*
@@ -154,7 +153,8 @@
}
private int getCollectionValue(final FOContext context,
- final byte direction, final FObj fobj, final boolean isOuterEdge) {
+ final Compass direction, final FObj fobj,
+ final boolean isOuterEdge) {
final PropertyCollection collection = (PropertyCollection) value();
final int whichElement = collection.whichElementForDirectional(
direction);
@@ -163,38 +163,37 @@
return paddingProperty.getValue(context, direction, fobj, isOuterEdge);
}
- private int getKeywordValue(final FOContext context, final byte direction,
+ private int getKeywordValue(final FOContext context,
+ final Compass direction,
final FObj fobj, final boolean isOuterEdge) {
final PropertyKeyword kw = (PropertyKeyword) value();
final FObj effectiveParent = fobj.effectiveParent(context);
switch (kw.getValue()) {
case FoValue.INHERIT: {
- switch (direction) {
- case Compass.BEFORE: {
+ if (direction == Compass.BEFORE) {
return effectiveParent.traitPaddingBefore(context, isOuterEdge);
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return effectiveParent.traitPaddingAfter(context, isOuterEdge);
}
- case Compass.START: {
+ if (direction == Compass.START) {
return effectiveParent.traitPaddingStart(context, isOuterEdge);
}
- case Compass.END: {
+ if (direction == Compass.END) {
return effectiveParent.traitPaddingEnd(context, isOuterEdge);
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return effectiveParent.traitPaddingLeft(context);
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return effectiveParent.traitPaddingRight(context);
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return effectiveParent.traitPaddingTop(context);
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return effectiveParent.traitPaddingBottom(context);
}
- }
}
}
return getValueNoInstance();
@@ -208,36 +207,32 @@
* @param direction One of the directional constants.
* @return String representation of the raw property name.
*/
- public static short rawPropertyType(final int direction) {
- switch (direction) {
- case Compass.BEFORE: {
+ public static short rawPropertyType(final Compass direction) {
+ if (direction == Compass.BEFORE) {
return FoProperty.PADDING_BEFORE;
}
- case Compass.AFTER: {
+ if (direction == Compass.AFTER) {
return FoProperty.PADDING_AFTER;
}
- case Compass.START: {
+ if (direction == Compass.START) {
return FoProperty.PADDING_START;
}
- case Compass.END: {
+ if (direction == Compass.END) {
return FoProperty.PADDING_END;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return FoProperty.PADDING_LEFT;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return FoProperty.PADDING_RIGHT;
}
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return FoProperty.PADDING_TOP;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return FoProperty.PADDING_BOTTOM;
}
- default: {
- return 0;
- }
- }
+ return 0;
}
protected short[] getValidKeywords() {
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/fo/prop/RelativeSpace.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -105,7 +105,8 @@
throw unexpectedValue(value, propertyList);
}
- public int getValue(final FOContext context, final byte relativeDirection,
+ public int getValue(final FOContext context,
+ final Compass relativeDirection,
final int subProperty, final FObj fobj,
final int ipdAncestorBlockArea) {
if (value() instanceof DtSpace) {
@@ -149,10 +150,9 @@
}
private int getValueInherited(final FOContext context,
- final byte relativeDirection, final int subProperty,
+ final Compass relativeDirection, final int subProperty,
final FObj fobj, final int ipdAncestorBlockArea) {
- switch (relativeDirection) {
- case Compass.BEFORE: {
+ if (relativeDirection == Compass.BEFORE) {
final FObj effectiveParent = fobj.effectiveParent(context);
switch (subProperty) {
case MINIMUM: {
@@ -169,7 +169,7 @@
}
}
}
- case Compass.AFTER: {
+ if (relativeDirection == Compass.AFTER) {
final FObj effectiveParent = fobj.effectiveParent(context);
switch (subProperty) {
case MINIMUM: {
@@ -186,7 +186,7 @@
}
}
}
- case Compass.START: {
+ if (relativeDirection == Compass.START) {
switch (subProperty) {
case MINIMUM: {
return fobj.effectiveParent(context).traitSpaceStartMinimum(
@@ -205,7 +205,7 @@
}
}
}
- case Compass.END: {
+ if (relativeDirection == Compass.END) {
switch (subProperty) {
case MINIMUM: {
return fobj.effectiveParent(context).traitSpaceEndMinimum(
@@ -224,7 +224,6 @@
}
}
}
- }
return getValueNoInstance();
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/DtWritingMode.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -330,7 +330,7 @@
/**
* {@inheritDoc}
*/
- public byte getStart() {
+ public Compass getStart() {
if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Compass.LEFT;
}
@@ -343,13 +343,13 @@
if (ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Compass.BOTTOM;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getEnd() {
+ public Compass getEnd() {
if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Compass.RIGHT;
}
@@ -362,13 +362,13 @@
if (ipdOdd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Compass.TOP;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getBefore() {
+ public Compass getBefore() {
if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Compass.LEFT;
}
@@ -381,13 +381,13 @@
if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Compass.BOTTOM;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getAfter() {
+ public Compass getAfter() {
if (bpd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Compass.RIGHT;
}
@@ -400,13 +400,13 @@
if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Compass.TOP;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getLeft() {
+ public Compass getLeft() {
if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Compass.START;
}
@@ -420,13 +420,13 @@
if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Compass.AFTER;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getRight() {
+ public Compass getRight() {
if (ipdOdd == AbsoluteDirection.LEFT_TO_RIGHT) {
return Compass.END;
}
@@ -439,13 +439,13 @@
if (bpd == AbsoluteDirection.RIGHT_TO_LEFT) {
return Compass.BEFORE;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getTop() {
+ public Compass getTop() {
if (ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Compass.START;
}
@@ -458,13 +458,13 @@
if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Compass.AFTER;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getBottom() {
+ public Compass getBottom() {
if (ipdOdd == AbsoluteDirection.TOP_TO_BOTTOM) {
return Compass.END;
}
@@ -477,28 +477,26 @@
if (bpd == AbsoluteDirection.BOTTOM_TO_TOP) {
return Compass.BEFORE;
}
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public byte getAbsoluteDirection(final byte relativeDir) {
- switch (relativeDir) {
- case Compass.START: {
+ public Compass getAbsoluteDirection(final Compass relativeDir) {
+ if (relativeDir == Compass.START) {
return getStart();
}
- case Compass.END: {
+ if (relativeDir == Compass.END) {
return getEnd();
}
- case Compass.BEFORE: {
+ if (relativeDir == Compass.BEFORE) {
return getBefore();
}
- case Compass.AFTER: {
+ if (relativeDir == Compass.AFTER) {
return getAfter();
}
- }
- return -1;
+ return Compass.INVALID;
}
/**
@@ -515,55 +513,51 @@
/**
* {@inheritDoc}
*/
- public byte getRelativeDirection(final byte absoluteDir) {
- switch (absoluteDir) {
- case Compass.LEFT: {
+ public Compass getRelativeDirection(final Compass absoluteDir) {
+ if (absoluteDir == Compass.LEFT) {
return getLeft();
}
- case Compass.RIGHT: {
+ if (absoluteDir == Compass.RIGHT) {
return getRight();
}
- case Compass.TOP: {
+ if (absoluteDir == Compass.TOP) {
return getTop();
}
- case Compass.BOTTOM: {
+ if (absoluteDir == Compass.BOTTOM) {
return getBottom();
}
- }
- return -1;
+ return Compass.INVALID;
}
/**
* {@inheritDoc}
*/
- public int getCorresponding(final int inputDirection) {
- switch (inputDirection) {
- case Compass.START: {
+ public Compass getCorresponding(final Compass inputDirection) {
+ if (inputDirection == Compass.START) {
return getStart();
}
- case Compass.END: {
+ if (inputDirection == Compass.END) {
return getEnd();
}
- case Compass.BEFORE: {
+ if (inputDirection == Compass.BEFORE) {
return getBefore();
}
- case Compass.AFTER: {
+ if (inputDirection == Compass.AFTER) {
return getAfter();
}
- case Compass.LEFT: {
+ if (inputDirection == Compass.LEFT) {
return getLeft();
}
- case Compass.RIGHT: {
+ if (inputDirection == Compass.RIGHT) {
return getRight();
}
- case Compass.TOP: {
+ if (inputDirection == Compass.TOP) {
return getTop();
}
- case Compass.BOTTOM: {
+ if (inputDirection == Compass.BOTTOM) {
return getBottom();
}
- }
- return -1;
+ return Compass.INVALID;
}
}
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java 2007-01-31 22:43:38 UTC (rev 8562)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/value/PropertyCollection.java 2007-01-31 23:44:27 UTC (rev 8563)
@@ -104,54 +104,48 @@
* @return The index (starts at 0) to the appropriate element to use for
* the direction given.
*/
- public byte whichElementForDirectional(final byte direction) {
+ public byte whichElementForDirectional(final Compass direction) {
switch (value.size()) {
case SIZE_1: {
return INDEX_0;
}
case SIZE_2: {
- switch (direction) {
- case Compass.TOP:
- case Compass.BOTTOM: {
+ if (direction == Compass.TOP
+ || direction == Compass.BOTTOM) {
return INDEX_0;
}
- case Compass.LEFT:
- case Compass.RIGHT: {
+ if (direction == Compass.LEFT
+ || direction == Compass.RIGHT) {
return INDEX_1;
}
- }
return INDEX_INVALID;
}
case SIZE_3: {
- switch (direction) {
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return INDEX_0;
}
- case Compass.LEFT:
- case Compass.RIGHT: {
+ if (direction == Compass.LEFT
+ || direction == Compass.RIGHT) {
return INDEX_1;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return INDEX_2;
}
- }
return INDEX_INVALID;
}
case SIZE_4: {
- switch (direction) {
- case Compass.TOP: {
+ if (direction == Compass.TOP) {
return INDEX_0;
}
- case Compass.RIGHT: {
+ if (direction == Compass.RIGHT) {
return INDEX_1;
}
- case Compass.BOTTOM: {
+ if (direction == Compass.BOTTOM) {
return INDEX_2;
}
- case Compass.LEFT: {
+ if (direction == Compass.LEFT) {
return INDEX_3;
}
- }
return INDEX_INVALID;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|