import java.util.List;
import java.util.ListIterator;
+import javax.naming.Context;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.area.Block;
+import org.apache.fop.area.Trait;
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
+import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.MinOptMax;
/**
int colCount = getColumns().getColumnCount();
TableRowIterator.EffRow lastRow = null;
int lastRowHeight = 0;
+ TableRow rowFO = null;
int yoffset = 0;
//These three variables are our buffer to recombine the individual steps into cells
//Iterate over all steps
while (parentIter.hasNext()) {
Position pos = (Position)parentIter.next();
- //NonLeafPosition nlfp = (NonLeafPosition)pos;
- //if (nlfp.getPosition() instanceof TableContentPosition) {
- // TableContentPosition pos = (TableContentPosition)nlfp.getPosition();
+ rowFO = null;
if (pos instanceof TableContentPosition) {
TableContentPosition tcpos = (TableContentPosition)pos;
if (lastRow != tcpos.row && lastRow != null) {
} else {
end[colIndex] = gup.end;
}
+ if (rowFO == null) {
+ //Find the row if any
+ rowFO = gridUnits[colIndex].getRow();
+ }
}
+
+ //Calculate the height of the row
int maxLen = 0;
for (int i = 0; i < gridUnits.length; i++) {
if ((gridUnits[i] != null)
}
}
lastRowHeight = maxLen;
+
+ //Add areas for row
+ addRowBackgroundArea(rowFO, lastRowHeight, layoutContext.getRefIPD(), yoffset);
for (int i = 0; i < gridUnits.length; i++) {
if ((gridUnits[i] != null)
&& (end[i] == gridUnits[i].getElements().size() - 1)) {
}
}
+ //Calculate the height of the row
int maxLen = 0;
for (int i = 0; i < gridUnits.length; i++) {
if (gridUnits[i] != null) {
maxLen = Math.max(maxLen, getExplicitCellHeight(gridUnits[i]));
}
}
+
+ //Add areas now
+ addRowBackgroundArea(rowFO, lastRowHeight, layoutContext.getRefIPD(), yoffset);
for (int i = 0; i < gridUnits.length; i++) {
if (gridUnits[i] != null) {
log.debug("final flushing " + i + " " + start[i] + "-" + end[i]);
start, end + 1), layoutContext);
}
+ /**
+ * Get the area for a row for background.
+ * @param row the table-row object or null
+ * @return the row area or null if there's no background to paint
+ */
+ public Block getRowArea(TableRow row) {
+ if (row == null || !row.getCommonBorderPaddingBackground().hasBackground()) {
+ return null;
+ } else {
+ Block block = new Block();
+ block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
+ block.setPositioning(Block.ABSOLUTE);
+ TraitSetter.addBackground(block, row.getCommonBorderPaddingBackground());
+ return block;
+ }
+ }
+
+ public void addRowBackgroundArea(TableRow row, int bpd, int ipd, int yoffset) {
+ //Add row background if any
+ Block rowBackground = getRowArea(row);
+ if (rowBackground != null) {
+ rowBackground.setBPD(bpd);
+ rowBackground.setIPD(ipd);
+ rowBackground.setXOffset(this.startXOffset);
+ rowBackground.setYOffset(yoffset);
+ getTableLM().addChildArea(rowBackground);
+ }
+ }
+
+
/**
* Sets the overall starting x-offset. Used for proper placement of cells.
* @param startXOffset starting x-offset (table's start-indent)