From: Peter Bernard West Date: Fri, 4 Oct 2002 16:16:23 +0000 (+0000) Subject: Added initialValues[]. Changed getInitialValue() to use the array. X-Git-Tag: Alt-Design_pre_Properties_split~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=07e30d2aee5411b0a2de9dbea270f184f3dad287;p=xmlgraphics-fop.git Added initialValues[]. Changed getInitialValue() to use the array. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195291 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/fo/FOTree.java b/src/org/apache/fop/fo/FOTree.java index a6cac5b0c..412c1c5a9 100644 --- a/src/org/apache/fop/fo/FOTree.java +++ b/src/org/apache/fop/fo/FOTree.java @@ -84,6 +84,9 @@ public class FOTree extends Tree implements Runnable { */ protected ArrayList[] propertyStacks; + protected PropertyValue[] initialValues + = new PropertyValue[PropNames.LAST_PROPERTY_INDEX + 1]; + /** * @param xmlevents the buffer from which XMLEvents from the * parser are read. @@ -109,6 +112,7 @@ public class FOTree extends Tree implements Runnable { if ( ! (prop instanceof Numeric) || ! ((Numeric)prop).isLength()) throw new PropertyException("Initial font-size is not a Length"); propertyStacks[PropNames.FONT_SIZE].add(prop); + initialValues[PropNames.FONT_SIZE] = prop; for (int i = 1; i <= PropNames.LAST_PROPERTY_INDEX; i++) { @@ -116,6 +120,9 @@ public class FOTree extends Tree implements Runnable { // Set up the initial values for each property prop = PropertyConsts.getInitialValue(i); propertyStacks[i].add(prop); + System.out.println("....Setting initial value: " + + i + ((prop == null) ? " NULL" : " notNULL")); + initialValues[i] = prop; } } @@ -126,6 +133,7 @@ public class FOTree extends Tree implements Runnable { * @exception PropertyException if current font size is not defined, * or is not expressed as a Numeric, or if cloning is not * supported. + * [REMOVE] */ public Numeric cloneCurrentFontSize() throws PropertyException { Numeric tmpval = @@ -144,6 +152,7 @@ public class FOTree extends Tree implements Runnable { * @return a Numeric containing the current font size * @exception PropertyException if current font size is not defined, * or is not expressed as a Numeric. + * [REMOVE] */ public Numeric currentFontSize() throws PropertyException { return (Numeric)(propertyStacks[PropNames.FONT_SIZE] @@ -184,7 +193,8 @@ public class FOTree extends Tree implements Runnable { /** * Get the PropertyValue at the top of the stack for a - * given property. + * given property. Note that this is a raw value; if it is + * an unresolved percentage that value will be returned. * @param index - the property index. * @return a PropertyValue containing the latest property * value for the indexed property. @@ -198,7 +208,8 @@ public class FOTree extends Tree implements Runnable { /** * Clone the PropertyValue at the top of the stack for a - * given property. + * given property. Note that this is a raw value; if it is + * an unresolved percentage that value will be cloned. * @param index - the property index. * @return a PropertyValue containing the latest property * value for the indexed property. @@ -230,8 +241,9 @@ public class FOTree extends Tree implements Runnable { } /** - * Get the initial value PropertyValue from the bottom of the - * stack for a given property. + * Get the initial value PropertyValue for a given property. + * Note that this is a raw value; if it is + * an unresolved percentage that value will be returned. * @param index - the property index. * @return a PropertyValue containing the property * value element at the bottom of the stack for the indexed property. @@ -239,7 +251,7 @@ public class FOTree extends Tree implements Runnable { public PropertyValue getInitialValue(int index) throws PropertyException { - return (PropertyValue)(propertyStacks[index].get(0)); + return initialValues[index]; } /**