From c0f8bf195383b49a22f1ce9daf5dfb26cbcb7f1d Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Tue, 27 Aug 2002 15:14:48 +0000 Subject: [PATCH] Added PropertyValue type field for later use in parsing. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195117 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/datatypes/Angle.java | 5 +- src/org/apache/fop/datatypes/Auto.java | 5 +- src/org/apache/fop/datatypes/Bool.java | 9 +-- src/org/apache/fop/datatypes/ColorType.java | 11 +-- src/org/apache/fop/datatypes/CountryType.java | 3 +- src/org/apache/fop/datatypes/EnumType.java | 71 +++++++++++++++++-- .../apache/fop/datatypes/FontFamilySet.java | 3 +- src/org/apache/fop/datatypes/Frequency.java | 5 +- .../fop/datatypes/FromNearestSpecified.java | 5 +- src/org/apache/fop/datatypes/FromParent.java | 5 +- src/org/apache/fop/datatypes/Inherit.java | 5 +- src/org/apache/fop/datatypes/IntegerType.java | 5 +- .../apache/fop/datatypes/LanguageType.java | 3 +- src/org/apache/fop/datatypes/Literal.java | 3 +- .../apache/fop/datatypes/MappedNumeric.java | 11 +-- src/org/apache/fop/datatypes/MimeType.java | 5 +- src/org/apache/fop/datatypes/NCName.java | 40 ++++++++++- src/org/apache/fop/datatypes/None.java | 5 +- src/org/apache/fop/datatypes/Numeric.java | 3 +- src/org/apache/fop/datatypes/ScriptType.java | 3 +- .../apache/fop/datatypes/ShadowEffect.java | 3 +- src/org/apache/fop/datatypes/Slash.java | 5 +- src/org/apache/fop/datatypes/StringType.java | 15 ++-- .../apache/fop/datatypes/TextDecorations.java | 5 +- .../apache/fop/datatypes/TextDecorator.java | 5 +- src/org/apache/fop/datatypes/Time.java | 5 +- src/org/apache/fop/datatypes/UriType.java | 5 +- 27 files changed, 184 insertions(+), 64 deletions(-) diff --git a/src/org/apache/fop/datatypes/Angle.java b/src/org/apache/fop/datatypes/Angle.java index 6e398753c..fc6f8cfbf 100644 --- a/src/org/apache/fop/datatypes/Angle.java +++ b/src/org/apache/fop/datatypes/Angle.java @@ -1,6 +1,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.Properties; @@ -52,7 +53,7 @@ public class Angle extends AbstractPropertyValue { public Angle(int property, int unit, double value) throws PropertyException { - super(property); + super(property, PropertyValue.ANGLE); units = unit; degrees = value * degPerUnit[unit]; } @@ -68,7 +69,7 @@ public class Angle extends AbstractPropertyValue { public Angle(String propertyName, int unit, double value) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.ANGLE); units = unit; degrees = value * degPerUnit[unit]; } diff --git a/src/org/apache/fop/datatypes/Auto.java b/src/org/apache/fop/datatypes/Auto.java index 2b9c93feb..743972ebc 100644 --- a/src/org/apache/fop/datatypes/Auto.java +++ b/src/org/apache/fop/datatypes/Auto.java @@ -1,5 +1,6 @@ package org.apache.fop.datatypes; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -32,7 +33,7 @@ public class Auto extends AbstractPropertyValue { public Auto(int property) throws PropertyException { - super(property); + super(property, PropertyValue.AUTO); } /** @@ -43,7 +44,7 @@ public class Auto extends AbstractPropertyValue { public Auto(String propertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.AUTO); } /** diff --git a/src/org/apache/fop/datatypes/Bool.java b/src/org/apache/fop/datatypes/Bool.java index 4f347d13b..5f8650481 100644 --- a/src/org/apache/fop/datatypes/Bool.java +++ b/src/org/apache/fop/datatypes/Bool.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.Properties; @@ -39,7 +40,7 @@ public class Bool extends AbstractPropertyValue { public Bool (int property, boolean bool) throws PropertyException { - super(property); + super(property, PropertyValue.BOOL); this.bool = bool; } @@ -53,7 +54,7 @@ public class Bool extends AbstractPropertyValue { public Bool (int property, String boolStr) throws PropertyException { - super(property); + super(property, PropertyValue.BOOL); if (boolStr.equals("true")) bool = true; else if (boolStr.equals("false")) bool = false; else throw new PropertyException @@ -70,7 +71,7 @@ public class Bool extends AbstractPropertyValue { public Bool (String propertyName, String boolStr) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.BOOL); if (boolStr.equals("true")) bool = true; else if (boolStr.equals("false")) bool = false; else throw new PropertyException @@ -86,7 +87,7 @@ public class Bool extends AbstractPropertyValue { public Bool (String propertyName, boolean bool) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.BOOL); this.bool = bool; } diff --git a/src/org/apache/fop/datatypes/ColorType.java b/src/org/apache/fop/datatypes/ColorType.java index 5e80d87f4..237734b32 100644 --- a/src/org/apache/fop/datatypes/ColorType.java +++ b/src/org/apache/fop/datatypes/ColorType.java @@ -11,6 +11,7 @@ import java.util.HashMap; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.PropertyConsts; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; /** @@ -48,7 +49,7 @@ public class ColorType extends AbstractPropertyValue { public ColorType(int property, float red, float green, float blue) throws PropertyException { - super(property); + super(property, PropertyValue.COLOR_TYPE); color[RED] = red; color[GREEN] = green; color[BLUE] = blue; @@ -82,7 +83,7 @@ public class ColorType extends AbstractPropertyValue { public ColorType(int property, int red, int green, int blue) throws PropertyException { - super(property); + super(property, PropertyValue.COLOR_TYPE); if (red > 255) red = 255; if (green > 255) green = 255; if (blue > 255) blue = 255; @@ -116,7 +117,7 @@ public class ColorType extends AbstractPropertyValue { * the normalized (0 <= n <= 1) red, green, blue and alpha components. */ public ColorType(int property, float[] color) throws PropertyException { - super(property); + super(property, PropertyValue.COLOR_TYPE); if (color.length != 4) throw new PropertyException ("Attempt to construct a ColorType with array of " + color.length + " elements."); @@ -146,7 +147,7 @@ public class ColorType extends AbstractPropertyValue { * @param value a String; the system color name. */ public ColorType(int property, String value) throws PropertyException { - super(property); + super(property, PropertyValue.COLOR_TYPE); if (value.startsWith("#")) { try { if (value.length() == 4) { @@ -209,7 +210,7 @@ public class ColorType extends AbstractPropertyValue { * @param colorEnum an int; the enumeration index. */ public ColorType(int property, int colorEnum) throws PropertyException { - super(property); + super(property, PropertyValue.COLOR_TYPE); String enumText = PropertyConsts.getEnumText(property, colorEnum); color = (float[])(getStandardColor(enumText).clone()); } diff --git a/src/org/apache/fop/datatypes/CountryType.java b/src/org/apache/fop/datatypes/CountryType.java index e3fb1de3a..83e30bc7d 100644 --- a/src/org/apache/fop/datatypes/CountryType.java +++ b/src/org/apache/fop/datatypes/CountryType.java @@ -5,6 +5,7 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; import org.apache.fop.configuration.Configuration; +import org.apache.fop.fo.expr.PropertyValue; /* * $Id$ @@ -26,7 +27,7 @@ public class CountryType extends NCName { public CountryType(int property, String countryCode) throws PropertyException { - super(property, countryCode); + super(property, countryCode, PropertyValue.COUNTRY); // Validate the code if (Configuration.getHashMapEntry("countriesMap", countryCode) == null) throw new PropertyException diff --git a/src/org/apache/fop/datatypes/EnumType.java b/src/org/apache/fop/datatypes/EnumType.java index 79fb62211..4be8c4ad5 100644 --- a/src/org/apache/fop/datatypes/EnumType.java +++ b/src/org/apache/fop/datatypes/EnumType.java @@ -5,6 +5,7 @@ import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; import org.apache.fop.messaging.MessageHandler; +import org.apache.fop.fo.expr.PropertyValue; /* * EnumType.java @@ -42,7 +43,60 @@ public class EnumType extends AbstractPropertyValue { public EnumType(int property, String enumText) throws PropertyException { - super(property); + this(property, enumText, PropertyValue.ENUM); + } + + /** + * @param property the int index of the property on which + * this value is being defined. + * @param enum the int enumeration constant. + * @exception PropertyException + */ + public EnumType(int property, int enum) + throws PropertyException + { + this(property, enum, PropertyValue.ENUM); + } + + /** + * @param propertyName the String name of the property on which + * this value is being defined. + * @param enumText the String containing the enumeration text. + * An NCName. + * @exception PropertyException + */ + public EnumType(String propertyName, String enumText) + throws PropertyException + { + this(PropertyConsts.getPropertyIndex(propertyName), + enumText, PropertyValue.ENUM); + } + + /** + * @param propertyName the String name of the property on which + * this value is being defined. + * @param enum the int enumeration constant. + * @exception PropertyException + */ + public EnumType(String propertyName, int enum) + throws PropertyException + { + this(PropertyConsts.getPropertyIndex(propertyName), + enum, PropertyValue.ENUM); + } + + /** + * @param property the int index of the property on which + * this value is being defined. + * @param enumText the String containing the enumeration text. + * An NCName. + * @param type of this value + * @exception PropertyException + */ + public EnumType(int property, String enumText, int type) + throws PropertyException + { + super(property, type); // Get the enum integer or mapped enum integer enumValue = PropertyConsts.getEnumIndex(property, enumText); } @@ -51,12 +105,13 @@ public class EnumType extends AbstractPropertyValue { * @param property the int index of the property on which * this value is being defined. * @param enum the int enumeration constant. + * @param type of this value * @exception PropertyException */ - public EnumType(int property, int enum) + public EnumType(int property, int enum, int type) throws PropertyException { - super(property); + super(property, type); enumValue = enum; // Validate the text; getEnumText will throw a PropertyException // if the enum integer is invalid @@ -68,24 +123,26 @@ public class EnumType extends AbstractPropertyValue { * this value is being defined. * @param enumText the String containing the enumeration text. * An NCName. + * @param type of this value * @exception PropertyException */ - public EnumType(String propertyName, String enumText) + public EnumType(String propertyName, String enumText, int type) throws PropertyException { - this(PropertyConsts.getPropertyIndex(propertyName), enumText); + this(PropertyConsts.getPropertyIndex(propertyName), enumText, type); } /** * @param propertyName the String name of the property on which * this value is being defined. * @param enum the int enumeration constant. + * @param type of this value * @exception PropertyException */ - public EnumType(String propertyName, int enum) + public EnumType(String propertyName, int enum, int type) throws PropertyException { - this(PropertyConsts.getPropertyIndex(propertyName), enum); + this(PropertyConsts.getPropertyIndex(propertyName), enum, type); } /** diff --git a/src/org/apache/fop/datatypes/FontFamilySet.java b/src/org/apache/fop/datatypes/FontFamilySet.java index 00d4e94e8..2250cb9f7 100644 --- a/src/org/apache/fop/datatypes/FontFamilySet.java +++ b/src/org/apache/fop/datatypes/FontFamilySet.java @@ -8,6 +8,7 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; /* * FontFamilySet.java @@ -46,7 +47,7 @@ public class FontFamilySet extends AbstractPropertyValue { public FontFamilySet(int property, String[] fontFamilyNames) throws PropertyException { - super(property); + super(property, PropertyValue.FONT_FAMILY); this.fontFamilyNames = fontFamilyNames; } diff --git a/src/org/apache/fop/datatypes/Frequency.java b/src/org/apache/fop/datatypes/Frequency.java index 55194e967..757c3cd48 100644 --- a/src/org/apache/fop/datatypes/Frequency.java +++ b/src/org/apache/fop/datatypes/Frequency.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.Properties; /* @@ -51,7 +52,7 @@ public class Frequency extends AbstractPropertyValue { public Frequency(int property, int unit, double value) throws PropertyException { - super(property); + super(property, PropertyValue.FREQUENCY); units = unit; frequency = value * hzPerUnit[unit]; } @@ -67,7 +68,7 @@ public class Frequency extends AbstractPropertyValue { public Frequency(String propertyName, int unit, double value) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.FREQUENCY); units = unit; frequency = value * hzPerUnit[unit]; } diff --git a/src/org/apache/fop/datatypes/FromNearestSpecified.java b/src/org/apache/fop/datatypes/FromNearestSpecified.java index c05190568..27f7d94c6 100644 --- a/src/org/apache/fop/datatypes/FromNearestSpecified.java +++ b/src/org/apache/fop/datatypes/FromNearestSpecified.java @@ -1,6 +1,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -66,7 +67,7 @@ public class FromNearestSpecified extends AbstractPropertyValue { public FromNearestSpecified(int property) throws PropertyException { - super(property); + super(property, PropertyValue.FROM_NEAREST_SPECIFIED); } /** @@ -77,7 +78,7 @@ public class FromNearestSpecified extends AbstractPropertyValue { public FromNearestSpecified(String propertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.FROM_NEAREST_SPECIFIED); } /** diff --git a/src/org/apache/fop/datatypes/FromParent.java b/src/org/apache/fop/datatypes/FromParent.java index e671ff27d..9497a9554 100644 --- a/src/org/apache/fop/datatypes/FromParent.java +++ b/src/org/apache/fop/datatypes/FromParent.java @@ -1,6 +1,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -65,7 +66,7 @@ public class FromParent extends AbstractPropertyValue { public FromParent(int property) throws PropertyException { - super(property); + super(property, PropertyValue.FROM_PARENT); } /** @@ -76,7 +77,7 @@ public class FromParent extends AbstractPropertyValue { public FromParent(String propertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.FROM_PARENT); } /** diff --git a/src/org/apache/fop/datatypes/Inherit.java b/src/org/apache/fop/datatypes/Inherit.java index e273cd998..3a6b94a94 100644 --- a/src/org/apache/fop/datatypes/Inherit.java +++ b/src/org/apache/fop/datatypes/Inherit.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.Properties; import org.apache.fop.fo.PropertyConsts; @@ -41,7 +42,7 @@ public class Inherit extends AbstractPropertyValue { public Inherit(int property, int sourceProperty) throws PropertyException { - super(property); + super(property, PropertyValue.INHERIT); this.sourceProperty = sourceProperty; } @@ -66,7 +67,7 @@ public class Inherit extends AbstractPropertyValue { public Inherit(String propertyName, String sourcePropertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.INHERIT); property = PropertyConsts.getPropertyIndex(propertyName); sourceProperty = PropertyConsts.getPropertyIndex(sourcePropertyName); } diff --git a/src/org/apache/fop/datatypes/IntegerType.java b/src/org/apache/fop/datatypes/IntegerType.java index dc80477df..c351b5d4e 100644 --- a/src/org/apache/fop/datatypes/IntegerType.java +++ b/src/org/apache/fop/datatypes/IntegerType.java @@ -3,6 +3,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.Properties; /* @@ -34,7 +35,7 @@ public class IntegerType extends AbstractPropertyValue { public IntegerType (int property, int value) throws PropertyException { - super(property); + super(property, PropertyValue.INTEGER); intval = value; } @@ -47,7 +48,7 @@ public class IntegerType extends AbstractPropertyValue { public IntegerType (String propertyName, int value) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.INTEGER); intval = value; } diff --git a/src/org/apache/fop/datatypes/LanguageType.java b/src/org/apache/fop/datatypes/LanguageType.java index cd8153d1d..14416d387 100644 --- a/src/org/apache/fop/datatypes/LanguageType.java +++ b/src/org/apache/fop/datatypes/LanguageType.java @@ -5,6 +5,7 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; import org.apache.fop.configuration.Configuration; +import org.apache.fop.fo.expr.PropertyValue; /* * LanguageType.java @@ -29,7 +30,7 @@ public class LanguageType extends NCName { public LanguageType(int property, String languageCode) throws PropertyException { - super(property, languageCode); + super(property, languageCode, PropertyValue.LANGUAGE); // Validate the code if (Configuration.getHashMapEntry("languagesMap", languageCode) == null) throw new PropertyException diff --git a/src/org/apache/fop/datatypes/Literal.java b/src/org/apache/fop/datatypes/Literal.java index 118f089a2..7cb512188 100644 --- a/src/org/apache/fop/datatypes/Literal.java +++ b/src/org/apache/fop/datatypes/Literal.java @@ -4,6 +4,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; import org.apache.fop.fo.PropertyConsts; +import org.apache.fop.fo.expr.PropertyValue; /* * Literal.java @@ -33,7 +34,7 @@ public class Literal extends StringType { public Literal(int property, String string) throws PropertyException { - super(property, string); + super(property, string, PropertyValue.LITERAL); } /** diff --git a/src/org/apache/fop/datatypes/MappedNumeric.java b/src/org/apache/fop/datatypes/MappedNumeric.java index c6b39e74d..8d7328821 100644 --- a/src/org/apache/fop/datatypes/MappedNumeric.java +++ b/src/org/apache/fop/datatypes/MappedNumeric.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.datatypes.EnumType; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; import org.apache.fop.fo.FOTree; @@ -45,8 +46,8 @@ public class MappedNumeric extends EnumType { { // Set property index in AbstractPropertyValue // and enumValue enum constant in EnumType - super(property, enumText); - mappedNum = foTree.getMappedNumArrayValue(property, enumValue); + super(property, enumText, PropertyValue.MAPPED_NUMERIC); + mappedNum = PropertyConsts.getMappedNumeric(property, enumValue); } /** @@ -62,8 +63,8 @@ public class MappedNumeric extends EnumType { { // Set property index in AbstractPropertyValue // and enumValue enum constant in EnumType - super(propertyName, enumText); - mappedNum = foTree.getMappedNumArrayValue(property, enumValue); + super(propertyName, enumText, PropertyValue.MAPPED_NUMERIC); + mappedNum = PropertyConsts.getMappedNumeric(property, enumValue); } /** @@ -78,7 +79,7 @@ public class MappedNumeric extends EnumType { * validate the MappedNumeric against the associated property. */ public void validate() throws PropertyException { - super.validate(Properties.MAPPED_NUMERIC); + super.validate(Properties.MAPPED_LENGTH); } public String toString() { diff --git a/src/org/apache/fop/datatypes/MimeType.java b/src/org/apache/fop/datatypes/MimeType.java index 14d291963..4b6774018 100644 --- a/src/org/apache/fop/datatypes/MimeType.java +++ b/src/org/apache/fop/datatypes/MimeType.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.expr.AbstractPropertyValue; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.Properties; /* @@ -40,7 +41,7 @@ public class MimeType extends AbstractPropertyValue { public MimeType(int property, String mimetype) throws PropertyException { - super(property); + super(property, PropertyValue.MIME_TYPE); this.mimetype = mimetype; } @@ -54,7 +55,7 @@ public class MimeType extends AbstractPropertyValue { public MimeType(String propertyName, String mimetype) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.MIME_TYPE); this.mimetype = mimetype; } diff --git a/src/org/apache/fop/datatypes/NCName.java b/src/org/apache/fop/datatypes/NCName.java index 9e6127796..4f332ddfe 100644 --- a/src/org/apache/fop/datatypes/NCName.java +++ b/src/org/apache/fop/datatypes/NCName.java @@ -4,6 +4,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; import org.apache.fop.datatypes.StringType; +import org.apache.fop.fo.expr.PropertyValue; /* * NCName.java @@ -17,7 +18,8 @@ import org.apache.fop.datatypes.StringType; * @version $Revision$ $Name$ */ /** - * An NCName. + * An NCName. NCName may be instantiated directly, and it also serves as a + * base class for a number of specific PropertyValue types. */ public class NCName extends StringType { @@ -26,6 +28,8 @@ public class NCName extends StringType { private static final String revision = "$Revision$"; /** + * Used when NCName is used directly as the + * PropertyValue type. * @param property the int index of the property on which * this value is being defined. * @param string the String. @@ -34,10 +38,12 @@ public class NCName extends StringType { public NCName (int property, String string) throws PropertyException { - super(property, string); + super(property, string, PropertyValue.NCNAME); } /** + * Used when NCName is used directly as the + * PropertyValue type. * @param propertyName the StringString. @@ -46,7 +52,35 @@ public class NCName extends StringType { public NCName (String propertyName, String string) throws PropertyException { - super(propertyName, string); + super(propertyName, string, PropertyValue.NCNAME); + } + + /** + * Used when NCName is a base class for another type. + * @param property the int index of the property on which + * this value is being defined. + * @param string the String. + * @param type the type of PropertyValue being instantiated. + * @exception PropertyException + */ + public NCName (int property, String string, int type) + throws PropertyException + { + super(property, string, type); + } + + /** + * Used when NCName is a base class for another type. + * @param propertyName the StringString. + * @param type the type of PropertyValue being instantiated. + * @exception PropertyException + */ + public NCName (String propertyName, String string, int type) + throws PropertyException + { + super(propertyName, string, type); } /** diff --git a/src/org/apache/fop/datatypes/None.java b/src/org/apache/fop/datatypes/None.java index 34eb05972..2df7c85cb 100644 --- a/src/org/apache/fop/datatypes/None.java +++ b/src/org/apache/fop/datatypes/None.java @@ -1,5 +1,6 @@ package org.apache.fop.datatypes; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -32,7 +33,7 @@ public class None extends AbstractPropertyValue { public None(int property) throws PropertyException { - super(property); + super(property, PropertyValue.NONE); } /** @@ -43,7 +44,7 @@ public class None extends AbstractPropertyValue { public None(String propertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.NONE); } /** diff --git a/src/org/apache/fop/datatypes/Numeric.java b/src/org/apache/fop/datatypes/Numeric.java index fd705759f..971d4b2dd 100644 --- a/src/org/apache/fop/datatypes/Numeric.java +++ b/src/org/apache/fop/datatypes/Numeric.java @@ -16,6 +16,7 @@ import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; +import org.apache.fop.fo.expr.PropertyValue; /** @@ -162,7 +163,7 @@ public class Numeric extends AbstractPropertyValue implements Cloneable { (int property, double value, int baseunit, int power, int unit) throws PropertyException { - super(property); + super(property, PropertyValue.NUMERIC); // baseunit must be a power of 2 <= the LAST_BASEUNIT if ((baseunit & (baseunit - 1)) != 0 || baseunit > LAST_BASEUNIT) diff --git a/src/org/apache/fop/datatypes/ScriptType.java b/src/org/apache/fop/datatypes/ScriptType.java index db504c762..217fe6bc7 100644 --- a/src/org/apache/fop/datatypes/ScriptType.java +++ b/src/org/apache/fop/datatypes/ScriptType.java @@ -5,6 +5,7 @@ import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.Properties; import org.apache.fop.configuration.Configuration; +import org.apache.fop.fo.expr.PropertyValue; /* * ScriptType.java @@ -28,7 +29,7 @@ public class ScriptType extends NCName { public ScriptType(int property, String scriptCode) throws PropertyException { - super(property, scriptCode); + super(property, scriptCode, PropertyValue.SCRIPT); // Validate the code if (Configuration.getHashMapEntry("scriptsMap", scriptCode) == null) throw new PropertyException diff --git a/src/org/apache/fop/datatypes/ShadowEffect.java b/src/org/apache/fop/datatypes/ShadowEffect.java index c281da7fa..9a50e5550 100644 --- a/src/org/apache/fop/datatypes/ShadowEffect.java +++ b/src/org/apache/fop/datatypes/ShadowEffect.java @@ -1,5 +1,6 @@ package org.apache.fop.datatypes; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyValueList; import org.apache.fop.fo.expr.PropertyException; @@ -65,7 +66,7 @@ public class ShadowEffect extends AbstractPropertyValue { public ShadowEffect(int property, PropertyValueList list) throws PropertyException { - super(property); + super(property, PropertyValue.SHADOW_EFFECT); Object entry; Iterator entries = list.iterator(); switch (list.size()) { diff --git a/src/org/apache/fop/datatypes/Slash.java b/src/org/apache/fop/datatypes/Slash.java index f8af53560..334cc0547 100644 --- a/src/org/apache/fop/datatypes/Slash.java +++ b/src/org/apache/fop/datatypes/Slash.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.Properties; @@ -35,7 +36,7 @@ public class Slash extends AbstractPropertyValue { public Slash (int property) throws PropertyException { - super(property); + super(property, PropertyValue.SLASH); } /** @@ -46,7 +47,7 @@ public class Slash extends AbstractPropertyValue { public Slash (String propertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.SLASH); } public String toString() { diff --git a/src/org/apache/fop/datatypes/StringType.java b/src/org/apache/fop/datatypes/StringType.java index bcc061df7..254654aa0 100644 --- a/src/org/apache/fop/datatypes/StringType.java +++ b/src/org/apache/fop/datatypes/StringType.java @@ -2,6 +2,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.Properties; @@ -17,7 +18,9 @@ import org.apache.fop.fo.Properties; * @version $Revision$ $Name$ */ /** - * The base class for most datatypes which resolve to a String. + * StringType is not intended to be instantiated directly. It + * is a base class for the two basic types of String + * properties: NCName and Literal. */ public class StringType extends AbstractPropertyValue { @@ -31,12 +34,13 @@ public class StringType extends AbstractPropertyValue { * @param property the int index of the property on which * this value is being defined. * @param string the String. + * @param type the type of PropertyValue being instantiated. * @exception PropertyException */ - public StringType (int property, String string) + public StringType (int property, String string, int type) throws PropertyException { - super(property); + super(property, type); this.string = string; } @@ -44,12 +48,13 @@ public class StringType extends AbstractPropertyValue { * @param propertyName the StringString. + * @param type the type of PropertyValue being instantiated. * @exception PropertyException */ - public StringType (String propertyName, String string) + public StringType (String propertyName, String string, int type) throws PropertyException { - super(propertyName); + super(propertyName, type); this.string = string; } diff --git a/src/org/apache/fop/datatypes/TextDecorations.java b/src/org/apache/fop/datatypes/TextDecorations.java index 850370f28..451e42121 100644 --- a/src/org/apache/fop/datatypes/TextDecorations.java +++ b/src/org/apache/fop/datatypes/TextDecorations.java @@ -1,5 +1,6 @@ package org.apache.fop.datatypes; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -44,7 +45,7 @@ public class TextDecorations public TextDecorations(int property, byte decorations) throws PropertyException { - super(property); + super(property, PropertyValue.TEXT_DECORATIONS); this.decorations = decorations; } @@ -56,7 +57,7 @@ public class TextDecorations public TextDecorations(String propertyName) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.TEXT_DECORATIONS); this.decorations = decorations; } diff --git a/src/org/apache/fop/datatypes/TextDecorator.java b/src/org/apache/fop/datatypes/TextDecorator.java index f75ccce0e..615e9cc49 100644 --- a/src/org/apache/fop/datatypes/TextDecorator.java +++ b/src/org/apache/fop/datatypes/TextDecorator.java @@ -1,5 +1,6 @@ package org.apache.fop.datatypes; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -46,7 +47,7 @@ public class TextDecorator extends AbstractPropertyValue { public TextDecorator(int property, byte onMask, byte offMask) throws PropertyException { - super(property); + super(property, PropertyValue.TEXT_DECORATOR); this.onMask = onMask; this.offMask = offMask; } @@ -59,7 +60,7 @@ public class TextDecorator extends AbstractPropertyValue { public TextDecorator(String propertyName, byte onMask, byte offMask) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.TEXT_DECORATOR); this.onMask = onMask; this.offMask = offMask; } diff --git a/src/org/apache/fop/datatypes/Time.java b/src/org/apache/fop/datatypes/Time.java index 8963ffda1..a2e3865bd 100644 --- a/src/org/apache/fop/datatypes/Time.java +++ b/src/org/apache/fop/datatypes/Time.java @@ -1,6 +1,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.Properties; @@ -52,7 +53,7 @@ public class Time extends AbstractPropertyValue { public Time(int property, int unit, double value) throws PropertyException { - super(property); + super(property, PropertyValue.TIME); units = unit; time = value * msPerUnit[unit]; } @@ -68,7 +69,7 @@ public class Time extends AbstractPropertyValue { public Time(String propertyName, int unit, double value) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.TIME); units = unit; time = value * msPerUnit[unit]; } diff --git a/src/org/apache/fop/datatypes/UriType.java b/src/org/apache/fop/datatypes/UriType.java index 94330b88b..d18b53a01 100644 --- a/src/org/apache/fop/datatypes/UriType.java +++ b/src/org/apache/fop/datatypes/UriType.java @@ -1,5 +1,6 @@ package org.apache.fop.datatypes; +import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.AbstractPropertyValue; import org.apache.fop.fo.expr.PropertyException; import org.apache.fop.fo.Properties; @@ -39,7 +40,7 @@ public class UriType extends AbstractPropertyValue { public UriType(int property, String uri) throws PropertyException { - super(property); + super(property, PropertyValue.URI_TYPE); this.uri = uri; } @@ -53,7 +54,7 @@ public class UriType extends AbstractPropertyValue { public UriType(String propertyName, String uri) throws PropertyException { - super(propertyName); + super(propertyName, PropertyValue.URI_TYPE); this.uri = uri; } -- 2.39.5