From: William Victor Mote Date: Thu, 1 May 2003 03:32:24 +0000 (+0000) Subject: Refactor: Clean up API between FObj.handleAttrs() and PropertyListBuilder.makeList... X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1505 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab3c2b259a46f506c78bcba4b50a175fabe5f5d4;p=xmlgraphics-fop.git Refactor: Clean up API between FObj.handleAttrs() and PropertyListBuilder.makeList(). Pass the current object instead of the parent. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196380 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 5eaff9f59..650d8c7d8 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -151,15 +151,10 @@ public class FObj extends FONode { * The attributes must be used immediately as the sax attributes * will be altered for the next element. * @param attlist Collection of attributes passed to us from the parser. + * @throws FOPException */ public void handleAttrs(Attributes attlist) throws FOPException { - FObj par = findNearestAncestorFObj(); - PropertyList props = null; - if (par != null) { - props = par.properties; - } - properties = getListBuilder().makeList(FO_URI, name, attlist, props, - par); + properties = getListBuilder().makeList(FO_URI, name, attlist, this); properties.setFObj(this); this.propMgr = makePropertyManager(properties); setWritingMode(); diff --git a/src/java/org/apache/fop/fo/PropertyListBuilder.java b/src/java/org/apache/fop/fo/PropertyListBuilder.java index fe8bdb2bc..e0addaed5 100644 --- a/src/java/org/apache/fop/fo/PropertyListBuilder.java +++ b/src/java/org/apache/fop/fo/PropertyListBuilder.java @@ -117,20 +117,38 @@ public class PropertyListBuilder { return b; } + /** + * + * @param nameSpaceURI URI for the namespace of the element to which + * the attributes belong. + * @param elementName Local name for the element to which the attributes + * belong. + * @param attributes Collection of attributes passed to us from the parser. + * @param fo The FObj to which the attributes need to be attached as + * properties. + * @return PropertyList object containing collection of Properties objects + * appropriate for the FObj + * @throws FOPException + */ public PropertyList makeList(String nameSpaceURI, String elementName, Attributes attributes, - PropertyList parentPropertyList, - FObj parentFO) throws FOPException { + FObj fo) throws FOPException { String nameSpaceURIToUse = "http://www.w3.org/TR/1999/XSL/Format"; if (nameSpaceURI != null) { nameSpaceURIToUse = nameSpaceURI; } + FObj parentFO = fo.findNearestAncestorFObj(); + PropertyList parentPropertyList = null; + if (parentFO != null) { + parentPropertyList = parentFO.properties; + } PropertyList par = null; if (parentPropertyList != null && nameSpaceURIToUse.equals(parentPropertyList.getNameSpace())) { par = parentPropertyList; } + PropertyList p = new PropertyList(par, nameSpaceURIToUse, elementName); p.setBuilder(this);