diff options
author | Glen Mazza <gmazza@apache.org> | 2003-12-22 03:53:31 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2003-12-22 03:53:31 +0000 |
commit | 65efc8ad67604e3fee2337a1066ac02299951817 (patch) | |
tree | cce064782472ce2c53507660876d84bfc8b3856a | |
parent | 657644f5904c56555d5ffca15ff297343cfbbd61 (diff) | |
download | xmlgraphics-fop-65efc8ad67604e3fee2337a1066ac02299951817.tar.gz xmlgraphics-fop-65efc8ad67604e3fee2337a1066ac02299951817.zip |
----------------------------------------------------------------------
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
-rw-r--r-- | src/codegen/fo-property-mapping.xsl | 12 | ||||
-rw-r--r-- | src/codegen/properties.xsl | 46 | ||||
-rw-r--r-- | src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/CharacterProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/ColorTypeProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/CondLengthProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/EnumProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/KeepProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/LengthPairProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/LengthProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/LengthRangeProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/ListProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/NumberProperty.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/Property.java | 20 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/SpaceProperty.java | 4 | ||||
-rw-r--r-- | src/java/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 <http://www.apache.org/>. <xsl:variable name="lcletters" select="'abcdefghijklmnopqrstuvwxyz-:'" /> <xsl:variable name="ucletters" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ__'" /> <xsl:variable name="enum" select="translate($prop/name, $lcletters, $ucletters)"/> -<xsl:text> </xsl:text><xsl:value-of select="$htname"/>[PR_<xsl:value-of select="$enum"/>] =<xsl:value-of select="$makerclass"/>.maker("<xsl:value-of select="$prop/name"/>"); +<xsl:text> </xsl:text><xsl:value-of select="$htname"/>[PR_<xsl:value-of select="$enum"/>] =<xsl:value-of select="$makerclass"/>.maker(PR_<xsl:value-of select="$enum"/>); <xsl:text> addPropertyName("</xsl:text><xsl:value-of select="$prop/name"/>", PR_<xsl:value-of select="$enum"/>); </xsl:template> @@ -154,8 +154,16 @@ public class <xsl:value-of select="@family"/>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 </xsl:text> <xsl:text> { SP_</xsl:text> <xsl:value-of select="$spname"/> - <xsl:text>Maker(String sPropName) { + <xsl:text>Maker(int sPropName) { super(sPropName); }</xsl:text> <xsl:for-each select="enumeration/value"> @@ -466,11 +466,19 @@ public class </xsl:text> <xsl:value-of select="$spname"/> <xsl:text>Maker = new SP_</xsl:text><xsl:value-of select="$spname"/> - <xsl:text>Maker("</xsl:text> - <xsl:value-of select='../../name'/> - <xsl:text>.</xsl:text> - <xsl:value-of select='name'/> - <xsl:text>");</xsl:text> + <xsl:text>Maker(</xsl:text> + <xsl:if test="not(../../@type = 'generic')"> + <xsl:text>Constants.PR_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="../../name"/> + </xsl:call-template> + <xsl:text> | </xsl:text> + </xsl:if> + <xsl:text>Constants.CP_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="name"/> + </xsl:call-template> + <xsl:text>);</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text> @@ -478,11 +486,19 @@ public class </xsl:text> <xsl:value-of select="$spname"/> <xsl:text>Maker = new </xsl:text><xsl:value-of select="$sp_superclass"/> - <xsl:text>("</xsl:text> - <xsl:value-of select='../../name'/> - <xsl:text>.</xsl:text> - <xsl:value-of select='name'/> - <xsl:text>");</xsl:text> + <xsl:text>(</xsl:text> + <xsl:if test="not(../../@type = 'generic')"> + <xsl:text>Constants.PR_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="../../name"/> + </xsl:call-template> + <xsl:text> | </xsl:text> + </xsl:if> + <xsl:text>Constants.CP_</xsl:text> + <xsl:call-template name="makeEnumConstant"> + <xsl:with-param name="propstr" select="name"/> + </xsl:call-template> + <xsl:text>);</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:for-each> @@ -490,16 +506,16 @@ public class </xsl:text> <xsl:text> - static public Property.Maker maker(String propName) { + static public Property.Maker maker(int propertyId) { return new </xsl:text> <xsl:value-of select="$classname"/> - <xsl:text>(propName); + <xsl:text>(propertyId); } protected </xsl:text> <xsl:value-of select="$classname"/> - <xsl:text>(String name) { - super(name);</xsl:text> + <xsl:text>(int propId) { + super(propId);</xsl:text> <xsl:if test="compound"> <xsl:text> m_shorthandMaker= getSubpropMaker("</xsl:text> 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); } /** |