cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java
gmazza 2004/01/13 15:28:31 Modified:src/java/org/apache/fop/fo PropertyList.java Log: static boolean array inheritableProperty[] added, to reduce processing costs of lookups to see if a property is inheritable. Work based on Finn Bock's patch. Revision ChangesPath 1.25 +10 -7 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.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- PropertyList.java 9 Jan 2004 03:05:55 - 1.24 +++ PropertyList.java 13 Jan 2004 23:28:31 - 1.25 @@ -69,6 +69,7 @@ // writing-mode values private byte[] wmtable = null; private int writingMode; +private static boolean[] inheritableProperty; // absolute directions and dimensions /** constant for direction left */ @@ -678,14 +679,16 @@ * @return isInherited value from the requested Property.Maker */ private boolean isInherited(int propId) { -boolean b = true; - -Property.Maker propertyMaker = findMaker(propId); -if (propertyMaker != null) { -b = propertyMaker.isInherited(); +if (inheritableProperty == null) { +inheritableProperty = new boolean[Constants.PROPERTY_COUNT + 1]; +Property.Maker maker = null; +for (int prop = 1; prop = Constants.PROPERTY_COUNT; prop++) { +maker = findMaker(prop); +inheritableProperty[prop] = (maker != null maker.isInherited()); +} } - -return b; + +return inheritableProperty[propId]; } /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java
gmazza 2004/01/08 19:05:55 Modified:src/codegen properties.xsl src/java/org/apache/fop/fo PropertyList.java Log: Bug 25990 (Patch by Finn Bock) errors in String-int conversions found. Revision ChangesPath 1.30 +10 -2 xml-fop/src/codegen/properties.xsl Index: properties.xsl === RCS file: /home/cvs/xml-fop/src/codegen/properties.xsl,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- properties.xsl7 Jan 2004 22:25:42 - 1.29 +++ properties.xsl9 Jan 2004 03:05:55 - 1.30 @@ -1003,7 +1003,15 @@ xsl:param name=lrtb/ xsl:param name=rltb/ xsl:param name=tbrl/ - xsl:textpropertyList.wmMap(Constants.PR_/xsl:text + xsl:choose +xsl:when test=parwmrel2abs + xsl:textparentFO.propertyList/xsl:text +/xsl:when +xsl:otherwise + xsl:textpropertyList/xsl:text +/xsl:otherwise + /xsl:choose + xsl:text.wmMap(Constants.PR_/xsl:text xsl:apply-templates mode=x xsl:with-param name=dir select='$lrtb'/ /xsl:apply-templates 1.24 +2 -2 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.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- PropertyList.java 7 Jan 2004 22:50:51 - 1.23 +++ PropertyList.java 9 Jan 2004 03:05:55 - 1.24 @@ -385,8 +385,8 @@ public int wmMap(int lrtb, int rltb, int tbrl) { switch (writingMode) { case WritingMode.LR_TB: return lrtb; -case WritingMode.RL_TB: return lrtb; -case WritingMode.TB_RL: return lrtb; +case WritingMode.RL_TB: return rltb; +case WritingMode.TB_RL: return tbrl; } return -1; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java
gmazza 2004/01/05 14:02:47 Modified:src/java/org/apache/fop/fo PropertyList.java Log: COMPOUND_MASK/PROPERTY_MASK bug fixed in PropertyList.java (patch by Finn Bock). Revision ChangesPath 1.21 +1 -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.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- PropertyList.java 5 Jan 2004 01:31:09 - 1.20 +++ PropertyList.java 5 Jan 2004 22:02:47 - 1.21 @@ -188,7 +188,7 @@ if (p == null) { p = getShorthand(propId Constants.PROPERTY_MASK); } -if (p != null (propId Constants.PROPERTY_MASK) != 0) { +if (p != null (propId Constants.COMPOUND_MASK) != 0) { return getSubpropValue(p, propId); } return p; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java PropertyManager.java
gmazza 2004/01/04 13:14:34 Modified:src/java/org/apache/fop/fo PropertyList.java PropertyManager.java Log: String-Int conversion: removed String version of PropertyList.get() Revision ChangesPath 1.15 +0 -24 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- PropertyList.java 2 Jan 2004 22:37:09 - 1.14 +++ PropertyList.java 4 Jan 2004 21:14:34 - 1.15 @@ -274,17 +274,6 @@ return p; } - -/** - * Return the property on the current FlowObject if it is specified, or if a - * corresponding property is specified. If neither is specified, it returns null. - * @param propertyName name of property - * @return the Property corresponding to that name - */ -public Property getSpecified(String propertyName) { -return get(propertyName, false, false); -} - /** * Return the property on the current FlowObject. If it isn't set explicitly, * this will try to compute it based on other properties, or if it is @@ -295,19 +284,6 @@ */ public Property get(int propId) { String propertyName = FOPropertyMapping.getPropertyName(propId); -return get(propertyName, true, true); -} - -/** - * TEMPORARY until conversion to int's complete - * Return the property on the current FlowObject. If it isn't set explicitly, - * this will try to compute it based on other properties, or if it is - * inheritable, to return the inherited value. If all else fails, it returns - * the default value. - * @param propertyName The name of the property whose value is desired. - * @return the Property corresponding to that name - */ -public Property get(String propertyName) { return get(propertyName, true, true); } 1.19 +14 -21xml-fop/src/java/org/apache/fop/fo/PropertyManager.java Index: PropertyManager.java === RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertyManager.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- PropertyManager.java 27 Dec 2003 22:00:38 - 1.18 +++ PropertyManager.java 4 Jan 2004 21:14:34 - 1.19 @@ -50,9 +50,6 @@ */ package org.apache.fop.fo; -// Java -import java.text.MessageFormat; - // FOP import org.apache.fop.fonts.Font; import org.apache.fop.fo.properties.CommonBorderAndPadding; @@ -83,16 +80,15 @@ private CommonHyphenation hyphProps = null; private TextInfo textInfo = null; -private static final String[] SA_BEFORE = new String[]{before}; -private static final String[] SA_AFTER = new String[]{after}; -private static final String[] SA_START = new String[]{start}; -private static final String[] SA_END = new String[]{end}; - -private static final MessageFormat MSGFMT_COLOR = new MessageFormat(border-{0}-color); -private static final MessageFormat MSGFMT_STYLE = new MessageFormat(border-{0}-style); -private static final MessageFormat MSGFMT_WIDTH = new MessageFormat(border-{0}-width); -private static final MessageFormat MSGFMT_PADDING = new MessageFormat(padding-{0}); - +private static final int[] SA_BEFORE = new int[] { +PR_BORDER_BEFORE_COLOR, PR_BORDER_BEFORE_STYLE, PR_BORDER_BEFORE_WIDTH, PR_PADDING_BEFORE}; +private static final int[] SA_AFTER = new int[]{ +PR_BORDER_AFTER_COLOR, PR_BORDER_AFTER_STYLE, PR_BORDER_AFTER_WIDTH, PR_PADDING_AFTER}; +private static final int[] SA_START = new int[]{ +PR_BORDER_START_COLOR, PR_BORDER_START_STYLE, PR_BORDER_START_WIDTH, PR_PADDING_START}; +private static final int[] SA_END = new int[]{ +PR_BORDER_END_COLOR, PR_BORDER_END_STYLE, PR_BORDER_END_WIDTH, PR_PADDING_END}; + private static final String NONE = none; /** @@ -189,18 +185,15 @@ return borderAndPadding; } -private void initBorderInfo(int whichSide, String[] saSide) { +private void initBorderInfo(int whichSide, int[] saSide) { borderAndPadding.setPadding(whichSide, -propertyList.get( - MSGFMT_PADDING.format(saSide)).getCondLength()); +propertyList.get(saSide[3]).getCondLength()); // If style = none, force width to 0, don't get Color (spec 7.7.20) -int style = propertyList.get(MSGFMT_STYLE.format(saSide)).getEnum();
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java
gmazza 2004/01/04 14:23:16 Modified:src/java/org/apache/fop/fo PropertyList.java Log: More string--int conversions. Revision ChangesPath 1.17 +21 -19xml-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.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- PropertyList.java 4 Jan 2004 22:04:08 - 1.16 +++ PropertyList.java 4 Jan 2004 22:23:16 - 1.17 @@ -482,7 +482,9 @@ String basePropertyName = findBasePropertyName(attributeName); String subPropertyName = findSubPropertyName(attributeName); -propertyMaker = findMaker(namespace, elementName, basePropertyName); +int propId = FOPropertyMapping.getPropertyId(basePropertyName); + +propertyMaker = findMaker(namespace, elementName, propId); if (propertyMaker == null) { handleInvalidProperty(attributeName); return; @@ -599,13 +601,11 @@ public Property getSubpropValue(String space, String element, Property p, int propId) { -String propertyName = FOPropertyMapping.getPropertyName(propId -Constants.PROPERTY_MASK); - String subpropName = FOPropertyMapping.getPropertyName(propId Constants.COMPOUND_MASK); -Property.Maker maker = findMaker(space, element, propertyName); +Property.Maker maker = findMaker(space, element, propId +Constants.PROPERTY_MASK); if (maker != null) { return maker.getSubpropValue(p, subpropName); } else { @@ -619,10 +619,12 @@ * @param propertyName name of property * @return value from the appropriate Property.Maker */ -public boolean isCorrespondingForced(String space, String element, +private boolean isCorrespondingForced(String space, String element, String propertyName) { +int propId = FOPropertyMapping.getPropertyId(propertyName); + Property.Maker propertyMaker = findMaker(space, element, - propertyName); + propId); if (propertyMaker != null) { return propertyMaker.isCorrespondingForced(this); } else { @@ -639,8 +641,10 @@ */ public Property getShorthand(String space, String element, String propertyName) { +int propId = FOPropertyMapping.getPropertyId(propertyName); + Property.Maker propertyMaker = findMaker(space, element, - propertyName); + propId); if (propertyMaker != null) { return propertyMaker.getShorthand(this); } else { @@ -659,11 +663,10 @@ public Property makeProperty(String space, String element, int propId) throws FOPException { -String propertyName = FOPropertyMapping.getPropertyName(propId); Property p = null; Property.Maker propertyMaker = findMaker(space, element, - propertyName); + propId); if (propertyMaker != null) { p = propertyMaker.make(this); } else { @@ -683,9 +686,10 @@ public Property computeProperty(String space, String element, String propertyName) { +int propId = FOPropertyMapping.getPropertyId(propertyName); Property p = null; Property.Maker propertyMaker = findMaker(space, element, - propertyName); + propId); if (propertyMaker != null) { try { p = propertyMaker.compute(this); @@ -713,8 +717,9 @@ String propertyName) { boolean b; +int propId = FOPropertyMapping.getPropertyId(propertyName); Property.Maker propertyMaker = findMaker(space, element, - propertyName); + propId); if (propertyMaker != null) { b = propertyMaker.isInherited(); } else { @@ -727,19 +732,16 @@ /** * @param space namespace of element * @param elementName name of element - * @param propertyName name of property + * @param propId Id of property
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java
gmazza 2004/01/04 14:47:36 Modified:src/java/org/apache/fop/fo PropertyList.java Log: More String-Int conversion; also removed member variable passing (namespace, element) within private functions. (Also made more methods private until external use determined.) Revision ChangesPath 1.18 +38 -79xml-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.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- PropertyList.java 4 Jan 2004 22:23:16 - 1.17 +++ PropertyList.java 4 Jan 2004 22:47:36 - 1.18 @@ -197,7 +197,7 @@ p = getShorthand(namespace, elementName, baseName); } if (p != null sepchar -1) { -return getSubpropValue(namespace, elementName, p, propId); +return getSubpropValue(p, propId); } return p; } @@ -217,7 +217,7 @@ String baseName = propertyName.substring(0, sepchar); Property p = getExplicitBaseProp(baseName); if (p != null) { -return getSubpropValue(namespace, elementName, p, propId); +return getSubpropValue(p, propId); } else { return null; } @@ -245,12 +245,12 @@ int propId = FOPropertyMapping.getPropertyId(propertyName); if (parentPropertyList != null - isInherited(namespace, elementName, propertyName)) { + isInherited(propId)) { return parentPropertyList.get(propId); } else { // return the initial value try { -return makeProperty(namespace, elementName, propId); +return makeProperty(propId); } catch (org.apache.fop.apps.FOPException e) { //log.error(Exception in getInherited(): property= // + propertyName + : + e); @@ -284,8 +284,7 @@ bTryInherit); if (p == null bTryDefault) {// default value for this FO! try { -p = makeProperty(namespace, elementName, -propId Constants.PROPERTY_MASK); +p = makeProperty(propId Constants.PROPERTY_MASK); } catch (FOPException e) { // don't know what to do here } @@ -300,8 +299,7 @@ } if ((propId Constants.COMPOUND_MASK) != 0 p != null) { -return getSubpropValue(namespace, elementName, p, -propId); +return getSubpropValue(p, propId); } else { return p; } @@ -313,19 +311,19 @@ * the inheritance priority (I think...) * If the property is an absolute property and it isn't specified, then * we try to compute it from the corresponding relative property: this - * happends in computeProperty. + * happens in computeProperty. */ private Property findProperty(int propId, boolean bTryInherit) { String propertyName = FOPropertyMapping.getPropertyName(propId); Property p = null; -if (isCorrespondingForced(namespace, elementName, propertyName)) { -p = computeProperty(namespace, elementName, propertyName); +if (isCorrespondingForced(propId)) { +p = computeProperty(propId); } else { p = getExplicitBaseProp(propertyName); if (p == null) { -p = this.computeProperty(namespace, elementName, propertyName); +p = this.computeProperty(propId); } if (p == null) {// check for shorthand specification p = getShorthand(namespace, elementName, propertyName); @@ -333,7 +331,7 @@ if (p == null bTryInherit) { // else inherit (if has parent and is inheritable) if (this.parentPropertyList != null - isInherited(namespace, elementName, propertyName)) { + isInherited(propId)) { p = parentPropertyList.findProperty(propId, true); } } @@ -359,7 +357,7 @@ if (p == null) { // If no explicit setting found, return initial (default) value. try { -p = makeProperty(namespace, elementName, propId); +p = makeProperty(propId); } catch (FOPException e) { //log.error(Exception in getNearestSpecified(): property= // +
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java
gmazza 2004/01/02 14:37:09 Modified:src/java/org/apache/fop/fo PropertyList.java Log: Bug 25803 (patch by Simon Pepping): Fix bug occurring when a compound property is specified (e.g. leader-length.maximum) before its base property (e.g. leader-length). Revision ChangesPath 1.14 +23 -9 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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- PropertyList.java 31 Dec 2003 01:41:46 - 1.13 +++ PropertyList.java 2 Jan 2004 22:37:09 - 1.14 @@ -216,7 +216,7 @@ * @return The value if the property is explicitly set, otherwise null. */ public Property getExplicitBaseProp(String propertyName) { -return (Property)super.get(propertyName); +return (Property) super.get(propertyName); } /** @@ -516,9 +516,18 @@ } try { Property prop = null; -if (subPropertyName == null) { +if (subPropertyName == null) { // base attribute only found +/* Do nothing if the base property has already been created. + * This is e.g. the case when a compound attribute was + * specified before the base attribute; in these cases + * the base attribute was already created in + * findBaseProperty() + */ +if (getExplicitBaseProp(basePropertyName) != null) { +return; +} prop = propertyMaker.make(this, attributeValue, parentFO); -} else { +} else { // e.g. leader-length.maximum Property baseProperty = findBaseProperty(attributes, parentFO, basePropertyName, propertyMaker); prop = propertyMaker.make(baseProperty, subPropertyName, @@ -538,25 +547,30 @@ String basePropName, Maker propertyMaker) throws FOPException { -// If the baseProperty has already been created, return it + +/* If the baseProperty has already been created, return it + * e.g. fo:leader =120pt .maximum=200pt... / + */ Property baseProperty = getExplicitBaseProp(basePropName); if (baseProperty != null) { return baseProperty; } -// If it is specified later in this list of Attributes, create it + +/* Otherwise If it is specified later in this list of Attributes, create it now + * e.g. fo:leader .maximum=200pt =200pt... / + */ String basePropertyValue = attributes.getValue(basePropName); if (basePropertyValue != null) { -int propertyId = FOPropertyMapping.getPropertyId(basePropertyValue); +int propertyId = FOPropertyMapping.getPropertyId(basePropName); if (propertyId != -1) { baseProperty = propertyMaker.make(this, basePropertyValue, parentFO); return baseProperty; } } -// Otherwise it is a compound property ?? -// baseProperty = propertyMaker.makeCompound(propertyList, parentFO); -return baseProperty; + +return null; // could not find base property } private void handleInvalidProperty(String attributeName) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/java/org/apache/fop/fo PropertyList.java PropertyListBuilder.java PropertyManager.java
vmote 2003/07/16 10:36:24 Modified:src/java/org/apache/fop/fo PropertyList.java PropertyListBuilder.java PropertyManager.java Log: style changes only Revision ChangesPath 1.2 +68 -17xml-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.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PropertyList.java 11 Mar 2003 13:05:19 - 1.1 +++ PropertyList.java 16 Jul 2003 17:36:23 - 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,33 +42,52 @@ * (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.fo; import java.util.HashMap; import org.apache.fop.fo.properties.WritingMode; import org.apache.fop.apps.FOPException; +/** + * Class containing the collection of properties for a given FObj. + */ public class PropertyList extends HashMap { -private byte[] wmtable = null;// writing-mode values +// writing-mode values +private byte[] wmtable = null; + +// absolute directions and dimensions +/** constant for direction left */ public static final int LEFT = 0; +/** constant for direction right */ public static final int RIGHT = 1; +/** constant for direction top */ public static final int TOP = 2; +/** constant for direction bottom */ public static final int BOTTOM = 3; +/** constant for dimension height */ public static final int HEIGHT = 4; +/** constant for dimension width */ public static final int WIDTH = 5; +// directions relative to writing-mode +/** constant for direction start */ public static final int START = 0; +/** constant for direction end */ public static final int END = 1; +/** constant for direction before */ public static final int BEFORE = 2; +/** constant for direction after */ public static final int AFTER = 3; +/** constant for dimension block-progression-dimension */ public static final int BLOCKPROGDIM = 4; +/** constant for dimension inline-progression-dimension */ public static final int INLINEPROGDIM = 5; private static final String[] ABS_NAMES = new String[] { @@ -102,6 +121,13 @@