From: William Victor Mote Date: Thu, 1 May 2003 09:02:17 +0000 (+0000) Subject: Refactor: rename and cleanup findBaseProperty(). X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1499 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b0aa6451cff09798e724e0435a0e839739a263ac;p=xmlgraphics-fop.git Refactor: rename and cleanup findBaseProperty(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196386 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/PropertyListBuilder.java b/src/java/org/apache/fop/fo/PropertyListBuilder.java index 33da6d242..c8feeae81 100644 --- a/src/java/org/apache/fop/fo/PropertyListBuilder.java +++ b/src/java/org/apache/fop/fo/PropertyListBuilder.java @@ -188,10 +188,10 @@ public class PropertyListBuilder { PropertyList propList, FObj parentFO) { /* Handle "compound" properties, ex. space-before.minimum */ - String basePropName = findBasePropertyName(attributeName); - String subPropName = findSubPropertyName(attributeName); + String basePropertyName = findBasePropertyName(attributeName); + String subPropertyName = findSubPropertyName(attributeName); - Property.Maker propertyMaker = findMaker(validProperties, basePropName); + Property.Maker propertyMaker = findMaker(validProperties, basePropertyName); if (propertyMaker == null) { handleInvalidProperty(attributeName); return; @@ -201,14 +201,17 @@ public class PropertyListBuilder { } try { Property prop = null; - if (subPropName == null) { + if (subPropertyName == null) { prop = propertyMaker.make(propList, attributeValue, parentFO); } else { - prop = findSubPropValue(attributes, propList, parentFO, basePropName, subPropName, prop, propertyMaker, attributeValue); + Property baseProperty = findBaseProperty(attributes, propList, + parentFO, basePropertyName, propertyMaker); + prop = propertyMaker.make(baseProperty, subPropertyName, + propList, attributeValue, parentFO); } if (prop != null) { - propList.put(basePropName, prop); + propList.put(basePropertyName, prop); } } catch (FOPException e) { @@ -217,28 +220,27 @@ public class PropertyListBuilder { } } - private Property findSubPropValue(Attributes attributes, - PropertyList p, + private Property findBaseProperty(Attributes attributes, + PropertyList propertyList, FObj parentFO, String basePropName, - String subPropName, - Property propVal, - Maker propertyMaker, - String attributeValue) + Maker propertyMaker) throws FOPException { - Property baseProp = p.getExplicitBaseProp(basePropName); - if (baseProp == null) { - // See if it is specified later in this list - String baseValue = attributes.getValue(basePropName); - if (baseValue != null) { - baseProp = propertyMaker.make(p, baseValue, - parentFO); - } - // else baseProp = propertyMaker.makeCompound(p, parentFO); + // If the baseProperty has already been created, return it + Property baseProperty = propertyList.getExplicitBaseProp(basePropName); + if (baseProperty != null) { + return baseProperty; + } + // If it is specified later in this list of Attributes, create it + String basePropertyValue = attributes.getValue(basePropName); + if (basePropertyValue != null) { + baseProperty = propertyMaker.make(propertyList, basePropertyValue, + parentFO); + return baseProperty; } - propVal = propertyMaker.make(baseProp, subPropName, p, attributeValue, - parentFO); - return propVal; + // Otherwise it is a compound property ?? + // baseProperty = propertyMaker.makeCompound(propertyList, parentFO); + return baseProperty; } private void handleInvalidProperty(String attributeName) {