Changes to interface CorrespodingProperties Work on Padding properties git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197543 13f79535-47bb-0310-9956-ffa450edef68tags/Defoe_export
@@ -49,12 +49,4 @@ public abstract class AbstractCorrespondingProperty extends Property | |||
throw new PropertyException("Called from superclass"); | |||
} | |||
/** | |||
* @return | |||
* @throws PropertyException | |||
*/ | |||
public boolean overridesCorresponding() | |||
throws PropertyException { | |||
throw new PropertyException("Called from superclass"); | |||
} | |||
} |
@@ -21,10 +21,11 @@ | |||
package org.apache.fop.fo.properties; | |||
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; | |||
public class BorderAfterWidthLength extends BorderCommonWidth { | |||
public class BorderAfterWidthLength extends BorderCommonWidthRelative { | |||
public static final int dataTypes = LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,6 +57,12 @@ public class BorderAfterWidthLength extends BorderCommonWidth { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingWidthProperty( | |||
foNode, WritingMode.AFTER); | |||
} | |||
} | |||
@@ -21,10 +21,11 @@ | |||
package org.apache.fop.fo.properties; | |||
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; | |||
public class BorderBeforeWidthLength extends BorderCommonWidth { | |||
public class BorderBeforeWidthLength extends BorderCommonWidthRelative { | |||
public static final int dataTypes = LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,6 +57,11 @@ public class BorderBeforeWidthLength extends BorderCommonWidth { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingWidthProperty( | |||
foNode, WritingMode.BEFORE); | |||
} | |||
} | |||
@@ -63,9 +63,5 @@ public class BorderBottomColor extends BorderColorCorrespondingAbsolute { | |||
foNode, WritingMode.BOTTOM); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -57,10 +57,5 @@ extends BorderCommonStyleAbsolute { | |||
foNode, WritingMode.BOTTOM); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -69,9 +69,5 @@ public class BorderBottomWidth extends BorderCommonWidthAbsolute { | |||
foNode, WritingMode.BOTTOM); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -47,11 +47,4 @@ public abstract class BorderColorCorresponding extends ColorTransparent | |||
throws PropertyException { | |||
throw new PropertyException("Called from superclass"); | |||
} | |||
/* (non-Javadoc) | |||
* @see org.apache.fop.fo.properties.CorrespondingProperty#overridesCorresponding(org.apache.fop.fo.FONode) | |||
*/ | |||
public boolean overridesCorresponding(FONode foNode) | |||
throws PropertyException { | |||
throw new PropertyException("Called from superclass"); | |||
} | |||
} |
@@ -55,10 +55,6 @@ public class BorderColorCorrespondingRelative extends BorderColorCorresponding { | |||
return absBorderColorProps[absEdge]; | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
public boolean isCorrespondingRelative() { | |||
return true; | |||
} |
@@ -23,7 +23,6 @@ package org.apache.fop.fo.properties; | |||
import java.util.HashMap; | |||
import org.apache.fop.datatypes.Ints; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.expr.PropertyException; | |||
/** | |||
@@ -80,9 +79,5 @@ extends AbstractCorrespondingProperty { | |||
return rwEnums[index]; | |||
} | |||
public boolean overridesCorresponding(FONode foNode) | |||
throws PropertyException { | |||
throw new PropertyException("Called within superclass"); | |||
} | |||
} | |||
@@ -59,10 +59,6 @@ extends BorderCommonStyle { | |||
return absBorderStyleProps[absEdge]; | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
public boolean isCorrespondingRelative() { | |||
return true; | |||
} |
@@ -72,10 +72,5 @@ public abstract class BorderCommonWidth extends AbstractCorrespondingProperty { | |||
return rwEnums[index]; | |||
} | |||
public boolean overridesCorresponding(FONode foNode) | |||
throws PropertyException { | |||
throw new PropertyException("Called within superclass"); | |||
} | |||
} | |||
@@ -55,10 +55,6 @@ public abstract class BorderCommonWidthRelative extends BorderCommonWidth { | |||
return absBorderWidthProps[absEdge]; | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
public boolean isCorrespondingRelative() { | |||
return true; | |||
} |
@@ -21,10 +21,11 @@ | |||
package org.apache.fop.fo.properties; | |||
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; | |||
public class BorderEndWidthLength extends BorderCommonWidth { | |||
public class BorderEndWidthLength extends BorderCommonWidthRelative { | |||
public static final int dataTypes = LENGTH; | |||
public int getDataTypes() { | |||
@@ -55,7 +56,11 @@ public class BorderEndWidthLength extends BorderCommonWidth { | |||
public int getInherited() { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingWidthProperty( | |||
foNode, WritingMode.END); | |||
} | |||
} | |||
@@ -63,9 +63,5 @@ public class BorderLeftColor extends BorderColorCorrespondingAbsolute { | |||
foNode, WritingMode.LEFT); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -57,9 +57,5 @@ extends BorderCommonStyleAbsolute { | |||
foNode, WritingMode.LEFT); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -69,9 +69,5 @@ public class BorderLeftWidth extends BorderCommonWidthAbsolute { | |||
foNode, WritingMode.LEFT); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -63,9 +63,5 @@ public class BorderRightColor extends BorderColorCorrespondingAbsolute { | |||
foNode, WritingMode.RIGHT); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -57,9 +57,5 @@ extends BorderCommonStyleAbsolute { | |||
foNode, WritingMode.RIGHT); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -69,9 +69,5 @@ public class BorderRightWidth extends BorderCommonWidthAbsolute { | |||
foNode, WritingMode.RIGHT); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -57,9 +57,5 @@ extends BorderCommonStyleRelative { | |||
foNode, WritingMode.START); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -21,10 +21,11 @@ | |||
package org.apache.fop.fo.properties; | |||
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; | |||
public class BorderStartWidthLength extends BorderCommonWidth { | |||
public class BorderStartWidthLength extends BorderCommonWidthRelative { | |||
public static final int dataTypes = LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,5 +57,11 @@ public class BorderStartWidthLength extends BorderCommonWidth { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingWidthProperty( | |||
foNode, WritingMode.END); | |||
} | |||
} | |||
@@ -63,9 +63,5 @@ public class BorderTopColor extends BorderColorCorrespondingAbsolute { | |||
foNode, WritingMode.TOP); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -56,9 +56,5 @@ extends BorderCommonStyleAbsolute { | |||
foNode, WritingMode.TOP); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -69,9 +69,5 @@ public class BorderTopWidth extends BorderCommonWidthAbsolute { | |||
foNode, WritingMode.TOP); | |||
} | |||
public boolean overridesCorresponding(FONode foNode) { | |||
return false; | |||
} | |||
} | |||
@@ -34,6 +34,4 @@ public interface CorrespondingProperty { | |||
throws PropertyException; | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException; | |||
public boolean overridesCorresponding(FONode foNode) | |||
throws PropertyException; | |||
} |
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingAfter extends Property { | |||
public class PaddingAfter extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = | |||
COMPOUND | PERCENTAGE | LENGTH | INHERIT; | |||
@@ -56,5 +57,11 @@ public class PaddingAfter extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.AFTER); | |||
} | |||
} | |||
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingAfterLength extends Property { | |||
public class PaddingAfterLength extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = PERCENTAGE | LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,5 +57,11 @@ public class PaddingAfterLength extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.AFTER); | |||
} | |||
} | |||
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingBefore extends Property { | |||
public class PaddingBefore extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = | |||
COMPOUND |PERCENTAGE | LENGTH | INHERIT; | |||
@@ -57,5 +58,11 @@ public class PaddingBefore extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.BEFORE); | |||
} | |||
} | |||
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingBeforeLength extends Property { | |||
public class PaddingBeforeLength extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,5 +57,11 @@ public class PaddingBeforeLength extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.BEFORE); | |||
} | |||
} | |||
@@ -0,0 +1,63 @@ | |||
/* | |||
* | |||
* Copyright 2004 The Apache Software Foundation. | |||
* | |||
* 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. | |||
* | |||
* Created on 29/04/2004 | |||
* $Id$ | |||
*/ | |||
package org.apache.fop.fo.properties; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.PropNames; | |||
import org.apache.fop.fo.expr.PropertyException; | |||
/** | |||
* @author pbw | |||
* @version $Revision$ $Name$ | |||
*/ | |||
public abstract class PaddingCorrespondingAbsolute | |||
extends AbstractCorrespondingProperty { | |||
/** Array of relative padding properties, | |||
* indexed by relative edge constants */ | |||
private static int[] relPaddingProps = { | |||
PropNames.NO_PROPERTY | |||
,PropNames.PADDING_BEFORE | |||
,PropNames.PADDING_AFTER | |||
,PropNames.PADDING_START | |||
,PropNames.PADDING_END | |||
}; | |||
/** | |||
* Gets the relative padding property corresponding to the given | |||
* absolute edge | |||
* @param foNode the node on which the property is being defined | |||
* @param absoluteEdge | |||
* @return the relative padding property index | |||
* @throws PropertyException | |||
*/ | |||
protected int getCorrespondingPaddingProperty( | |||
FONode foNode, int absoluteEdge) | |||
throws PropertyException { | |||
int relEdge = WritingMode.getCorrespondingRelativeEdge( | |||
getWritingMode(foNode), absoluteEdge); | |||
return relPaddingProps[relEdge]; | |||
} | |||
public boolean isCorrespondingAbsolute() { | |||
return true; | |||
} | |||
} |
@@ -0,0 +1,62 @@ | |||
/* | |||
* | |||
* Copyright 2004 The Apache Software Foundation. | |||
* | |||
* 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. | |||
* | |||
* Created on 29/04/2004 | |||
* $Id$ | |||
*/ | |||
package org.apache.fop.fo.properties; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.PropNames; | |||
import org.apache.fop.fo.expr.PropertyException; | |||
/** | |||
* @author pbw | |||
* @version $Revision$ $Name$ | |||
*/ | |||
public abstract class PaddingCorrespondingRelative extends AbstractCorrespondingProperty { | |||
/** Array of absolute padding properties, | |||
* indexed by absolute edge constants */ | |||
private static int[] absPaddingProps = { | |||
PropNames.NO_PROPERTY | |||
,PropNames.PADDING_TOP | |||
,PropNames.PADDING_BOTTOM | |||
,PropNames.PADDING_LEFT | |||
,PropNames.PADDING_RIGHT | |||
}; | |||
/** | |||
* Gets the absolute padding property corresponding to the given | |||
* relative edge | |||
* @param foNode the node on which the property is being defined | |||
* @param relativeEdge | |||
* @return the absolute padding property index | |||
* @throws PropertyException | |||
*/ | |||
protected int getCorrespondingPaddingProperty( | |||
FONode foNode, int relativeEdge) | |||
throws PropertyException { | |||
int relEdge = WritingMode.getCorrespondingAbsoluteEdge( | |||
getWritingMode(foNode), relativeEdge); | |||
return absPaddingProps[relEdge]; | |||
} | |||
public boolean isCorrespondingRelative() { | |||
return true; | |||
} | |||
} |
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingEnd extends Property { | |||
public class PaddingEnd extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = | |||
COMPOUND | PERCENTAGE | LENGTH | INHERIT; | |||
@@ -56,5 +57,11 @@ public class PaddingEnd extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.END); | |||
} | |||
} | |||
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingEndLength extends Property { | |||
public class PaddingEndLength extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = PERCENTAGE | LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,5 +57,11 @@ public class PaddingEndLength extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.END); | |||
} | |||
} | |||
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingStart extends Property { | |||
public class PaddingStart extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = | |||
COMPOUND | PERCENTAGE | LENGTH | INHERIT; | |||
@@ -56,5 +57,11 @@ public class PaddingStart extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.START); | |||
} | |||
} | |||
@@ -22,10 +22,11 @@ package org.apache.fop.fo.properties; | |||
import org.apache.fop.datatypes.Length; | |||
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; | |||
public class PaddingStartLength extends Property { | |||
public class PaddingStartLength extends PaddingCorrespondingRelative { | |||
public static final int dataTypes = PERCENTAGE | LENGTH; | |||
public int getDataTypes() { | |||
@@ -56,5 +57,11 @@ public class PaddingStartLength extends Property { | |||
return inherited; | |||
} | |||
public int getCorrespondingProperty(FONode foNode) | |||
throws PropertyException { | |||
return getCorrespondingPaddingProperty( | |||
foNode, WritingMode.START); | |||
} | |||
} | |||