diff options
author | William Victor Mote <vmote@apache.org> | 2003-05-01 05:57:33 +0000 |
---|---|---|
committer | William Victor Mote <vmote@apache.org> | 2003-05-01 05:57:33 +0000 |
commit | 680e02cc8ef11c9dbb6acf43eaaa1e63dea6b8e6 (patch) | |
tree | 4917482be5950ce196eb86d6f14db1b8a3c9e17b /src | |
parent | 61e23f934c8089be1f0b94bbe024af026f310e81 (diff) | |
download | xmlgraphics-fop-680e02cc8ef11c9dbb6acf43eaaa1e63dea6b8e6.tar.gz xmlgraphics-fop-680e02cc8ef11c9dbb6acf43eaaa1e63dea6b8e6.zip |
Refactor: extract overloaded method convertAttributeToProperty() from the "for" loop in makeList().
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196383 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/fo/PropertyListBuilder.java | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyListBuilder.java b/src/java/org/apache/fop/fo/PropertyListBuilder.java index 56b2c5075..2a6c5a319 100644 --- a/src/java/org/apache/fop/fo/PropertyListBuilder.java +++ b/src/java/org/apache/fop/fo/PropertyListBuilder.java @@ -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; } /** |