aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2008-02-13 20:10:01 +0000
committerVincent Hennebert <vhennebert@apache.org>2008-02-13 20:10:01 +0000
commit40f03bc5a0233f5081acae13cc55f26e91714790 (patch)
tree7418e605efd4a9b075623276417bf505f6ffcba5 /src/java/org
parent71ecb950fba8d7134c912acda3a75845930099cb (diff)
downloadxmlgraphics-fop-40f03bc5a0233f5081acae13cc55f26e91714790.tar.gz
xmlgraphics-fop-40f03bc5a0233f5081acae13cc55f26e91714790.zip
Moved to the FO tree stage the check for break-before/after on table-row while spanning in progress, and fixed bug #44321 as well
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@627576 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/fo/FONode.java2
-rw-r--r--src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java20
-rw-r--r--src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java19
-rw-r--r--src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java13
-rw-r--r--src/java/org/apache/fop/layoutmgr/table/TableStepper.java14
5 files changed, 46 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/fo/FONode.java b/src/java/org/apache/fop/fo/FONode.java
index 7c517e418..f0422e414 100644
--- a/src/java/org/apache/fop/fo/FONode.java
+++ b/src/java/org/apache/fop/fo/FONode.java
@@ -360,7 +360,7 @@ public abstract class FONode implements Cloneable {
* (e.g., currently unsupported properties)
* @param problem text to display that indicates the problem
*/
- protected void attributeWarning(String problem) {
+ public void attributeWarning(String problem) {
log.warn(warningText(locator) + getName() + ", " + problem);
}
diff --git a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
index b0126dff0..62cf3e26d 100644
--- a/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
+++ b/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.ValidationException;
@@ -115,7 +116,24 @@ class FixedColRowGroupBuilder extends RowGroupBuilder {
}
/** {@inheritDoc} */
- void endRow(TableCellContainer container) {
+ void endRow(TableRow row) {
+ if (currentRowIndex > 0 && row.getBreakBefore() != Constants.EN_AUTO) {
+ row.attributeWarning("break-before ignored because of row spanning "
+ + "in progress (See XSL 1.1, 7.20.2)");
+ }
+ if (currentRowIndex < rows.size() - 1 && row.getBreakAfter() != Constants.EN_AUTO) {
+ row.attributeWarning("break-after ignored because of row spanning "
+ + "in progress (See XSL 1.1, 7.20.1)");
+ }
+ handleRowEnd(row);
+ }
+
+ /** {@inheritDoc} */
+ void endRow(TableBody body) {
+ handleRowEnd(body);
+ }
+
+ private void handleRowEnd(TableCellContainer container) {
List currentRow = (List) rows.get(currentRowIndex);
lastRow = currentRow;
// Fill gaps with empty grid units
diff --git a/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
index f25886581..3f7549787 100644
--- a/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
+++ b/src/java/org/apache/fop/fo/flow/table/RowGroupBuilder.java
@@ -58,12 +58,23 @@ abstract class RowGroupBuilder {
/**
* Receives notification of the end of the current row. If the current row finishes
* the row group, the {@link TableBody#addRowGroup(List)} method of the parent table
- * part (i.e., the given container itself or its parent if this is a table-row) will
- * be called
+ * part will be called.
*
- * @param container the parent element of the current row
+ * @param row the row being finished
*/
- abstract void endRow(TableCellContainer container);
+ abstract void endRow(TableRow row);
+
+ /**
+ * Receives notification of the end of the current row, when the source contains no
+ * fo:table-row element. If the current row finishes the row group, the
+ * {@link TableBody#addRowGroup(List)} method of the given table part will be called.
+ *
+ * <p>If the source does contain explicit fo:table-row elements, then the
+ * {@link #endRow(TableRow)} method will be called instead.</p>
+ *
+ * @param part the part containing the current row
+ */
+ abstract void endRow(TableBody part);
/**
* Receives notification of the start of a table-header/footer/body.
diff --git a/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java b/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
index 47c96dcca..801153ce9 100644
--- a/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
+++ b/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
@@ -73,10 +73,19 @@ class VariableColRowGroupBuilder extends RowGroupBuilder {
}
/** {@inheritDoc} */
- void endRow(final TableCellContainer container) {
+ void endRow(final TableRow row) {
events.add(new Event() {
public void play(RowGroupBuilder rowGroupBuilder) {
- rowGroupBuilder.endRow(container);
+ rowGroupBuilder.endRow(row);
+ }
+ });
+ }
+
+ /** {@inheritDoc} */
+ void endRow(final TableBody part) {
+ events.add(new Event() {
+ public void play(RowGroupBuilder rowGroupBuilder) {
+ rowGroupBuilder.endRow(part);
}
});
}
diff --git a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
index 0b494bf2d..2560b3aac 100644
--- a/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
+++ b/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
@@ -26,11 +26,9 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.FONode;
import org.apache.fop.fo.flow.table.EffRow;
import org.apache.fop.fo.flow.table.GridUnit;
import org.apache.fop.fo.flow.table.PrimaryGridUnit;
-import org.apache.fop.fo.flow.table.TableRow;
import org.apache.fop.layoutmgr.BreakElement;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthGlue;
@@ -456,20 +454,8 @@ public class TableStepper {
*/
private void prepareNextRow() {
if (activeRowIndex < rowGroup.length - 1) {
- TableRow rowFO = rowGroup[activeRowIndex].getTableRow();
- if (rowFO != null && rowFO.getBreakAfter() != Constants.EN_AUTO) {
- log.warn(FONode.decorateWithContextInfo(
- "break-after ignored on table-row because of row spanning "
- + "in progress (See XSL 1.0, 7.19.1)", rowFO));
- }
previousRowsLength += rowGroup[activeRowIndex].getHeight().opt;
activateCells(nextActiveCells, activeRowIndex + 1);
- rowFO = rowGroup[activeRowIndex + 1].getTableRow();
- if (rowFO != null && rowFO.getBreakBefore() != Constants.EN_AUTO) {
- log.warn(FONode.decorateWithContextInfo(
- "break-before ignored on table-row because of row spanning "
- + "in progress (See XSL 1.0, 7.19.2)", rowFO));
- }
if (log.isTraceEnabled()) {
log.trace("Computing first step for row " + (activeRowIndex + 2));
}