cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/10/08 22:53:32 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Added specific error test for LIST passed to refineParsing(). Revision ChangesPath No revision No revision 1.1.2.32 +8 -3 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.31 retrieving revision 1.1.2.32 diff -u -r1.1.2.31 -r1.1.2.32 --- Properties.java 4 Oct 2002 15:57:56 - 1.1.2.31 +++ Properties.java 9 Oct 2002 05:53:30 - 1.1.2.32 @@ -424,6 +424,11 @@ if (pv == value) return value; // unable to resolve // TODO: validate here return pv; +case PropertyValue.LIST: +System.out.println((PropertyValueList)value); +throw new PropertyException +(PropertyValueList passed to Properties.refineParsing for ++ propName); default: if ( ! nested) { if ((datatype COMPOUND) != 0) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/10/04 08:57:57 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Added support for NoType PropertyValue. Revision ChangesPath No revision No revision 1.1.2.31 +5 -4 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.30 retrieving revision 1.1.2.31 diff -u -r1.1.2.30 -r1.1.2.31 --- Properties.java 2 Oct 2002 15:14:21 - 1.1.2.30 +++ Properties.java 4 Oct 2002 15:57:56 - 1.1.2.31 @@ -35,6 +35,7 @@ import org.apache.fop.datastructs.ROStringArray; import org.apache.fop.datastructs.ROIntArray; import org.apache.fop.datatypes.Ints; +import org.apache.fop.datatypes.NoType; import org.apache.fop.datatypes.StringType; import org.apache.fop.datatypes.NCName; import org.apache.fop.datatypes.CountryType; @@ -557,7 +558,7 @@ + PropNames.getPropertyName(property)); switch (initialValueType) { case NOTYPE_IT: -return null; +return new NoType(property); case AUTO_IT: return new Auto(property); case NONE_IT: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/10/02 00:06:27 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Split ShorthandPropSets from PropertySets. Revision ChangesPath No revision No revision 1.1.2.29 +40 -38xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.28 retrieving revision 1.1.2.29 diff -u -r1.1.2.28 -r1.1.2.29 --- Properties.java 1 Oct 2002 16:30:33 - 1.1.2.28 +++ Properties.java 2 Oct 2002 07:06:25 - 1.1.2.29 @@ -23,6 +23,7 @@ import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.PropertyConsts; +import org.apache.fop.fo.ShorthandPropSets; import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FObjects; import org.apache.fop.datatypes.PropertyValue; @@ -425,7 +426,7 @@ default: if ( ! nested) { if ((datatype COMPOUND) != 0) -return PropertySets.expandCompoundProperty +return ShorthandPropSets.expandCompoundProperty (foNode.foTree, value); if (proptype == PropertyValue.INHERIT) { if ((datatype INHERIT) != 0) @@ -597,7 +598,7 @@ * a border-EDGE-width MappedNumeric or inheritance value * * N.B. this is the order of elements defined in - * PropertySets.borderRightExpansion + * ShorthandPropSets.borderRightExpansion */ protected static PropertyValue borderEdge(FONode foNode, PropertyValue value, int styleProp, int colorProp, int widthProp) @@ -635,7 +636,7 @@ { // Copy the value to each member of the shorthand expansion return refineExpansionList -(foNode, PropertySets.expandAndCopySHand(value)); +(foNode, ShorthandPropSets.expandAndCopySHand(value)); } } // Make a list and pass to processList @@ -1138,7 +1139,7 @@ { // Copy the value to each member of the shorthand expansion return refineExpansionList -(foNode, PropertySets.expandAndCopySHand(value)); +(foNode, ShorthandPropSets.expandAndCopySHand(value)); } else { // Make a list and pass to processList PropertyValueList tmpList @@ -1503,7 +1504,7 @@ type == PropertyValue.FROM_NEAREST_SPECIFIED) { // Copy the value to each member of the shorthand newlist = refineExpansionList -(foNode, PropertySets.expandAndCopySHand(value)); +(foNode, ShorthandPropSets.expandAndCopySHand(value)); } } @@ -1951,7 +1952,7 @@ type == PropertyValue.FROM_NEAREST_SPECIFIED) // Copy the value to each member of the shorthand expansion return refineExpansionList -(foNode, PropertySets.expandAndCopySHand(value)); +(foNode, ShorthandPropSets.expandAndCopySHand(value)); PropertyValueList ssList = null; // Must be a space-separated list or a single value from the @@ -2245,7 +2246,7 @@ * a border-EDGE-width MappedNumeric or inheritance value * * N.B. this is the order of elements defined in - * PropertySets.borderRightExpansion + * ShorthandPropSets.borderRightExpansion * * @param foNode - the ttFONode/tt being built * @param value ttPropertyValue/tt returned by the parser @@ -2397,12 +2398,12 @@ if (type == PropertyValue.INHERIT || type == PropertyValue.FROM_PARENT || type == PropertyValue.FROM_NEAREST_SPECIFIED) -return refineExpansionList -(foNode, PropertySets.expandAndCopySHand(value)); +return refineExpansionList(foNode, +ShorthandPropSets.expandAndCopySHand(value)); } if (type == PropertyValue.COLOR_TYPE) return refineExpansionList -(foNode, PropertySets.expandAndCopySHand(value)); +(foNode, ShorthandPropSets.expandAndCopySHand(value)); if (type == PropertyValue.NCNAME) {
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/10/01 09:30:36 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: AURAL type PropertyNotImplementedException in refineParsing(). Changed AURAL_IT initial value types to NOTYPE_IT. Revision ChangesPath No revision No revision 1.1.2.28 +28 -32xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.27 retrieving revision 1.1.2.28 diff -u -r1.1.2.27 -r1.1.2.28 --- Properties.java 26 Sep 2002 14:27:48 - 1.1.2.27 +++ Properties.java 1 Oct 2002 16:30:33 - 1.1.2.28 @@ -346,6 +346,9 @@ int datatype = PropertyConsts.dataTypes.get(property); int proptype = value.getType(); PropertyValue pv; +if ((datatype AURAL) != 0) +throw new PropertyNotImplementedException +(AURAL properties are not supported); switch (proptype) { case PropertyValue.NUMERIC: // Can be any of @@ -544,10 +547,8 @@ public static PropertyValue getInitialValue(int property) throws PropertyException { -System.out.println(Invoking default getInitialValue(+property+)); Method method = null; int initialValueType = PropertyConsts.getInitialValueType(property); -System.out.println(initialValueType: + initialValueType); if ((initialValueType Properties.USE_GET_IT_FUNCTION) != 0) throw new PropertyException (Properties.getInitialValue() called for property with @@ -561,12 +562,7 @@ case NONE_IT: return new None(property); case AURAL_IT: -System.out.println(In AURAL_IT); -System.out.println -(Aural properties not implemented: -+ PropNames.getPropertyName(property)); -//throw new PropertyNotImplementedException -throw new PropertyException +throw new PropertyNotImplementedException (Aural properties not implemented: + PropNames.getPropertyName(property)); default: @@ -1077,7 +1073,7 @@ public static class Azimuth extends Properties { public static final int dataTypes = AURAL; public static final int traitMapping = RENDERING; -public static final int initialValueType = AURAL_IT; +public static final int initialValueType = NOTYPE_IT; public static final int inherited = COMPUTED; } @@ -3666,7 +3662,7 @@ public static class Cue extends Properties { public static final int dataTypes = SHORTHAND; public static final int traitMapping = SHORTHAND_MAP; -public static final int initialValueType = AURAL_IT; +public static final int initialValueType = NOTYPE_IT; public static final int inherited = NO; /** @@ -3735,14 +3731,14 @@ public static class CueAfter extends Properties { public static final int dataTypes = AURAL; public static final int traitMapping = RENDERING; -public static final int initialValueType = AURAL_IT; +public static final int initialValueType = NOTYPE_IT; public static final int inherited = NO; } public static class CueBefore extends Properties { public static final int dataTypes = AURAL; public static final int traitMapping = RENDERING; -public static final int initialValueType = AURAL_IT; +public static final int initialValueType = NOTYPE_IT; public static final int inherited = NO; } @@ -3847,7 +3843,7 @@ public static class Elevation extends Properties { public static final int dataTypes = AURAL; public static final int traitMapping = RENDERING; -public static final int initialValueType = AURAL_IT; +public static final int initialValueType = NOTYPE_IT; public static final int inherited = COMPUTED; } @@ -5474,7 +5470,7 @@ public static final int dataTypes = COMPOUND| PERCENTAGE | LENGTH | NUMBER | MAPPED_LENGTH | INHERIT; public static final int traitMapping = FORMATTING; -public static final int initialValueType = LENGTH_IT; +public static final int initialValueType = NOTYPE_IT; public static final int NORMAL = 1; public static final int inherited = NO; @@ -6580,42 +6576,42 @@ public static class Pause extends Properties { public static final int dataTypes = AURAL; public
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/09/26 07:27:49 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Modifications to data type sepcifications. Removed calls to initialValueSHandExpansion(). Added compound expansions. Revision ChangesPath No revision No revision 1.1.2.27 +107 -94 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.26 retrieving revision 1.1.2.27 diff -u -r1.1.2.26 -r1.1.2.27 --- Properties.java 23 Sep 2002 06:33:27 - 1.1.2.26 +++ Properties.java 26 Sep 2002 14:27:48 - 1.1.2.27 @@ -105,31 +105,31 @@ ,PERCENTAGE = 16 ,CHARACTER_T = 32 ,LITERAL = 64 - ,NAME = 128 +,NCNAME = 128 ,COLOR_T = 256 ,COUNTRY_T = 512 ,LANGUAGE_T = 1024 ,SCRIPT_T = 2048 - ,ID_T = 4096 - ,IDREF = 8192 - ,URI_SPECIFICATION = 16384 - ,TIME = 32768 - ,FREQUENCY = 65536 + ,URI_SPECIFICATION = 4096 + ,TIME = 8192 + ,FREQUENCY = 16384 // Pseudotypes - ,BOOL = 131072 - ,INHERIT = 262144 - ,ENUM = 524288 - ,MAPPED_LENGTH = 1048576 - ,SHORTHAND = 2097152 - ,COMPLEX = 4194304 - ,AUTO = 8388608 - ,NONE = 16777216 - ,AURAL = 33554432 + ,BOOL = 32768 + ,INHERIT = 65536 + ,ENUM = 131072 + ,MAPPED_LENGTH = 262144 + ,SHORTHAND = 524288 + ,COMPLEX = 1048576 + ,AUTO = 2097152 + ,NONE = 4194304 + ,AURAL = 8388608 // Color plus transparent - ,COLOR_TRANS = 67108864 - ,MIMETYPE = 134217728 - ,FONTSET = 268435456 - ,COMPOUND = 536870912 + ,COLOR_TRANS = 16777216 + ,MIMETYPE = 33554432 + ,FONTSET = 67108864 + ,COMPOUND = 134217728 +// ,SPARE = 268435456 +// ,SPARE = 536870912 // ,SPARE = 1073741824 // ,SPARE = -2147483648 @@ -145,11 +145,10 @@ ,NUMBER = FLOAT | INTEGER ,ENUM_TYPE = ENUM | MAPPED_LENGTH -,STRING = LITERAL | ENUM_TYPE +,STRING = LITERAL | NCNAME ,HYPH_TYPE = COUNTRY_T | LANGUAGE_T | SCRIPT_T - ,ID_TYPE = ID_T | IDREF -,NCNAME = NAME | ID_TYPE | HYPH_TYPE | ENUM_TYPE - ,STRING_TYPE = STRING | NCNAME + ,NAME_TYPE = NCNAME | HYPH_TYPE | ENUM_TYPE + ,STRING_TYPE = STRING | NAME_TYPE ,ANY_TYPE = ~0 ; @@ -172,13 +171,11 @@ if ((datatypes PERCENTAGE) != 0) typeNames += percentage|; if ((datatypes CHARACTER_T) != 0) typeNames += character|; if ((datatypes STRING) != 0) typeNames += string|; -if ((datatypes NAME) != 0) typeNames += name|; +if ((datatypes NCNAME) != 0) typeNames += ncname|; if ((datatypes COLOR_T) != 0) typeNames += color|; if ((datatypes COUNTRY_T) != 0) typeNames += country|; if ((datatypes LANGUAGE_T) != 0) typeNames += language|; if ((datatypes SCRIPT_T) != 0) typeNames += script|; -if ((datatypes ID_T) != 0) typeNames += id|; -if ((datatypes IDREF) != 0) typeNames += idref|; if ((datatypes URI_SPECIFICATION) != 0) typeNames += uri-specification|; if ((datatypes TIME) != 0) typeNames += time|; @@ -212,7 +209,7 @@ ,PERCENTAGE_IT = 16 ,CHARACTER_IT = 32 ,LITERAL_IT = 64 - ,NAME_IT = 128 + ,NCNAME_IT = 128 ,COLOR_IT = 256 ,COUNTRY_IT = 512 ,URI_SPECIFICATION_IT = 1024 @@
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/09/22 23:33:28 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Name change to initialValueSHandExpansion(). Revision ChangesPath No revision No revision 1.1.2.26 +5 -5 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.25 retrieving revision 1.1.2.26 diff -u -r1.1.2.25 -r1.1.2.26 --- Properties.java 21 Sep 2002 04:39:30 - 1.1.2.25 +++ Properties.java 23 Sep 2002 06:33:27 - 1.1.2.26 @@ -1999,7 +1999,7 @@ } // Construct the shorthand expansion list PropertyValueList borderexp = -PropertySets.initialValueExpansion +PropertySets.initialValueSHandExpansion (foNode.foTree, PropNames.BORDER); if (style != null) borderexp = PropertySets.overrideSHandElements(borderexp, @@ -4373,7 +4373,7 @@ // values of individual components newlist = -PropertySets.initialValueExpansion +PropertySets.initialValueSHandExpansion (foNode.foTree, PropNames.FONT); // For each discovered property, override the value in the // initial value expansion. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/09/20 21:39:32 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Changed FOTree arg to refineParsing() to FONode. Added resolve() calls to IndirectValues. Added refineExpansionList() and applied to shorthand expansions. Revision ChangesPath No revision No revision 1.1.2.25 +245 -155 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.24 retrieving revision 1.1.2.25 diff -u -r1.1.2.24 -r1.1.2.25 --- Properties.java 18 Sep 2002 15:42:12 - 1.1.2.24 +++ Properties.java 21 Sep 2002 04:39:30 - 1.1.2.25 @@ -60,6 +60,7 @@ import org.apache.fop.datatypes.ShadowEffect; import org.apache.fop.datatypes.Slash; import org.apache.fop.datatypes.indirect.Inherit; +import org.apache.fop.datatypes.indirect.InheritedValue; import org.apache.fop.datatypes.indirect.FromParent; import org.apache.fop.datatypes.indirect.FromNearestSpecified; @@ -313,19 +314,19 @@ * * pThis method is overriden by individual property classes which * require specific processing. - * @param foTree - the ttFOTree/tt being built + * @param foNode - the ttFONode/tt being built * @param value - ttPropertyValue/tt returned by the parser */ public static PropertyValue refineParsing -(FOTree foTree, PropertyValue value) +(FONode foNode, PropertyValue value) throws PropertyException { -return refineParsing(foTree, value, NOT_NESTED); +return refineParsing(foNode, value, NOT_NESTED); } /** * Do the work for the two argument refineParsing method. - * @param foTree - the ttFOTree/tt being built + * @param foNode - the ttFONode/tt being built * @param value - ttPropertyValue/tt returned by the parser * @param nested - ttboolean/tt indicating whether this method is * called normally (false), or as part of another irefineParsing/i @@ -333,13 +334,14 @@ * @see #refineParsing(FOTree,PropertyValue) */ protected static PropertyValue refineParsing -(FOTree foTree, PropertyValue value, boolean nested) +(FONode foNode, PropertyValue value, boolean nested) throws PropertyException { int property = value.getProperty(); String propName = PropNames.getPropertyName(property); int datatype = PropertyConsts.dataTypes.get(property); int proptype = value.getType(); +PropertyValue pv; switch (proptype) { case PropertyValue.NUMERIC: // Can be any of @@ -363,7 +365,7 @@ if ((datatype ENUM) != 0) return new EnumType(property, ncname); if ((datatype MAPPED_LENGTH) != 0) -return (new MappedNumeric(property, ncname, foTree)) +return (new MappedNumeric(property, ncname, foNode.foTree)) .getMappedNumValue(); case PropertyValue.LITERAL: // Can be LITERAL or CHARACTER_T @@ -396,10 +398,28 @@ if ((datatype MIMETYPE) != 0) return value; throw new PropertyException (mimetype invalid for + propName); +// The following types cannot have their values validated in advance. +// The result must be validated from within the property type. +case PropertyValue.FROM_PARENT: +pv = ((FromParent)value).resolve(foNode); +if (pv == value) return value; // unable to resolve +// TODO: validate here +return pv; +case PropertyValue.FROM_NEAREST_SPECIFIED: +pv = ((FromNearestSpecified)value).resolve(foNode); +if (pv == value) return value; // unable to resolve +// TODO: validate here +return pv; +case PropertyValue.INHERITED_VALUE: +pv = ((InheritedValue)value).resolve(foNode); +if (pv == value) return value; // unable to resolve +// TODO: validate here +return pv; default: if ( ! nested) { if (proptype == PropertyValue.INHERIT) { -if ((datatype INHERIT) != 0) return value; +if ((datatype INHERIT) != 0) +return ((Inherit)value).resolve(foNode); throw new PropertyException ('inherit'
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/08/19 09:42:15 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Renamed verifyParsing to refineParsing. Removed COMPOUND and SHORTHAND_INH inhertance. Added inheritance() method. Revision ChangesPath No revision No revision 1.1.2.19 +269 -207 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -u -r1.1.2.18 -r1.1.2.19 --- Properties.java 3 Aug 2002 13:26:59 - 1.1.2.18 +++ Properties.java 19 Aug 2002 16:42:14 - 1.1.2.19 @@ -127,13 +127,13 @@ ,COLOR_TRANS = 67108864 ,MIMETYPE = 134217728 ,FONTSET = 268435456 -// ,SPARE = 536870912 + ,COMPOUND = 536870912 // ,SPARE = 1073741824 // ,SPARE = -2147483648 // A number of questions are unresolved about the interaction of // complex parsing, property expression parsing property validation. -// At this time (2002/07/03) it looks as though the verifyParsing() method +// At this time (2002/07/03) it looks as though the refineParsing() method // will take full validation responsibility, so it will not be // necessary to specify any individual datatypes besides COMPLEX in the // property dataTypes field. This renders some such specifications @@ -269,18 +269,33 @@ NO = 0 ,COMPUTED = 1 ,SPECIFIED = 2 - ,COMPOUND = 3 - ,SHORTHAND_INH = 4 -,VALUE_SPECIFIC = 5 +,VALUE_SPECIFIC = 3 ; /** - * Constant for nested ttverifyParsing/tt methods + * Derive inherited value for the given property. + * This method must be shadowed by properties with special requirements. + * @param foTree the ttFOTree/tt being built + * @param property the ttint/tt property index + * @return ttPropertyValue/tt the inherited property value for the + * property. It contains the inherited icomputed/i value, and no + * ispecified/i value. + * @exception ttPropertyException/tt + */ +public static PropertyValue inheritance(FOTree foTree, int property) +throws PropertyException +{ +// Is it inherited? +return foTree.getCurrentInherited(property); +} + +/** + * Constant for nested ttrefineParsing/tt methods */ public static boolean IS_NESTED = true; /** - * Constant for non-nested ttverifyParsing/tt methods + * Constant for non-nested ttrefineParsing/tt methods */ public static boolean NOT_NESTED = false; @@ -289,7 +304,7 @@ * 1) PropertyTokenizerbr * 2) PropertyParser - returns context-free ttPropertyValue/tts *recognizable by the parserbr - * 3) verifyParsing - verifies results from parser, translates + * 3) refineParsing - verifies results from parser, translates *property types like NCName into more specific value types, *resolves enumeration types, etc.br * @@ -298,23 +313,23 @@ * @param foTree the ttFOTree/tt being built * @param value ttPropertyValue/tt returned by the parser */ -public static PropertyValue verifyParsing +public static PropertyValue refineParsing (FOTree foTree, PropertyValue value) throws PropertyException { -return verifyParsing(foTree, value, NOT_NESTED); +return refineParsing(foTree, value, NOT_NESTED); } /** - * Do the work for the two argument verifyParsing method. + * Do the work for the two argument refineParsing method. * @param foTree the ttFOTree/tt being built * @param value ttPropertyValue/tt returned by the parser * @param nested ttboolean/tt indicating whether this method is - * called normally (false), or as part of another iverifyParsing/i + * called normally (false), or as part of another irefineParsing/i * method. - * @see #verifyParsing(FOTree,PropertyValue) + * @see #refineParsing(FOTree,PropertyValue) */ -protected static PropertyValue verifyParsing +protected static PropertyValue refineParsing (FOTree foTree, PropertyValue value, boolean nested) throws PropertyException { @@ -371,7 +386,7 @@
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/08/03 06:26:59 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Padding, PageBreakAfter, PageBreakBefore, PageBreakInside Position shorthand expansions. Moved autoOrDistance() inside Border. Other minor fixes. Revision ChangesPath No revision No revision 1.1.2.18 +356 -67 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.17 retrieving revision 1.1.2.18 diff -u -r1.1.2.17 -r1.1.2.18 --- Properties.java 1 Aug 2002 14:12:20 - 1.1.2.17 +++ Properties.java 3 Aug 2002 13:26:59 - 1.1.2.18 @@ -644,40 +644,6 @@ } /** - * @param value ttPropertyValue/tt the value being tested - * @param property ttint/tt property index of returned value - * @return ttPropertyValue/t the same value, with its property set - * to the iproperty/i argument, if it is an Auto or a - * ttNumeric/tt distance - * @exception ttPropertyException/tt if the conditions are not met - */ -protected static PropertyValue autoOrDistance -(PropertyValue value, int property) -throws PropertyException -{ -if (value instanceof Auto || -value instanceof Numeric ((Numeric)value).isDistance()) { -value.setProperty(property); -return value; -} -else throw new PropertyException -(Value not 'Auto' or a distance for -+ PropNames.getPropertyName(value.getProperty())); -} - -/** - * @param value ttPropertyValue/tt the value being tested - * @return ttPropertyValue/t the same value if it is an Auto or a - * ttNumeric/tt distance - * @exception ttPropertyException/tt if the conditions are not met - */ -protected static PropertyValue autoOrDistance(PropertyValue value) -throws PropertyException -{ -return autoOrDistance(value, value.getProperty()); -} - -/** * Pseudo-property class for common border style values occurring in a * number of classes. */ @@ -2358,10 +2324,10 @@ // There must be at least two top = getColor((PropertyValue)(colors.next())); -left = getColor((PropertyValue)(colors.next())); +right = getColor((PropertyValue)(colors.next())); try { bottom = (ColorType)(top.clone()); -right = (ColorType)(left.clone()); +left = (ColorType)(right.clone()); } catch (CloneNotSupportedException cnse) { throw new PropertyException (clone() not supported on ColorType); @@ -2369,14 +2335,14 @@ if (colors.hasNext()) bottom = getColor((PropertyValue)(colors.next())); -if (colors.hasNext()) right +if (colors.hasNext()) left = getColor((PropertyValue)(colors.next())); // Set the properties for each top.setProperty(PropNames.BORDER_TOP_COLOR); -left.setProperty(PropNames.BORDER_LEFT_COLOR); -bottom.setProperty(PropNames.BORDER_BOTTOM_COLOR); right.setProperty(PropNames.BORDER_RIGHT_COLOR); +bottom.setProperty(PropNames.BORDER_BOTTOM_COLOR); +left.setProperty(PropNames.BORDER_LEFT_COLOR); list = new PropertyValueList(PropNames.BORDER_COLOR); list.add(top); @@ -2963,13 +2929,13 @@ // There must be at least two top = Properties.getEnum((PropertyValue)(styles.next()), PropNames.BORDER_TOP_STYLE , style); -left = Properties.getEnum((PropertyValue)(styles.next()), -PropNames.BORDER_LEFT_STYLE, style); +right = Properties.getEnum((PropertyValue)(styles.next()), +PropNames.BORDER_RIGHT_STYLE, style); try { bottom = (EnumType)(top.clone()); bottom.setProperty(PropNames.BORDER_BOTTOM_STYLE); -right = (EnumType)(left.clone()); -right.setProperty(PropNames.BORDER_RIGHT_STYLE); +left = (EnumType)(right.clone()); +left.setProperty(PropNames.BORDER_LEFT_STYLE); }
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/06/27 20:29:44 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Added FOTree arg to complex() method signature. Inital code for font shorthand support. Revision ChangesPath No revision No revision 1.1.2.11 +469 -51 xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- Properties.java 21 Jun 2002 04:54:59 - 1.1.2.10 +++ Properties.java 28 Jun 2002 03:29:43 - 1.1.2.11 @@ -26,6 +26,7 @@ import org.apache.fop.fo.expr.PropertyValue; import org.apache.fop.fo.expr.PropertyValueList; import org.apache.fop.fo.expr.PropertyException; +import org.apache.fop.fo.expr.SystemFontFunction; import org.apache.fop.datastructs.ROStringArray; import org.apache.fop.datastructs.ROIntArray; import org.apache.fop.datatypes.Ints; @@ -58,6 +59,10 @@ */ public abstract class Properties { + +private static final String tag = $Name$; +private static final String revision = $Revision$; + /* * The list of property data types. These are used to form a bitmap of * the property data types that are valid for values of each of the @@ -239,6 +244,31 @@ /** + * Check the PropertyValueList passed as an argument, to determine + * whether it contains a space-separated list from the parser. + * A space-separated list will be represented by a single + * PropertyValueList as an element of the argument PropertyValueList. + * @param list ttPropertyValueList/tt the containing list. + * @return ttPropertyValueList/tt the contained space-separated list. + * @exception ttPropertyException/tt + */ +private static PropertyValueList spaceSeparatedList +(PropertyValueList list) +throws PropertyException +{ +if (list.size() != 1) +throw new PropertyException +(list.getClass().getName() + list is not a ++ single list of space-separated values); +PropertyValue val2 = (PropertyValue)(list.getFirst()); +if ( ! (val2 instanceof PropertyValueList)) +throw new PropertyException +(list.getClass().getName() + list is not a ++ single list of space-separated values); +return (PropertyValueList)val2; +} + +/** * Return the EnumType derived from the argument. * The argument must be an NCName whose string value is a * valid Enum for the property associated with the NCName. @@ -304,6 +334,8 @@ /** * 'value' is a PropertyValueList or an individual PropertyValue. + * If 'value' is a PropertyValueList, it must contain a single + * PropertyValueList, which in turn contains the individual elements. * * 'value' can contain a parsed Inherit value, * parsed FromParent value, parsed FromNearestSpecified value, @@ -335,7 +367,8 @@ return processEdgeValue(value, styleProp, colorProp, widthProp); } else { return processEdgeList -((PropertyValueList)value, styleProp, colorProp, widthProp); +(spaceSeparatedList((PropertyValueList)value), +styleProp, colorProp, widthProp); } } @@ -784,6 +817,8 @@ /** * 'value' is a PropertyValueList or an individual PropertyValue. + * If 'value' is a PropertyValueList, it must contain a single + * PropertyValueList, which in turn contains the individual elements. * * 'value' can contain a parsed Inherit value or, in any order; * background-color @@ -800,8 +835,9 @@ * one or two parsed NCNames containing enumeration tokens * * pThe value(s) provided, if valid, are converted into a list - * containing the expansion of the shorthand. The elements may - * be in any order. A minimum of one value will be present. + * containing the expansion of the shorthand. Any subset of the + * elements may be present, from minimum of one. The elements + * which are present will always occur in the following order: * * a BackgroundColor ColorType or Inherit value * a BackgroundImage UriType, None or Inherit value @@ -810,18 +846,19 @@ * a
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/06/20 21:41:51 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: cue shorthand Revision ChangesPath No revision No revision 1.1.2.9 +59 -11xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- Properties.java 20 Jun 2002 14:53:51 - 1.1.2.8 +++ Properties.java 21 Jun 2002 04:41:50 - 1.1.2.9 @@ -432,7 +432,7 @@ // associated property indices, as expanded from the // border-right shorthand. if (style != null) newlist.add(style); -if (color != null) newlist.add(style); +if (color != null) newlist.add(color); if (width != null) newlist.add(width); return newlist; } @@ -2416,21 +2416,19 @@ object for border-spacing); } else { // Must be a pair of Lengths -if (((PropertyValueList)value).size() != 2) +PropertyValueList list = (PropertyValueList)value; +if (list.size() != 2) throw new PropertyException -(List of + ((PropertyValueList)value).size() + - for BorderSpacing); -PropertyValue len1 -= (PropertyValue)(((PropertyValueList)value).getFirst()); -PropertyValue len2 -= (PropertyValue)(((PropertyValueList)value).getLast()); +(List of + list.size() + for border-spacing); +PropertyValue len1 = (PropertyValue)(list.getFirst()); +PropertyValue len2 = (PropertyValue)(list.getLast()); // Note that this test excludes (deliberately) ems relative // lengths. I don't know whether this exclusion is valid. if ( ! (len1 instanceof Numeric len2 instanceof Numeric ((Numeric)len1).isLength() ((Numeric)len2).isLength())) throw new PropertyException -(2 values to BorderSpacing are not Lengths); +(Values to border-spacing are not both Lengths); // Set the individual expanded properties of the // border-separation compound property // Should I clone these values? @@ -3156,6 +3154,56 @@ public static final int traitMapping = SHORTHAND_MAP; public static final int initialValueType = AURAL_IT; public static final int inherited = NO; + +/** + * 'value' is a PropertyValueList or an individual PropertyValue. + * + * pIf 'value' is an individual PropertyValue, it must contain + * either + * a parsed UriType value, + * a FromParent value, + * a FromNearestSpecified value, + * or an Inherit value. + * + * pIf 'value' is a PropertyValueList, it contains a list of + * 2 parsed UriType values. + * + * pThe value(s) provided, if valid, are converted into a list + * containing the expansion of the shorthand. + * The first element is a value for cue-before, + * the second element is a value for cue-after. + */ +public static PropertyValue complex(PropertyValue value) +throws PropertyException +{ +if ( ! (value instanceof PropertyValueList)) { +if (value instanceof Inherit +|| value instanceof FromParent +|| value instanceof FromNearestSpecified +|| value instanceof UriType +) +return PropertySets.expandAndCopySHand(value); +} else { +// List may contain only 2 uri specifiers +PropertyValueList list = (PropertyValueList)value; +if (list.size() != 2) +throw new PropertyException +(List of + list.size() + for cue); +PropertyValue cue1 = (PropertyValue)(list.getFirst()); +PropertyValue cue2 = (PropertyValue)(list.getLast()); + +if ( ! ((cue1 instanceof UriType) +(cue2 instanceof UriType))) +throw new PropertyException +(Values to cue are not both URIs); +// Set the individual expanded properties of
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/06/13 08:08:52 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Added Background shorthand support Revision ChangesPath No revision No revision 1.1.2.4 +264 -6xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- Properties.java 9 Jun 2002 10:22:46 - 1.1.2.3 +++ Properties.java 13 Jun 2002 15:08:52 - 1.1.2.4 @@ -12,10 +12,14 @@ import java.lang.Class; import java.util.Iterator; +import java.util.ListIterator; import java.util.HashMap; import java.util.Map; import java.util.LinkedList; import java.util.Collections; + +import org.apache.fop.messaging.MessageHandler; + import org.apache.fop.fo.PropertyConsts; import org.apache.fop.fo.FOTree; import org.apache.fop.fo.FObjects; @@ -37,6 +41,7 @@ import org.apache.fop.datatypes.Bool; import org.apache.fop.datatypes.Literal; import org.apache.fop.datatypes.Auto; +import org.apache.fop.datatypes.None; import org.apache.fop.datatypes.Inherit; import org.apache.fop.datatypes.ColorType; import org.apache.fop.datatypes.FontFamilySet; @@ -582,6 +587,257 @@ public static final int traitMapping = SHORTHAND_MAP; public static final int initialValueType = NOTYPE_IT; public static final int inherited = NO; + +/** + * 'value' is a PropertyValueList or an individual PropertyValue. + * + * 'value' can contain a parsed Inherit value or, in any order; + * background-color + * a parsed ColorType value, or an NCName containing one of + * the standard colors + * background-image + * a parsed UriType value, or a parsed None value + * background-repeat + * a parsed NCName containing a repeat enumeration token + * background-attachment + * a parsed NCName containing 'scroll' or 'fixed' + * background-position + * one or two parsed Length or Percentage values, or + * one or two parsed NCNames containing enumeration tokens + * + * pThe value(s) provided, if valid, are converted into a list + * containing the expansion of the shorthand. The elements may + * be in any order. A minimum of one value will be present. + * + * a BackgroundColor ColorType or Inherit value + * a BackgroundImage UriType, None or Inherit value + * a BackgroundRepeat EnumType or Inherit value + * a BackgroundAttachment EnumType or Inherit value + * a BackgroundPositionHorizontal Numeric or Inherit value + * a BackgroundPositionVertical Numeric or Inherit value + */ +public static PropertyValue complex +(int property, PropertyValue value) throws PropertyException +{ +if ( ! (value instanceof PropertyValueList)) { +return processValue(property, value); +} else { +return processList(property, (PropertyValueList)value); +} +} + +private static PropertyValueList processValue +(int property, PropertyValue value) throws PropertyException +{ +PropertyValueList newlist = new PropertyValueList(property); +// Can be Inherit, ColorType, UriType, None, Numeric, or an +// NCName (i.e. enum token) +if (value instanceof Inherit) { +// Construct a list of Inherit values +newlist.add(new Inherit( +PropNames.BACKGROUND_COLOR)); +newlist.add(new Inherit( +PropNames.BACKGROUND_IMAGE)); +newlist.add(new Inherit( +PropNames.BACKGROUND_REPEAT)); +newlist.add(new Inherit( +PropNames.BACKGROUND_ATTACHMENT)); +newlist.add(new Inherit( +PropNames.BACKGROUND_POSITION_HORIZONTAL)); +newlist.add(new Inherit( +PropNames.BACKGROUND_POSITION_VERTICAL)); +return newlist; +} else { +// Make a list an pass to processList +PropertyValueList tmpList = new PropertyValueList(property); +tmpList.add(value); +return processList(property, tmpList); +} +} + +
cvs commit: xml-fop/src/org/apache/fop/fo Properties.java
pbwest 2002/06/09 03:22:47 Modified:src/org/apache/fop/fo Tag: FOP_0-20-0_Alt-Design Properties.java Log: Initial shorthand support - BackgroundPosition Revision ChangesPath No revision No revision 1.1.2.3 +333 -8xml-fop/src/org/apache/fop/fo/Attic/Properties.java Index: Properties.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/Attic/Properties.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- Properties.java 9 May 2002 04:08:39 - 1.1.2.2 +++ Properties.java 9 Jun 2002 10:22:46 - 1.1.2.3 @@ -1,11 +1,11 @@ /* - * $Id: Properties.java,v 1.1.2.2 2002/05/09 04:08:39 pbwest Exp $ + * $Id: Properties.java,v 1.1.2.3 2002/06/09 10:22:46 pbwest Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. * * @author a href=mailto:[EMAIL PROTECTED];Peter B. West/a - * @version $Revision: 1.1.2.2 $ $Name: $ + * @version $Revision: 1.1.2.3 $ $Name: $ */ package org.apache.fop.fo; @@ -225,7 +225,8 @@ ,COMPUTED = 1 ,SPECIFIED = 2 ,COMPOUND = 3 -,VALUE_SPECIFIC = 4 + ,SHORTHAND_INH = 4 +,VALUE_SPECIFIC = 5 ; @@ -577,7 +578,7 @@ } public static class Background extends Properties { -public static final int dataTypes = SHORTHAND; +public static final int dataTypes = SHORTHAND | INHERIT; public static final int traitMapping = SHORTHAND_MAP; public static final int initialValueType = NOTYPE_IT; public static final int inherited = NO; @@ -647,6 +648,330 @@ public static final int traitMapping = SHORTHAND_MAP; public static final int initialValueType = NOTYPE_IT; public static final int inherited = NO; + +public static final int +LEFT = 1 + ,CENTER = 2 + ,RIGHT = 3 +,TOP = 4 +,CENTERV = 5 + ,BOTTOM = 6 + ; + +private static final String[] rwEnums = { +null +,left +,center +,right +,top +,center +,bottom +}; + +private static final ROStringArray enums = new ROStringArray(rwEnums); + +/** + * 'value' is a PropertyValueList or an individual PropertyValue. + * + * pIf 'value' is an individual PropertyValue, it must contain + * either a single distance measurement, a single NCName enumeration + * token, or an Inherit value. + * The distance measurement can be either a Length or a Percentage. + * + * pIf 'value' is a PropertyValueList, it contains either a pair of + * distance measurement (length or percentage) or a pair of + * enumeration tokens representing the background position offset + * in the height and width dimensions. + * + * pThe value(s) provided, if valid, are converted into a list + * containing the expansion of the shorthand. I.e. the first + * element is a value for BackgroundPositionHorizontal, and the + * second is for BackgroundPositionVertical. + */ +public static PropertyValue complex +(int property, PropertyValue value) throws PropertyException +{ +if ( ! (value instanceof PropertyValueList)) { +return processValue(property, value); +} else { +return processList(property, (PropertyValueList)value); +} +} + +private static PropertyValueList processValue +(int property, PropertyValue value) throws PropertyException +{ +PropertyValueList newlist = new PropertyValueList(property); +// Can only be Inherit, NCName (i.e. enum token) +// or Numeric (i.e. Length or Percentage) +if (value instanceof Inherit) { +// Construct a list of two Inherit values +newlist.add(new Inherit( +PropNames.BACKGROUND_POSITION_HORIZONTAL)); +newlist.add(new Inherit( +PropNames.BACKGROUND_POSITION_VERTICAL)); +} else if (value instanceof Numeric) {