From: Peter Bernard West Date: Thu, 22 Apr 2004 03:05:47 +0000 (+0000) Subject: Border style corresponding properties extended X-Git-Tag: Defoe_export~217 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7fa9b558b586e25af6fa7dc4d15e02784ab401ff;p=xmlgraphics-fop.git Border style corresponding properties extended git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197528 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java b/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java index fe7de8757..99c43a1a7 100644 --- a/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java +++ b/src/java/org/apache/fop/fo/properties/AbstractCorrespondingProperty.java @@ -40,9 +40,21 @@ public abstract class AbstractCorrespondingProperty extends Property PropertyValue wm = foNode.getPropertyValue(PropNames.WRITING_MODE); return EnumType.getEnumValue(wm); } + /* (non-Javadoc) * @see org.apache.fop.fo.properties.CorrespondingProperty#getCorrespondingProperty(org.apache.fop.fo.FONode) */ - public abstract int getCorrespondingProperty(FONode foNode) - throws PropertyException; + public int getCorrespondingProperty(FONode foNode) + throws PropertyException { + throw new PropertyException("Called from superclass"); + } + + /** + * @return + * @throws PropertyException + */ + public boolean overridesCorresponding() + throws PropertyException { + throw new PropertyException("Called from superclass"); + } } diff --git a/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java b/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java index 328c832b7..af3facff6 100644 --- a/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderAfterStyle.java @@ -51,13 +51,13 @@ extends BorderCommonStyleRelative { return inherited; } - public int getCorrespondingAbsoluteProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingAbsoluteStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.AFTER); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java b/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java index aad8ac11e..b45a8e265 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderBeforeStyle.java @@ -51,13 +51,13 @@ extends BorderCommonStyleRelative { return inherited; } - public int getCorrespondingAbsoluteProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingAbsoluteStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.BEFORE); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java b/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java index f4aa8897c..8a1c43431 100644 --- a/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderBottomStyle.java @@ -51,13 +51,13 @@ extends BorderCommonStyleAbsolute { return inherited; } - public int getCorrespondingRelativeProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingRelativeStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.BOTTOM); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java b/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java index 186bd8e89..12ff65565 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonStyle.java @@ -30,7 +30,8 @@ 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 AbstractCorrespondingProperty { +public abstract class BorderCommonStyle +extends AbstractCorrespondingProperty { public static final int HIDDEN = 1; public static final int DOTTED = 2; public static final int DASHED = 3; @@ -79,10 +80,9 @@ public class BorderCommonStyle extends AbstractCorrespondingProperty { return rwEnums[index]; } - public int getCorrespondingProperty(FONode foNode) + public boolean overridesCorresponding(FONode foNode) throws PropertyException { - throw new PropertyException("Called from superclass"); + throw new PropertyException("Called within superclass"); } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonStyleAbsolute.java b/src/java/org/apache/fop/fo/properties/BorderCommonStyleAbsolute.java index 50683b76a..c8d31a91d 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonStyleAbsolute.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonStyleAbsolute.java @@ -19,8 +19,6 @@ */ package org.apache.fop.fo.properties; -import org.apache.fop.datatypes.EnumType; -import org.apache.fop.datatypes.PropertyValue; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; @@ -32,29 +30,8 @@ import org.apache.fop.fo.expr.PropertyException; * @author pbw * @version $Revision$ $Name$ */ -public class BorderCommonStyleAbsolute -extends BorderCommonStyle -implements AbsoluteCorrespondingProperty { - /* (non-Javadoc) - * @see org.apache.fop.fo.properties.AbsoluteCorrespondingProperty#getWritingMode() - */ - public int getWritingMode(FONode foNode) - throws PropertyException { - 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() - */ - public int getCorrespondingRelativeProperty(FONode foNode) - throws PropertyException { - throw new PropertyException("Called from superclass"); - } +public abstract class BorderCommonStyleAbsolute +extends BorderCommonStyle { /** Array of relative border style properties, * indexed by relative edge constants */ @@ -74,7 +51,7 @@ implements AbsoluteCorrespondingProperty { * @return the relative border style property index * @throws PropertyException */ - protected int getCorrespondingRelativeStyleProperty( + protected int getCorrespondingStyleProperty( FONode foNode, int absoluteEdge) throws PropertyException { int relEdge = WritingMode.getCorrespondingRelativeEdge( @@ -82,17 +59,4 @@ implements AbsoluteCorrespondingProperty { 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; - } } diff --git a/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java b/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java index 202f1820a..3325188ba 100644 --- a/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java +++ b/src/java/org/apache/fop/fo/properties/BorderCommonStyleRelative.java @@ -19,8 +19,6 @@ */ package org.apache.fop.fo.properties; -import org.apache.fop.datatypes.EnumType; -import org.apache.fop.datatypes.PropertyValue; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropNames; import org.apache.fop.fo.expr.PropertyException; @@ -32,29 +30,9 @@ import org.apache.fop.fo.expr.PropertyException; * @author pbw * @version $Revision$ $Name$ */ -public class BorderCommonStyleRelative -extends BorderCommonStyle -implements RelativeCorrespondingProperty { - /* (non-Javadoc) - * @see org.apache.fop.fo.properties.RelativeCorrespondingProperty#getWritingMode(org.apache.fop.fo.FONode) - */ - public int getWritingMode(FONode foNode) - throws PropertyException { - PropertyValue wm = foNode.getPropertyValue(PropNames.WRITING_MODE); - return EnumType.getEnumValue(wm); - } +public abstract class BorderCommonStyleRelative +extends BorderCommonStyle { - 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) - */ - public int getCorrespondingAbsoluteProperty(FONode foNode) - throws PropertyException { - throw new PropertyException("Called from superclass"); - } /** Array of absolute border style properties, * indexed by absolute edge constants */ @@ -74,7 +52,7 @@ implements RelativeCorrespondingProperty { * @return the absolute border style property index * @throws PropertyException */ - protected int getCorrespondingAbsoluteStyleProperty( + protected int getCorrespondingStyleProperty( FONode foNode, int relativeEdge) throws PropertyException { int absEdge = WritingMode.getCorrespondingAbsoluteEdge( @@ -82,18 +60,4 @@ implements RelativeCorrespondingProperty { 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; - } - } diff --git a/src/java/org/apache/fop/fo/properties/BorderEndStyle.java b/src/java/org/apache/fop/fo/properties/BorderEndStyle.java index 8b226728b..726addad7 100644 --- a/src/java/org/apache/fop/fo/properties/BorderEndStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderEndStyle.java @@ -51,13 +51,13 @@ extends BorderCommonStyleRelative { return inherited; } - public int getCorrespondingAbsoluteProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingAbsoluteStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.END); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java b/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java index 6b290ae1c..d54633d16 100644 --- a/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderLeftStyle.java @@ -53,11 +53,11 @@ extends BorderCommonStyleAbsolute { public int getCorrespondingRelativeProperty(FONode foNode) throws PropertyException { - return getCorrespondingRelativeStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.LEFT); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderRightStyle.java b/src/java/org/apache/fop/fo/properties/BorderRightStyle.java index f18cb3bc5..2ba0b125a 100644 --- a/src/java/org/apache/fop/fo/properties/BorderRightStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderRightStyle.java @@ -51,13 +51,13 @@ extends BorderCommonStyleAbsolute { return inherited; } - public int getCorrespondingRelativeProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingRelativeStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.RIGHT); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderStartStyle.java b/src/java/org/apache/fop/fo/properties/BorderStartStyle.java index 5f07a465f..d6274db31 100644 --- a/src/java/org/apache/fop/fo/properties/BorderStartStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderStartStyle.java @@ -51,13 +51,13 @@ extends BorderCommonStyleRelative { return inherited; } - public int getCorrespondingAbsoluteProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingAbsoluteStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.START); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/BorderTopStyle.java b/src/java/org/apache/fop/fo/properties/BorderTopStyle.java index 60f33913d..d2bc28e4f 100644 --- a/src/java/org/apache/fop/fo/properties/BorderTopStyle.java +++ b/src/java/org/apache/fop/fo/properties/BorderTopStyle.java @@ -50,13 +50,13 @@ extends BorderCommonStyleAbsolute { return inherited; } - public int getCorrespondingRelativeProperty(FONode foNode) + public int getCorrespondingProperty(FONode foNode) throws PropertyException { - return getCorrespondingRelativeStyleProperty( + return getCorrespondingStyleProperty( foNode, WritingMode.TOP); } - public boolean correspondingOverrides(FONode foNode) { + public boolean overridesCorresponding(FONode foNode) { return false; } diff --git a/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java b/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java index e526098ce..2f9404acf 100644 --- a/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java +++ b/src/java/org/apache/fop/fo/properties/CorrespondingProperty.java @@ -34,4 +34,6 @@ public interface CorrespondingProperty { throws PropertyException; public int getCorrespondingProperty(FONode foNode) throws PropertyException; + public boolean overridesCorresponding(FONode foNode) + throws PropertyException; }