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-ffa450edef68tags/fop-0_90-alpha1
@@ -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, |
@@ -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); |
@@ -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, |
@@ -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); | |||
} | |||
} | |||
} |
@@ -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, |
@@ -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(); |
@@ -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, |
@@ -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; |
@@ -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); | |||