]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Refactor: extract overloaded method convertAttributeToProperty() from the "for" loop...
authorWilliam Victor Mote <vmote@apache.org>
Thu, 1 May 2003 05:57:33 +0000 (05:57 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Thu, 1 May 2003 05:57:33 +0000 (05:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196383 13f79535-47bb-0310-9956-ffa450edef68

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

index 56b2c50756605c8b891a9a671aaa172a2299cbe0..2a6c5a31928169e87e9f665b267a6de0a8b9fa1d 100644 (file)
@@ -160,50 +160,58 @@ public class PropertyListBuilder {
 
         for (int i = 0; i < attributes.getLength(); i++) {
             String attributeName = attributes.getQName(i);
-            /* Handle "compound" properties, ex. space-before.minimum */
-            String basePropName = findBasePropertyName(attributeName);
-            String subPropName = findSubPropertyName(attributeName);
-            Property propVal = null;
-
-            Property.Maker propertyMaker = findMaker(validProperties, basePropName);
-
-            if (propertyMaker != null) {
-                try {
-                    if (subPropName != null) {
-                        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);
+            convertAttributeToProperty(attributes, attributeName, validProperties, p, parentFO, i);
+        }
+        return p;
+    }
+
+    private void convertAttributeToProperty(Attributes attributes,
+                                            String attributeName,
+                                            HashMap validProperties,
+                                            PropertyList p,
+                                            FObj parentFO,
+                                            int i) {
+        /* Handle "compound" properties, ex. space-before.minimum */
+        String basePropName = findBasePropertyName(attributeName);
+        String subPropName = findSubPropertyName(attributeName);
+        Property propVal = null;
+
+        Property.Maker propertyMaker = findMaker(validProperties, basePropName);
+
+        if (propertyMaker != null) {
+            try {
+                if (subPropName != null) {
+                    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);
                         }
-                        propVal = propertyMaker.make(baseProp, subPropName,
-                                                     p,
-                                                     attributes.getValue(i),
-                                                     parentFO);
-                    } else {
-                        propVal = propertyMaker.make(p,
-                                                     attributes.getValue(i),
-                                                     parentFO);
-                    }
-                    if (propVal != null) {
-                        p.put(basePropName, propVal);
+                        // else baseProp = propertyMaker.makeCompound(p, parentFO);
                     }
-                } catch (FOPException e) { /* Do other props. */
-                    //log.error(e.getMessage());
+                    propVal = propertyMaker.make(baseProp, subPropName,
+                                                 p,
+                                                 attributes.getValue(i),
+                                                 parentFO);
+                } else {
+                    propVal = propertyMaker.make(p,
+                                                 attributes.getValue(i),
+                                                 parentFO);
                 }
-            } else {
-                if (!attributeName.startsWith("xmlns")) {
-                    //log.error("property '"
-                    //                       + attributeName + "' ignored");
+                if (propVal != null) {
+                    p.put(basePropName, propVal);
                 }
+            } catch (FOPException e) { /* Do other props. */
+                //log.error(e.getMessage());
+            }
+        } else {
+            if (!attributeName.startsWith("xmlns")) {
+                //log.error("property '"
+                //                       + attributeName + "' ignored");
             }
         }
-
-        return p;
     }
 
     /**