You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vm...@apache.org on 2003/05/02 17:10:00 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fo FObj.java
vmote 2003/05/02 08:09:59
Modified: src/java/org/apache/fop/fo FObj.java
Log:
Refactor: extract method findNearestAncestorGeneratingRAs() from setWritingMode().
Revision Changes Path
1.5 +21 -9 xml-fop/src/java/org/apache/fop/fo/FObj.java
Index: FObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FObj.java 1 May 2003 04:42:43 -0000 1.4
+++ FObj.java 2 May 2003 15:09:59 -0000 1.5
@@ -172,6 +172,23 @@
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 @@
/**
* 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 @@
* 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();
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org