diff options
author | Karen Lease <klease@apache.org> | 2000-12-16 21:53:19 +0000 |
---|---|---|
committer | Karen Lease <klease@apache.org> | 2000-12-16 21:53:19 +0000 |
commit | e01b2f6990807ca1ffa657ef835fa82fb76d182a (patch) | |
tree | 9eae9635be7c57dc07669af9c3a7df89f81435e1 /src/org/apache/fop/fo/PropertyList.java | |
parent | ddd7116161ba1f121ae887615c7b3daaee45f7ed (diff) | |
download | xmlgraphics-fop-e01b2f6990807ca1ffa657ef835fa82fb76d182a.tar.gz xmlgraphics-fop-e01b2f6990807ca1ffa657ef835fa82fb76d182a.zip |
Modify to improve handling of compound properties
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193878 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/fo/PropertyList.java')
-rw-r--r-- | src/org/apache/fop/fo/PropertyList.java | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/src/org/apache/fop/fo/PropertyList.java b/src/org/apache/fop/fo/PropertyList.java index 54ca49138..6838960c6 100644 --- a/src/org/apache/fop/fo/PropertyList.java +++ b/src/org/apache/fop/fo/PropertyList.java @@ -60,6 +60,7 @@ public class PropertyList extends Hashtable { private PropertyList parentPropertyList = null; String namespace = ""; String element = ""; + FObj fobj=null; public PropertyList(PropertyList parentPropertyList, String space, String el) { this.parentPropertyList = parentPropertyList; @@ -67,6 +68,21 @@ public class PropertyList extends Hashtable { this.element = el; } + public void setFObj(FObj fobj) { + this.fobj = fobj; + } + + public FObj getFObj() { + return this.fobj; + } + + public FObj getParentFObj() { + if (parentPropertyList != null) { + return parentPropertyList.getFObj(); + } + else return null; + } + /** * Return the value explicitly specified on this FO. * @param propertyName The name of the property whose value is desired. @@ -102,6 +118,21 @@ public class PropertyList extends Hashtable { return null; // No builder or exception in makeProperty! } + private Property findProperty(String propertyName) { + Property p = getExplicit(propertyName); + if (p == null) { + p = this.builder.computeProperty(this,namespace, element, propertyName); + } + if (p == null) { // else inherit (if has parent and is inheritable) + if (this.parentPropertyList != null && + builder.isInherited(namespace, element, propertyName)) { + p = parentPropertyList.findProperty(propertyName); + } + } + return p; + } + + /** * Return the property on the current FlowObject. If it isn't set explicitly, * this will try to compute it based on other properties, or if it is @@ -121,21 +152,12 @@ public class PropertyList extends Hashtable { propertyName = propertyName.substring(0,sepchar); } - Property p = getExplicit(propertyName); - - if (p == null) { // if not explicit - p = this.builder.computeProperty(this,namespace, element, propertyName); - if (p == null) { // else inherit (if has parent and is inheritable) - if ((this.parentPropertyList != null) && - (this.builder.isInherited(namespace, element, propertyName))) { - p = this.parentPropertyList.get(propertyName); // retrieve parent's value - } else { // default value - try { - p = this.builder.makeProperty(this,namespace, element,propertyName); - } catch (FOPException e) { - // don't know what to do here - } - } + Property p = findProperty(propertyName); + if (p == null) { // default value for this FO! + try { + p = this.builder.makeProperty(this,namespace, element,propertyName); + } catch (FOPException e) { + // don't know what to do here } } if (subpropName != null) { |