From 65efc8ad67604e3fee2337a1066ac02299951817 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Mon, 22 Dec 2003 03:53:31 +0000 Subject: [PATCH] ---------------------------------------------------------------------- More of conversion of strings to integers: Makers now being created via int constants in fo.properties.Constants class. Temporary string-int conversions currently in Property.java and PropertyList.java, which converts strings from callers into ints for subsequent use. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197047 13f79535-47bb-0310-9956-ffa450edef68 --- src/codegen/fo-property-mapping.xsl | 12 ++++- src/codegen/properties.xsl | 46 +++++++++++++------ .../datatypes/ToBeImplementedProperty.java | 4 +- .../org/apache/fop/fo/CharacterProperty.java | 4 +- .../org/apache/fop/fo/ColorTypeProperty.java | 4 +- .../org/apache/fop/fo/CondLengthProperty.java | 4 +- src/java/org/apache/fop/fo/EnumProperty.java | 4 +- src/java/org/apache/fop/fo/KeepProperty.java | 4 +- .../org/apache/fop/fo/LengthPairProperty.java | 4 +- .../org/apache/fop/fo/LengthProperty.java | 4 +- .../apache/fop/fo/LengthRangeProperty.java | 4 +- src/java/org/apache/fop/fo/ListProperty.java | 4 +- .../org/apache/fop/fo/NumberProperty.java | 4 +- src/java/org/apache/fop/fo/Property.java | 20 ++++---- src/java/org/apache/fop/fo/SpaceProperty.java | 4 +- .../org/apache/fop/fo/StringProperty.java | 4 +- 16 files changed, 78 insertions(+), 52 deletions(-) diff --git a/src/codegen/fo-property-mapping.xsl b/src/codegen/fo-property-mapping.xsl index ddcba5b1d..33e7e2f91 100644 --- a/src/codegen/fo-property-mapping.xsl +++ b/src/codegen/fo-property-mapping.xsl @@ -79,7 +79,7 @@ Software Foundation, please see . - [PR_] =.maker(""); + [PR_] =.maker(PR_); addPropertyName("", PR_); @@ -154,8 +154,16 @@ public class PropertyMapping implements Constant return i.intValue(); } + // returns a property, compound, or property.compound name public static String getPropertyName(int id) { - return (String) s_htPropIds.get(new Integer(id)); + if (((id & Constants.COMPOUND_MASK) == 0) + || ((id & Constants.PROPERTY_MASK) == 0)) { + return (String) s_htPropIds.get(new Integer(id)); + } else { + return (String) s_htPropIds.get(new Integer( + id & Constants.PROPERTY_MASK)) + "." + s_htPropIds.get( + new Integer(id & Constants.COMPOUND_MASK)); + } } static { diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 1ff4cbb9f..c0edfa00d 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -444,7 +444,7 @@ public class { SP_ - Maker(String sPropName) { + Maker(int sPropName) { super(sPropName); } @@ -466,11 +466,19 @@ public class Maker = new SP_ - Maker(" - - . - - "); + Maker( + + Constants.PR_ + + + + | + + Constants.CP_ + + + + ); @@ -478,11 +486,19 @@ public class Maker = new - (" - - . - - "); + ( + + Constants.PR_ + + + + | + + Constants.CP_ + + + + ); @@ -490,16 +506,16 @@ public class - static public Property.Maker maker(String propName) { + static public Property.Maker maker(int propertyId) { return new - (propName); + (propertyId); } protected - (String name) { - super(name); + (int propId) { + super(propId); m_shorthandMaker= getSubpropMaker(" diff --git a/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java b/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java index 4ce30868c..ed44aeba5 100644 --- a/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java +++ b/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java @@ -58,8 +58,8 @@ public class ToBeImplementedProperty extends Property { public static class Maker extends Property.Maker { - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } public Property convertProperty(Property p, diff --git a/src/java/org/apache/fop/fo/CharacterProperty.java b/src/java/org/apache/fop/fo/CharacterProperty.java index 102fd33f5..d2f670b06 100644 --- a/src/java/org/apache/fop/fo/CharacterProperty.java +++ b/src/java/org/apache/fop/fo/CharacterProperty.java @@ -63,8 +63,8 @@ public class CharacterProperty extends Property { /** * @param propName name of property for which a Maker should be created */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } public Property make(PropertyList propertyList, String value, diff --git a/src/java/org/apache/fop/fo/ColorTypeProperty.java b/src/java/org/apache/fop/fo/ColorTypeProperty.java index 3eaa6fc29..4cfaeb6ab 100644 --- a/src/java/org/apache/fop/fo/ColorTypeProperty.java +++ b/src/java/org/apache/fop/fo/ColorTypeProperty.java @@ -65,8 +65,8 @@ public class ColorTypeProperty extends Property { /** * @param propName name of property for which a Maker should be created */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } public Property convertProperty(Property p, diff --git a/src/java/org/apache/fop/fo/CondLengthProperty.java b/src/java/org/apache/fop/fo/CondLengthProperty.java index 85ebf4e85..5cfbe469a 100644 --- a/src/java/org/apache/fop/fo/CondLengthProperty.java +++ b/src/java/org/apache/fop/fo/CondLengthProperty.java @@ -66,8 +66,8 @@ public class CondLengthProperty extends Property { /** * @param name of property for which a Maker should be created */ - public Maker(String name) { - super(name); + public Maker(int propId) { + super(propId); } } diff --git a/src/java/org/apache/fop/fo/EnumProperty.java b/src/java/org/apache/fop/fo/EnumProperty.java index b23c8ec5a..155f41dc0 100644 --- a/src/java/org/apache/fop/fo/EnumProperty.java +++ b/src/java/org/apache/fop/fo/EnumProperty.java @@ -65,8 +65,8 @@ public class EnumProperty extends Property { /** * @param propName name of property for which a Maker should be created */ - protected Maker(String propName) { - super(propName); + protected Maker(int propId) { + super(propId); } /** diff --git a/src/java/org/apache/fop/fo/KeepProperty.java b/src/java/org/apache/fop/fo/KeepProperty.java index 9d5e43f77..bab7c321f 100644 --- a/src/java/org/apache/fop/fo/KeepProperty.java +++ b/src/java/org/apache/fop/fo/KeepProperty.java @@ -65,8 +65,8 @@ public class KeepProperty extends Property { /** * @param name name of property for which Maker should be created */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } diff --git a/src/java/org/apache/fop/fo/LengthPairProperty.java b/src/java/org/apache/fop/fo/LengthPairProperty.java index 3098813dc..415880e8e 100644 --- a/src/java/org/apache/fop/fo/LengthPairProperty.java +++ b/src/java/org/apache/fop/fo/LengthPairProperty.java @@ -65,8 +65,8 @@ public class LengthPairProperty extends Property { /** * @param name name of property for which this Maker should be created */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } diff --git a/src/java/org/apache/fop/fo/LengthProperty.java b/src/java/org/apache/fop/fo/LengthProperty.java index ec0f32ca6..09ba76a91 100644 --- a/src/java/org/apache/fop/fo/LengthProperty.java +++ b/src/java/org/apache/fop/fo/LengthProperty.java @@ -68,8 +68,8 @@ public class LengthProperty extends Property { /** * @param name name of property for which Maker should be created */ - public /* protected */ Maker(String name) { - super(name); + public Maker(int propId) { + super(propId); } /** diff --git a/src/java/org/apache/fop/fo/LengthRangeProperty.java b/src/java/org/apache/fop/fo/LengthRangeProperty.java index 401040dd8..b2a647a6c 100644 --- a/src/java/org/apache/fop/fo/LengthRangeProperty.java +++ b/src/java/org/apache/fop/fo/LengthRangeProperty.java @@ -65,8 +65,8 @@ public class LengthRangeProperty extends Property { /** * @param name name of property for which to create Maker */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } diff --git a/src/java/org/apache/fop/fo/ListProperty.java b/src/java/org/apache/fop/fo/ListProperty.java index c7b2c48fd..33a6fcf91 100644 --- a/src/java/org/apache/fop/fo/ListProperty.java +++ b/src/java/org/apache/fop/fo/ListProperty.java @@ -65,8 +65,8 @@ public class ListProperty extends Property { /** * @param name name of property for which Maker should be created */ - public Maker(String name) { - super(name); + public Maker(int propId) { + super(propId); } /** diff --git a/src/java/org/apache/fop/fo/NumberProperty.java b/src/java/org/apache/fop/fo/NumberProperty.java index 62d557896..6e046615c 100644 --- a/src/java/org/apache/fop/fo/NumberProperty.java +++ b/src/java/org/apache/fop/fo/NumberProperty.java @@ -67,8 +67,8 @@ public class NumberProperty extends Property { * Constructor for NumberProperty.Maker * @param propName the name of the property */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } /** diff --git a/src/java/org/apache/fop/fo/Property.java b/src/java/org/apache/fop/fo/Property.java index 0884e9460..8f922efa6 100644 --- a/src/java/org/apache/fop/fo/Property.java +++ b/src/java/org/apache/fop/fo/Property.java @@ -61,6 +61,8 @@ import org.apache.fop.datatypes.Space; import org.apache.fop.fo.expr.Numeric; import org.apache.fop.fo.expr.PropertyParser; import org.apache.fop.fo.expr.PropertyInfo; +import org.apache.fop.fo.properties.Constants; +import org.apache.fop.fo.properties.FOPropertyMapping; import org.apache.fop.apps.FOPException; import java.util.Vector; @@ -75,22 +77,21 @@ public class Property { * @author unascribed */ public static class Maker { - private static final String UNKNOWN = "UNKNOWN"; - private String propName; + private int propId; /** * @return the name of the property for this Maker */ protected String getPropName() { - return propName; + return FOPropertyMapping.getPropertyName(this.propId); } /** * Construct an instance of a Property.Maker for the given property. - * @param propName The name of the property to be made. + * @param propId The Constant ID of the property to be made. */ - protected Maker(String propName) { - this.propName = propName; + protected Maker(int propId) { + this.propId = propId; } /** @@ -98,7 +99,7 @@ public class Property { * Note: the property name is set to "UNKNOWN". */ protected Maker() { - this.propName = UNKNOWN; + this.propId = 0; } @@ -252,7 +253,8 @@ public class Property { } return pret; } catch (org.apache.fop.fo.expr.PropertyException propEx) { - throw new FOPException("Error in " + propName + String propName = FOPropertyMapping.getPropertyName(this.propId); + throw new FOPException("Error in " + propName + " property value '" + value + "': " + propEx); } @@ -416,7 +418,7 @@ public class Property { if (inheritsSpecified()) { // recalculate based on last specified value // Climb up propertylist and find last spec'd value - // NEED PROPNAME!!! get from Maker + String propName = FOPropertyMapping.getPropertyName(this.propId); Property specProp = propertyList.getNearestSpecified(propName); if (specProp != null) { diff --git a/src/java/org/apache/fop/fo/SpaceProperty.java b/src/java/org/apache/fop/fo/SpaceProperty.java index fde4e6a8c..6439e5eb2 100644 --- a/src/java/org/apache/fop/fo/SpaceProperty.java +++ b/src/java/org/apache/fop/fo/SpaceProperty.java @@ -68,8 +68,8 @@ public class SpaceProperty extends Property { /** * @param name name of the property whose Maker is to be created */ - protected Maker(String name) { - super(name); + protected Maker(int propId) { + super(propId); } } diff --git a/src/java/org/apache/fop/fo/StringProperty.java b/src/java/org/apache/fop/fo/StringProperty.java index 2986e7ca5..a2d93d070 100644 --- a/src/java/org/apache/fop/fo/StringProperty.java +++ b/src/java/org/apache/fop/fo/StringProperty.java @@ -64,8 +64,8 @@ public class StringProperty extends Property { /** * @param propName name of property for which to create a Maker */ - public Maker(String propName) { - super(propName); + public Maker(int propId) { + super(propId); } /** -- 2.39.5