aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Victor Mote <vmote@apache.org>2003-05-02 15:09:59 +0000
committerWilliam Victor Mote <vmote@apache.org>2003-05-02 15:09:59 +0000
commit0129d4c43c3f3152a7dc65c4208b8edb420bf8f1 (patch)
tree8aa409f88ccf6303d59332e58fb512862cdedafc /src
parent6c7415c9247bb6108b86319ce678d41c287de586 (diff)
downloadxmlgraphics-fop-0129d4c43c3f3152a7dc65c4208b8edb420bf8f1.tar.gz
xmlgraphics-fop-0129d4c43c3f3152a7dc65c4208b8edb420bf8f1.zip
Refactor: extract method findNearestAncestorGeneratingRAs() from setWritingMode().
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196389 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/FObj.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java
index 9caf7af97..a35729774 100644
--- a/src/java/org/apache/fop/fo/FObj.java
+++ b/src/java/org/apache/fop/fo/FObj.java
@@ -172,6 +172,23 @@ public class FObj extends FONode {
return (FObj)par;
}
+ /**
+ * Find nearest ancestor, including self, which generates
+ * reference areas.
+ * If no such ancestor is found, use the value on the root FO.
+ *
+ * @return FObj of the nearest ancestor that generates Reference Areas
+ */
+ private FObj findNearestAncestorGeneratingRAs() {
+ FObj p;
+ FONode parent;
+ for (p = this; !p.generatesReferenceAreas()
+ && (parent = p.getParent()) != null
+ && (parent instanceof FObj); p = (FObj) parent) {
+ }
+ return p;
+ }
+
public PropertyList getPropertiesForNamespace(String nameSpaceURI) {
if (this.properties == null) {
return null;
@@ -283,17 +300,11 @@ public class FObj extends FONode {
/**
* Set writing mode for this FO.
- * Find nearest ancestor, including self, which generates
- * reference areas and use the value of its writing-mode property.
- * If no such ancestor is found, use the value on the root FO.
+ * Use that from the nearest ancestor, including self, which generates
+ * reference areas, or from root FO if no ancestor found.
*/
protected void setWritingMode() {
- FObj p;
- FONode parent;
- for (p = this; !p.generatesReferenceAreas()
- && (parent = p.getParent()) != null
- && (parent instanceof FObj); p = (FObj) parent) {
- }
+ FObj p = findNearestAncestorGeneratingRAs();
this.properties.setWritingMode(
p.getProperty("writing-mode").getEnum());
}
@@ -339,6 +350,7 @@ public class FObj extends FONode {
* If this object can contain markers it checks that the marker
* has a unique class-name for this object and that it is
* the first child.
+ * @param marker Marker to add.
*/
public void addMarker(Marker marker) {
String mcname = marker.getMarkerClassName();