pbwest 2004/04/21 08:21:19 Modified: src/java/org/apache/fop/fo/properties Tag: FOP_0-20-0_Alt-Design BorderAfterStyle.java BorderCommonStyleRelative.java BorderEndStyle.java BorderTopStyle.java Property.java BorderLeftStyle.java BorderBeforeStyle.java BorderCommonStyleAbsolute.java AbsoluteCorrespondingProperty.java BorderStartStyle.java BorderCommonStyle.java BorderBottomStyle.java RelativeCorrespondingProperty.java BorderRightStyle.java Added: src/java/org/apache/fop/fo/properties Tag: FOP_0-20-0_Alt-Design CorrespondingProperty.java AbstractCorrespondingProperty.java Log: W.I.P. on corresponding properties Revision Changes Path No revision No revision 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderAfterStyle.java Index: BorderAfterStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderAfterStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderAfterStyle.java 20 Apr 2004 17:15:25 -0000 1.1.2.4 +++ BorderAfterStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingAbsoluteProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingAbsoluteEdge( - getWritingMode(foNode), WritingMode.AFTER); + return getCorrespondingAbsoluteStyleProperty( + foNode, WritingMode.AFTER); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.2 +42 -2 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderCommonStyleRelative.java Index: BorderCommonStyleRelative.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderCommonStyleRelative.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- BorderCommonStyleRelative.java 20 Apr 2004 17:15:26 -0000 1.1.2.1 +++ BorderCommonStyleRelative.java 21 Apr 2004 15:21:18 -0000 1.1.2.2 @@ -43,6 +43,11 @@ PropertyValue wm = foNode.getPropertyValue(PropNames.WRITING_MODE); return EnumType.getEnumValue(wm); } + + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingAbsoluteProperty(foNode); + } /* (non-Javadoc) * @see org.apache.fop.fo.properties.RelativeCorrespondingProperty#getCorrespondingAbsoluteProperty(org.apache.fop.fo.FONode) */ @@ -50,10 +55,45 @@ throws PropertyException { throw new PropertyException("Called from superclass"); } + + /** Array of absolute border style properties, + * indexed by absolute edge constants */ + private static int[] absBorderStyleProps = { + PropNames.NO_PROPERTY + ,PropNames.BORDER_TOP_STYLE + ,PropNames.BORDER_BOTTOM_STYLE + ,PropNames.BORDER_LEFT_STYLE + ,PropNames.BORDER_RIGHT_STYLE + }; + + /** + * Gets the absolute border style property corresponding to the given + * relative edge + * @param foNode the node on which the property is being defined + * @param relativeEdge + * @return the absolute border style property index + * @throws PropertyException + */ + protected int getCorrespondingAbsoluteStyleProperty( + FONode foNode, int relativeEdge) + throws PropertyException { + int absEdge = WritingMode.getCorrespondingAbsoluteEdge( + getWritingMode(foNode), relativeEdge); + return absBorderStyleProps[absEdge]; + } + /* (non-Javadoc) * @see org.apache.fop.fo.properties.RelativeCorrespondingProperty#correspondingOverrides(org.apache.fop.fo.FONode) */ public boolean correspondingOverrides(FONode foNode) { return false; } + + /* (non-Javadoc) + * @see org.apache.fop.fo.properties.Property#isCorrespondingRelative() + */ + public static boolean isCorrespondingRelative() { + return true; + } + } 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderEndStyle.java Index: BorderEndStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderEndStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderEndStyle.java 20 Apr 2004 17:15:26 -0000 1.1.2.4 +++ BorderEndStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingAbsoluteProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingAbsoluteEdge( - getWritingMode(foNode), WritingMode.END); + return getCorrespondingAbsoluteStyleProperty( + foNode, WritingMode.END); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderTopStyle.java Index: BorderTopStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderTopStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderTopStyle.java 20 Apr 2004 17:15:26 -0000 1.1.2.4 +++ BorderTopStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -52,8 +52,8 @@ public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingRelativeEdge( - getWritingMode(foNode), WritingMode.TOP); + return getCorrespondingRelativeStyleProperty( + foNode, WritingMode.TOP); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.11 +21 -3 xml-fop/src/java/org/apache/fop/fo/properties/Property.java Index: Property.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Property.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- Property.java 19 Apr 2004 15:34:29 -0000 1.1.2.10 +++ Property.java 21 Apr 2004 15:21:18 -0000 1.1.2.11 @@ -246,6 +246,24 @@ public static Map enumHash = null; + /** + * Is this a corresponding absolute property? + * Such properties must override this method. + * @return answer + */ + public static boolean isCorrespondingAbsolute() { + return false; + } + + /** + * Is this a corresponding relative property? + * Such properties must override this method. + * @return answer + */ + public static boolean isCorrespondingRelative() { + return false; + } + public Property() {} /** 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderLeftStyle.java Index: BorderLeftStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderLeftStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderLeftStyle.java 20 Apr 2004 17:15:26 -0000 1.1.2.4 +++ BorderLeftStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingRelativeEdge( - getWritingMode(foNode), WritingMode.LEFT); + return getCorrespondingRelativeStyleProperty( + foNode, WritingMode.LEFT); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderBeforeStyle.java Index: BorderBeforeStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderBeforeStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderBeforeStyle.java 20 Apr 2004 17:15:26 -0000 1.1.2.4 +++ BorderBeforeStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingAbsoluteProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingAbsoluteEdge( - getWritingMode(foNode), WritingMode.BEFORE); + return getCorrespondingAbsoluteStyleProperty( + foNode, WritingMode.BEFORE); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.2 +41 -2 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderCommonStyleAbsolute.java Index: BorderCommonStyleAbsolute.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderCommonStyleAbsolute.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- BorderCommonStyleAbsolute.java 20 Apr 2004 17:15:26 -0000 1.1.2.1 +++ BorderCommonStyleAbsolute.java 21 Apr 2004 15:21:18 -0000 1.1.2.2 @@ -43,6 +43,11 @@ PropertyValue wm = foNode.getPropertyValue(PropNames.WRITING_MODE); return EnumType.getEnumValue(wm); } + + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + return getCorrespondingRelativeProperty(foNode); + } /* (non-Javadoc) * @see org.apache.fop.fo.properties.AbsoluteCorrespondingProperty#getCorrespondingRelativeProperty() */ @@ -50,10 +55,44 @@ throws PropertyException { throw new PropertyException("Called from superclass"); } + + /** Array of relative border style properties, + * indexed by relative edge constants */ + private static int[] relBorderStyleProps = { + PropNames.NO_PROPERTY + ,PropNames.BORDER_BEFORE_STYLE + ,PropNames.BORDER_AFTER_STYLE + ,PropNames.BORDER_START_STYLE + ,PropNames.BORDER_END_STYLE + }; + + /** + * Gets the relative border style property corresponding to the given + * absolute edge + * @param foNode the node on which the property is being defined + * @param absoluteEdge + * @return the relative border style property index + * @throws PropertyException + */ + protected int getCorrespondingRelativeStyleProperty( + FONode foNode, int absoluteEdge) + throws PropertyException { + int relEdge = WritingMode.getCorrespondingRelativeEdge( + getWritingMode(foNode), absoluteEdge); + return relBorderStyleProps[relEdge]; + } + /* (non-Javadoc) * @see org.apache.fop.fo.properties.AbsoluteCorrespondingProperty#overridesCorresponding() */ public boolean overridesCorresponding(FONode foNode) { return false; + } + + /* (non-Javadoc) + * @see org.apache.fop.fo.properties.Property#isCorrespondingAbsolute() + */ + public static boolean isCorrespondingAbsolute() { + return true; } } 1.1.2.2 +4 -5 xml-fop/src/java/org/apache/fop/fo/properties/Attic/AbsoluteCorrespondingProperty.java Index: AbsoluteCorrespondingProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/AbsoluteCorrespondingProperty.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- AbsoluteCorrespondingProperty.java 20 Apr 2004 17:15:27 -0000 1.1.2.1 +++ AbsoluteCorrespondingProperty.java 21 Apr 2004 15:21:18 -0000 1.1.2.2 @@ -30,9 +30,8 @@ * @author pbw * @version $Revision$ $Name$ */ -public interface AbsoluteCorrespondingProperty { - public int getWritingMode (FONode foNode) - throws PropertyException; +public interface AbsoluteCorrespondingProperty +extends CorrespondingProperty { public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException; public boolean overridesCorresponding(FONode foNode); 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderStartStyle.java Index: BorderStartStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderStartStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderStartStyle.java 20 Apr 2004 17:15:27 -0000 1.1.2.4 +++ BorderStartStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingAbsoluteProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingAbsoluteEdge( - getWritingMode(foNode), WritingMode.START); + return getCorrespondingAbsoluteStyleProperty( + foNode, WritingMode.START); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.6 +8 -2 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderCommonStyle.java Index: BorderCommonStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderCommonStyle.java,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- BorderCommonStyle.java 25 Feb 2004 23:09:09 -0000 1.1.2.5 +++ BorderCommonStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.6 @@ -23,13 +23,14 @@ import java.util.HashMap; import org.apache.fop.datatypes.Ints; +import org.apache.fop.fo.FONode; import org.apache.fop.fo.expr.PropertyException; /** * Pseudo-property class for common border style values occurring in a * number of classes. */ -public class BorderCommonStyle extends Property { +public class BorderCommonStyle extends AbstractCorrespondingProperty { public static final int HIDDEN = 1; public static final int DOTTED = 2; public static final int DASHED = 3; @@ -76,6 +77,11 @@ if (index < 1 || index >= rwEnums.length) throw new PropertyException("index out of range: " + index); return rwEnums[index]; + } + + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + throw new PropertyException("Called from superclass"); } } 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderBottomStyle.java Index: BorderBottomStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderBottomStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderBottomStyle.java 20 Apr 2004 17:15:27 -0000 1.1.2.4 +++ BorderBottomStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingRelativeEdge( - getWritingMode(foNode), WritingMode.BOTTOM); + return getCorrespondingRelativeStyleProperty( + foNode, WritingMode.BOTTOM); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.2 +4 -5 xml-fop/src/java/org/apache/fop/fo/properties/Attic/RelativeCorrespondingProperty.java Index: RelativeCorrespondingProperty.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/RelativeCorrespondingProperty.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- RelativeCorrespondingProperty.java 20 Apr 2004 17:15:27 -0000 1.1.2.1 +++ RelativeCorrespondingProperty.java 21 Apr 2004 15:21:18 -0000 1.1.2.2 @@ -30,9 +30,8 @@ * @author pbw * @version $Revision$ $Name$ */ -public interface RelativeCorrespondingProperty { - public int getWritingMode(FONode foNode) - throws PropertyException; +public interface RelativeCorrespondingProperty +extends CorrespondingProperty { public int getCorrespondingAbsoluteProperty(FONode foNode) throws PropertyException; public boolean correspondingOverrides(FONode foNode); 1.1.2.5 +3 -3 xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderRightStyle.java Index: BorderRightStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderRightStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderRightStyle.java 20 Apr 2004 17:15:27 -0000 1.1.2.4 +++ BorderRightStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingRelativeEdge( - getWritingMode(foNode), WritingMode.RIGHT); + return getCorrespondingRelativeStyleProperty( + foNode, WritingMode.RIGHT); } public boolean correspondingOverrides(FONode foNode) { No revision Index: BorderRightStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderRightStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderRightStyle.java 20 Apr 2004 17:15:27 -0000 1.1.2.4 +++ BorderRightStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingRelativeEdge( - getWritingMode(foNode), WritingMode.RIGHT); + return getCorrespondingRelativeStyleProperty( + foNode, WritingMode.RIGHT); } public boolean correspondingOverrides(FONode foNode) { No revision Index: BorderRightStyle.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/Attic/BorderRightStyle.java,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -r1.1.2.4 -r1.1.2.5 --- BorderRightStyle.java 20 Apr 2004 17:15:27 -0000 1.1.2.4 +++ BorderRightStyle.java 21 Apr 2004 15:21:18 -0000 1.1.2.5 @@ -53,8 +53,8 @@ public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return WritingMode.getCorrespondingRelativeEdge( - getWritingMode(foNode), WritingMode.RIGHT); + return getCorrespondingRelativeStyleProperty( + foNode, WritingMode.RIGHT); } public boolean correspondingOverrides(FONode foNode) { 1.1.2.1 +37 -0 xml-fop/src/java/org/apache/fop/fo/properties/Attic/CorrespondingProperty.java 1.1.2.1 +48 -0 xml-fop/src/java/org/apache/fop/fo/properties/Attic/AbstractCorrespondingProperty.java
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]