aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-07-26 10:01:41 +0000
committerJeremias Maerki <jeremias@apache.org>2005-07-26 10:01:41 +0000
commit4cebac3e2785d691b8df6437577cf7a0b5e59707 (patch)
treedea01ae14b465a4e8cb0461c55542beeda232dc0 /src
parentfce67cde95574b4fe4d263c5fe5dba3df92ae7bf (diff)
downloadxmlgraphics-fop-4cebac3e2785d691b8df6437577cf7a0b5e59707.tar.gz
xmlgraphics-fop-4cebac3e2785d691b8df6437577cf7a0b5e59707.zip
Send the ID of the producing FO to the area tree as trait where possible.
This is useful for testing and may later be interesting for FO editor implementors and for other things where you want to identify the generating FO from a particular object in the output. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@225268 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/area/Trait.java6
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java1
-rw-r--r--src/java/org/apache/fop/layoutmgr/TraitSetter.java12
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java1
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java3
-rw-r--r--src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java1
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java1
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java13
9 files changed, 26 insertions, 14 deletions
diff --git a/src/java/org/apache/fop/area/Trait.java b/src/java/org/apache/fop/area/Trait.java
index 326502e7b..fa44ebe4d 100644
--- a/src/java/org/apache/fop/area/Trait.java
+++ b/src/java/org/apache/fop/area/Trait.java
@@ -66,9 +66,9 @@ public class Trait implements Serializable {
public static final Integer COLOR = new Integer(7);
/**
- * Don't think this is necessary.
+ * The ID of the FO that produced an area.
*/
- public static final Integer ID_AREA = new Integer(8);
+ public static final Integer PROD_ID = new Integer(8);
/**
* Background trait for an area.
@@ -224,7 +224,7 @@ public class Trait implements Serializable {
TRAIT_INFO.put(FONT_SIZE,
new TraitInfo("font-size", Integer.class));
TRAIT_INFO.put(COLOR, new TraitInfo("color", String.class));
- TRAIT_INFO.put(ID_AREA, new TraitInfo("id-area", String.class));
+ TRAIT_INFO.put(PROD_ID, new TraitInfo("prod-id", String.class));
TRAIT_INFO.put(BACKGROUND,
new TraitInfo("background", Background.class));
TRAIT_INFO.put(UNDERLINE,
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 001fdfbb6..440c1b97e 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -771,6 +771,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
viewportBlockArea.setBPD(vpContentBPD);
}
+ TraitSetter.setProducerID(viewportBlockArea, getBlockContainerFO().getId());
TraitSetter.addBorders(viewportBlockArea,
getBlockContainerFO().getCommonBorderPaddingBackground());
TraitSetter.addBackground(viewportBlockArea,
@@ -800,6 +801,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
referenceArea = new Block();
referenceArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
+ TraitSetter.setProducerID(referenceArea, getBlockContainerFO().getId());
if (abProps.absolutePosition == EN_ABSOLUTE) {
viewportBlockArea.setPositioning(Block.ABSOLUTE);
diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
index 46dbf1407..83be99b71 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
@@ -402,6 +402,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
/*Area parentArea =*/ parentLM.getParentArea(curBlockArea);
// set traits
+ TraitSetter.setProducerID(curBlockArea, getBlockFO().getId());
TraitSetter.addBorders(curBlockArea,
getBlockFO().getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea,
diff --git a/src/java/org/apache/fop/layoutmgr/TraitSetter.java b/src/java/org/apache/fop/layoutmgr/TraitSetter.java
index 24ace2733..d16593914 100644
--- a/src/java/org/apache/fop/layoutmgr/TraitSetter.java
+++ b/src/java/org/apache/fop/layoutmgr/TraitSetter.java
@@ -348,4 +348,16 @@ public class TraitSetter {
}
}
}
+
+ /**
+ * Sets the producer's ID as a trait on the area. This can be used to track back the
+ * generating FO node.
+ * @param area the area to set the traits on
+ * @param id the ID to set
+ */
+ public static void setProducerID(Area area, String id) {
+ if (id != null && id.length() > 0) {
+ area.addTrait(Trait.PROD_ID, id);
+ }
+ }
}
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
index 78b1e40e9..8536c062e 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
@@ -204,6 +204,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager {
/*Area parentArea =*/ parentLM.getParentArea(curBlockArea);
// set traits
+ TraitSetter.setProducerID(curBlockArea, getListBlockFO().getId());
TraitSetter.addBorders(curBlockArea,
getListBlockFO().getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea,
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
index 9fcb8d6c9..d86d06b31 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
@@ -28,6 +28,7 @@ import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.NonLeafPosition;
+import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
@@ -189,6 +190,8 @@ public class ListItemContentLayoutManager extends BlockStackingLayoutManager {
curBlockArea.setIPD(itemIPD);
//curBlockArea.setHeight();
+ TraitSetter.setProducerID(curBlockArea, getPartFO().getId());
+
// Set up dimensions
Area parentArea = parentLM.getParentArea(curBlockArea);
int referenceIPD = parentArea.getIPD();
diff --git a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
index 76a193d70..7092078cc 100644
--- a/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
@@ -541,6 +541,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager {
/*Area parentArea =*/ parentLM.getParentArea(curBlockArea);
// set traits
+ TraitSetter.setProducerID(curBlockArea, getListItemFO().getId());
TraitSetter.addBorders(curBlockArea,
getListItemFO().getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea,
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
index 210b55227..6a01facc5 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
@@ -424,6 +424,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager implement
if (curBlockArea == null) {
curBlockArea = new Block();
curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
+ TraitSetter.setProducerID(curBlockArea, fobj.getId());
curBlockArea.setPositioning(Block.ABSOLUTE);
int indent = 0;
indent += startBorderWidth;
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
index cdb1ea781..31c684639 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
@@ -28,8 +28,6 @@ import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthGlue;
import org.apache.fop.layoutmgr.KnuthPenalty;
-import org.apache.fop.layoutmgr.LayoutManager;
-import org.apache.fop.layoutmgr.LeafPosition;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.Position;
@@ -41,7 +39,6 @@ import org.apache.fop.traits.SpaceVal;
import java.util.Iterator;
import java.util.LinkedList;
-import java.util.List;
/**
* LayoutManager for a table FO.
@@ -68,14 +65,6 @@ public class TableLayoutManager extends BlockStackingLayoutManager
private MinOptMax spaceAfter;
- private class SectionPosition extends LeafPosition {
- protected List list;
- protected SectionPosition(LayoutManager lm, int pos, List l) {
- super(lm, pos);
- list = l;
- }
- }
-
/**
* Create a new table layout manager.
* @param node the table FO
@@ -347,6 +336,8 @@ public class TableLayoutManager extends BlockStackingLayoutManager
// Must get dimensions from parent area
/*Area parentArea =*/ parentLM.getParentArea(curBlockArea);
+ TraitSetter.setProducerID(curBlockArea, getTable().getId());
+
int contentIPD = referenceIPD - getIPIndents();
curBlockArea.setIPD(contentIPD);