cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java
bckfnn 2004/01/29 05:32:04 Modified:src/java/org/apache/fop/fo Property.java Log: Fix a NPE when the last shorthand was not detected. Revision ChangesPath 1.19 +1 -1 xml-fop/src/java/org/apache/fop/fo/Property.java Index: Property.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Property.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Property.java 25 Jan 2004 22:34:49 - 1.18 +++ Property.java 29 Jan 2004 13:32:04 - 1.19 @@ -618,7 +618,7 @@ } ListProperty listprop; int n = shorthands.length; -for (int i = 0; i n; i++) { +for (int i = 0; i n shorthands[i] != null; i++) { Property.Maker shorthand = shorthands[i]; listprop = (ListProperty)propertyList.getExplicit(shorthand.propId); if (listprop != null) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java PropertySets.java
gmazza 2004/01/10 12:40:07 Modified:src/codegen properties.xsl src/java/org/apache/fop/datatypes ToBeImplementedProperty.java src/java/org/apache/fop/fo Property.java PropertySets.java Log: switch from Property.getPropName() to Property.getPropId(); comments added to PropertySets.java to clarify makeSparseIndices() method. Revision ChangesPath 1.31 +2 -2 xml-fop/src/codegen/properties.xsl Index: properties.xsl === RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- properties.xsl9 Jan 2004 03:05:55 - 1.30 +++ properties.xsl10 Jan 2004 20:40:07 - 1.31 @@ -883,7 +883,7 @@ xsl:value-of select=key('shorthandref', $shprop)/datatype-parser/ xsl:text(listprop); p = shparser.getValueForProperty( -getPropName(), this, propertyList); +getPropId(), this, propertyList); } }/xsl:text /xsl:for-each 1.5 +1 -1 xml-fop/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java Index: ToBeImplementedProperty.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/ToBeImplementedProperty.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ToBeImplementedProperty.java 26 Dec 2003 23:41:47 - 1.4 +++ ToBeImplementedProperty.java 10 Jan 2004 20:40:07 - 1.5 @@ -69,7 +69,7 @@ } ToBeImplementedProperty val = -new ToBeImplementedProperty(getPropName()); +new ToBeImplementedProperty(getPropId()); return val; } } 1.15 +1 -1 xml-fop/src/java/org/apache/fop/fo/Property.java Index: Property.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Property.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Property.java 9 Jan 2004 22:32:27 - 1.14 +++ Property.java 10 Jan 2004 20:40:07 - 1.15 @@ -81,7 +81,7 @@ /** * @return the name of the property for this Maker */ -protected int getPropName() { +protected int getPropId() { return propId; } 1.3 +18 -4 xml-fop/src/java/org/apache/fop/fo/PropertySets.java Index: PropertySets.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertySets.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PropertySets.java 22 Dec 2003 23:23:05 - 1.2 +++ PropertySets.java 10 Jan 2004 20:40:07 - 1.3 @@ -1267,13 +1267,27 @@ } + /* These arrays, one for each formatting object, define the properties that +* are valid for an FO and its children. The first element, indices[0], +* will be used in PropertyList to define the size of the Property[] array +* for the FObj (= the number of properties valid for the element + 1.) +* Each other element of this array has a value of 0 if not supported by the FO, +* 1-based index otherwise. This array will be used as a pointer to the Property[] +* array in PropertyList holding the valid properties for the FO. +* i.e., fo.propList.values[indices[propId]] will refer to the correct Property +* element if the property is valid for the FO, values[indices[invalPropId]] = +* values[0] = NULL otherwise. +*/ private static short[] makeSparseIndices(BitSet set) { -short[] indices = new short[Constants.PROPERTY_COUNT]; +short[] indices = new short[Constants.PROPERTY_COUNT +1]; + indices[0] = (short) (set.cardinality() + 1); -int j = 1; + +int propIndex = 1; for (int i = set.nextSetBit(0); i = 0; i = set.nextSetBit(i+1)) { -indices[i] = (short) j++; +indices[i] = (short) propIndex++; } + return indices; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java PropertyList.java
gmazza 2004/01/07 13:10:39 Modified:src/codegen properties.xsl src/java/org/apache/fop/datatypes CompoundDatatype.java CondLength.java Keep.java LengthPair.java src/java/org/apache/fop/fo Property.java PropertyList.java Log: Last of string-int conversions (more structural improvements still can be done in PropertyList from Finn's patch, however). Made Constants values inherent to CompoundDatatype class. Revision ChangesPath 1.28 +2 -3 xml-fop/src/codegen/properties.xsl Index: properties.xsl === RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- properties.xsl6 Jan 2004 00:49:40 - 1.27 +++ properties.xsl7 Jan 2004 21:10:36 - 1.28 @@ -576,8 +576,7 @@ return baseProp; } -public Property getSubpropValue(Property baseProp, String subpropName) { -int subpropId = org.apache.fop.fo.properties.FOPropertyMapping.getSubPropertyId(subpropName); +public Property getSubpropValue(Property baseProp, int subpropId) { /xsl:text xsl:value-of select=datatype/ xsl:text val = baseProp.get/xsl:text 1.3 +2 -1 xml-fop/src/java/org/apache/fop/datatypes/CompoundDatatype.java Index: CompoundDatatype.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/CompoundDatatype.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CompoundDatatype.java 6 Jan 2004 00:49:40 - 1.2 +++ CompoundDatatype.java 7 Jan 2004 21:10:36 - 1.3 @@ -51,11 +51,12 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; +import org.apache.fop.fo.Constants; /** * This interface is used as a base for compound datatypes. */ -public interface CompoundDatatype { +public interface CompoundDatatype extends Constants { /** * Sets a component of the compound datatype. 1.5 +4 -4 xml-fop/src/java/org/apache/fop/datatypes/CondLength.java Index: CondLength.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/CondLength.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CondLength.java 6 Jan 2004 00:49:40 - 1.4 +++ CondLength.java 7 Jan 2004 21:10:36 - 1.5 @@ -67,9 +67,9 @@ */ public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { -if (cmpId == Constants.CP_LENGTH) { +if (cmpId == CP_LENGTH) { length = cmpnValue; -} else if (cmpId == Constants.CP_CONDITIONALITY) { +} else if (cmpId == CP_CONDITIONALITY) { conditionality = cmpnValue; } } @@ -78,9 +78,9 @@ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ public Property getComponent(int cmpId) { -if (cmpId == Constants.CP_LENGTH) { +if (cmpId == CP_LENGTH) { return length; -} else if (cmpId == Constants.CP_CONDITIONALITY) { +} else if (cmpId == CP_CONDITIONALITY) { return conditionality; } else { return null; 1.6 +6 -6 xml-fop/src/java/org/apache/fop/datatypes/Keep.java Index: Keep.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/Keep.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Keep.java 6 Jan 2004 00:49:40 - 1.5 +++ Keep.java 7 Jan 2004 21:10:36 - 1.6 @@ -73,11 +73,11 @@ */ public void setComponent(int cmpId, Property cmpnValue, boolean bIsDefault) { -if (cmpId == Constants.CP_WITHIN_LINE) { +if (cmpId == CP_WITHIN_LINE) { setWithinLine(cmpnValue, bIsDefault); -} else if (cmpId == Constants.CP_WITHIN_COLUMN) { +} else if (cmpId == CP_WITHIN_COLUMN) { setWithinColumn(cmpnValue, bIsDefault); -} else if (cmpId == Constants.CP_WITHIN_PAGE) { +} else if (cmpId == CP_WITHIN_PAGE) { setWithinPage(cmpnValue, bIsDefault); } } @@ -86,11 +86,11 @@ * @see org.apache.fop.datatypes.CompoundDatatype#getComponent(int) */ public Property getComponent(int cmpId) { -if (cmpId == Constants.CP_WITHIN_LINE) { +if (cmpId == CP_WITHIN_LINE) { return getWithinLine(); -
cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java
gmazza 2004/01/07 14:25:43 Modified:src/codegen properties.xsl src/java/org/apache/fop/fo Property.java Log: More String-int conversions. Revision ChangesPath 1.29 +19 -13xml-fop/src/codegen/properties.xsl Index: properties.xsl === RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- properties.xsl7 Jan 2004 21:10:36 - 1.28 +++ properties.xsl7 Jan 2004 22:25:42 - 1.29 @@ -523,10 +523,12 @@ super(propId);/xsl:text xsl:if test=compound xsl:text -m_shorthandMaker= getSubpropMaker(/xsl:text -xsl:value-of select= -'compound/[EMAIL PROTECTED]true]/name'/ -xsl:text);/xsl:text +m_shorthandMaker= getSubpropMaker(Constants.CP_/xsl:text +xsl:call-template name=makeEnumConstant + xsl:with-param name=propstr select= + 'compound/[EMAIL PROTECTED]true]/name'/ +/xsl:call-template +xsl:text);/xsl:text /xsl:if xsl:text } @@ -544,7 +546,7 @@ return true; } -protected Property.Maker getSubpropMaker(String subprop) {/xsl:text +protected Property.Maker getSubpropMaker(int subpropId) {/xsl:text xsl:for-each select=compound/subproperty xsl:variable name=spname xsl:call-template name=makeClassName @@ -552,15 +554,17 @@ /xsl:call-template /xsl:variable xsl:text -if (subprop.equals(/xsl:text - xsl:value-of select='name'/ - xsl:text)) +if (subpropId == Constants.CP_/xsl:text + xsl:call-template name=makeEnumConstant +xsl:with-param name=propstr select=name/ + /xsl:call-template + xsl:text) return s_/xsl:text xsl:value-of select=$spname/ xsl:textMaker;/xsl:text /xsl:for-each xsl:text -return super.getSubpropMaker(subprop); +return super.getSubpropMaker(subpropId); } protected Property setSubprop(Property baseProp, int subpropId, @@ -624,9 +628,11 @@ // set default for subprop /xsl:text xsl:value-of select=./ xsl:text - subProp = getSubpropMaker(/xsl:text -xsl:value-of select='.'/ -xsl:text).make(pList, getDefaultFor/xsl:text + subProp = getSubpropMaker(Constants.CP_/xsl:text +xsl:call-template name=makeEnumConstant + xsl:with-param name=propstr select=./ +/xsl:call-template +xsl:text).make(pList, getDefaultFor/xsl:text xsl:value-of select='$spname'/ xsl:text(), fo); p.setComponent(Constants.CP_/xsl:text 1.12 +5 -5 xml-fop/src/java/org/apache/fop/fo/Property.java Index: Property.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Property.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Property.java 7 Jan 2004 21:10:38 - 1.11 +++ Property.java 7 Jan 2004 22:25:43 - 1.12 @@ -141,12 +141,12 @@ * of compound property types, such as space. * Overridden by property maker subclasses which handle * compound properties. - * @param subprop The name of the component for which a Maker is to - * returned, for example optimum, if the FO attribute is + * @param subprop The Constants ID of the component for which a Maker is to + * returned, for example CP_OPTIMUM, if the FO attribute is * space.optimum='10pt'. * @return the Maker object specified */ -protected Maker getSubpropMaker(String subprop) { +protected Maker getSubpropMaker(int subpropId) { return null; } @@ -188,11 +188,11 @@ if (baseProp == null) { baseProp = makeCompound(propertyList, fo); } -Maker spMaker = getSubpropMaker(partName); +int partId = FOPropertyMapping.getSubPropertyId(partName); +Maker spMaker = getSubpropMaker(partId); if (spMaker != null) { Property p = spMaker.make(propertyList, value, fo); if (p != null) { -int partId = FOPropertyMapping.getSubPropertyId(partName); return setSubprop(baseProp, partId, p); } } else { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java PropertyList.java
gmazza 2004/01/07 14:50:51 Modified:src/java/org/apache/fop/fo Property.java PropertyList.java Log: More String-int conversion. Revision ChangesPath 1.13 +7 -5 xml-fop/src/java/org/apache/fop/fo/Property.java Index: Property.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Property.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Property.java 7 Jan 2004 22:25:43 - 1.12 +++ Property.java 7 Jan 2004 22:50:51 - 1.13 @@ -174,7 +174,8 @@ * value is already partially initialized, this method will modify it. * @param baseProp The Property object representing the compound property, * for example: SpaceProperty. - * @param partName The name of the component whose value is specified. + * @param subpropId The Constants ID of the subproperty (component) + *whose value is specified. * @param propertyList The propertyList being built. * @param fo The FO whose properties are being set. * @param value the value of the @@ -182,18 +183,19 @@ * the new subproperty added * @throws FOPException for invalid or inconsistent FO input */ -public Property make(Property baseProp, String partName, +public Property make(Property baseProp, int subpropId, PropertyList propertyList, String value, FObj fo) throws FOPException { if (baseProp == null) { baseProp = makeCompound(propertyList, fo); } -int partId = FOPropertyMapping.getSubPropertyId(partName); -Maker spMaker = getSubpropMaker(partId); + +Maker spMaker = getSubpropMaker(subpropId); + if (spMaker != null) { Property p = spMaker.make(propertyList, value, fo); if (p != null) { -return setSubprop(baseProp, partId, p); +return setSubprop(baseProp, subpropId, p); } } else { //getLogger().error(compound property component 1.23 +2 -1 xml-fop/src/java/org/apache/fop/fo/PropertyList.java Index: PropertyList.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyList.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- PropertyList.java 7 Jan 2004 21:10:38 - 1.22 +++ PropertyList.java 7 Jan 2004 22:50:51 - 1.23 @@ -500,7 +500,8 @@ } else { // e.g. leader-length.maximum Property baseProperty = findBaseProperty(attributes, parentFO, basePropertyName, propertyMaker); -prop = propertyMaker.make(baseProperty, subPropertyName, +int subpropId = FOPropertyMapping.getSubPropertyId(subPropertyName); +prop = propertyMaker.make(baseProperty, subpropId, this, attributeValue, parentFO); } if (prop != null) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java
gmazza 2004/01/05 14:13:19 Modified:src/java/org/apache/fop/fo Property.java Log: Switch from strings-ints in Property.setSubprop() (from Finn Bock). Revision ChangesPath 1.10 +4 -3 xml-fop/src/java/org/apache/fop/fo/Property.java Index: Property.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Property.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Property.java 5 Jan 2004 00:44:59 - 1.9 +++ Property.java 5 Jan 2004 22:13:19 - 1.10 @@ -192,7 +192,8 @@ if (spMaker != null) { Property p = spMaker.make(propertyList, value, fo); if (p != null) { -return setSubprop(baseProp, partName, p); +int partId = FOPropertyMapping.getSubPropertyId(partName); +return setSubprop(baseProp, partId, p); } } else { //getLogger().error(compound property component @@ -210,12 +211,12 @@ * compound properties. * @param baseProp The Property object representing the compound property, * such as SpaceProperty. - * @param partName The name of the component whose value is specified. + * @param partId The ID of the component whose value is specified. * @param subProp A Property object holding the specified value of the * component to be set. * @return The modified compound property object. */ -protected Property setSubprop(Property baseProp, String partName, +protected Property setSubprop(Property baseProp, int partId, Property subProp) { return baseProp; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo Property.java
vmote 2003/07/06 15:38:44 Modified:src/java/org/apache/fop/datatypes KeepValue.java Length.java LengthBase.java LengthPair.java LengthRange.java LinearCombinationLength.java MixedLength.java PercentBase.java PercentLength.java Space.java TableColLength.java ToBeImplemented.java ToBeImplementedProperty.java src/java/org/apache/fop/fo Property.java Log: style changes only Revision ChangesPath 1.2 +28 -10xml-fop/src/java/org/apache/fop/datatypes/KeepValue.java Index: KeepValue.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/datatypes/KeepValue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- KeepValue.java11 Mar 2003 13:05:36 - 1.1 +++ KeepValue.java6 Jul 2003 22:38:43 - 1.2 @@ -3,34 +3,34 @@ * *The Apache Software License, Version 1.1 * - * + * * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, *this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, *this list of conditions and the following disclaimer in the documentation *and/or other materials provided with the distribution. - * + * * 3. The end-user documentation included with the redistribution, if any, must *include the following acknowledgment: This product includes software *developed by the Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowledgment may appear in the software itself, if *and wherever such third-party acknowledgments normally appear. - * + * * 4. The names FOP and Apache Software Foundation must not be used to *endorse or promote products derived from this software without prior *written permission. For written permission, please contact *[EMAIL PROTECTED] - * + * * 5. Products derived from this software may not be called Apache, nor may *Apache appear in their name, without prior written permission of the *Apache Software Foundation. - * + * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE @@ -42,12 +42,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * + * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation and was originally created by * James Tauber [EMAIL PROTECTED]. For more information on the Apache * Software Foundation, please see http://www.apache.org/. - */ + */ package org.apache.fop.datatypes; /** @@ -55,25 +55,43 @@ * Stores the different types of keeps in a single convenient format. */ public class KeepValue { +/** constant for keep-with-always */ public static final String KEEP_WITH_ALWAYS = KEEP_WITH_ALWAYS; +/** constant for automatic keep-with computation */ public static final String KEEP_WITH_AUTO = KEEP_WITH_AUTO; +/** constant for a user-settable keep-with value (??) */ public static final String KEEP_WITH_VALUE = KEEP_WITH_VALUE; private String type = KEEP_WITH_AUTO; private int value = 0; +/** + * Constructor + * @param type one of KEEP_WITH_ALWAYS, KEEP_WITH_AUTO, or + * KEEP_WITH_VALUE + * @param val keep-with value to use (used only by KEEP_WITH_VALUE ??). + */ public KeepValue(String type, int val) { this.type = type; this.value = val; } +/** + * @return the keep-with value + */ public int getValue() { return value; } +/** + * @return the descriptive type + */ public String getType() { return type; } +/** + * @return string representation of this + */ public String toString() { return type; }