]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Refactor: rename and cleanup findBaseProperty().
authorWilliam Victor Mote <vmote@apache.org>
Thu, 1 May 2003 09:02:17 +0000 (09:02 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Thu, 1 May 2003 09:02:17 +0000 (09:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196386 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/PropertyListBuilder.java

index 33da6d242176e25229ee11f198dd12daa8b69058..c8feeae8121cd56ff1c949489b92b3ec4fb3a914 100644 (file)
@@ -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) {