Parcourir la source

Corrected a validation problem. Made TableFooter use TableBody's validation.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198465 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Simon Pepping il y a 19 ans
Parent
révision
07493978a3

+ 9
- 9
src/java/org/apache/fop/fo/flow/TableBody.java Voir le fichier

@@ -53,8 +53,8 @@ public class TableBody extends FObj {
private PropertyList savedPropertyList;

private boolean tableRowsFound = false;
private boolean tableColumnsFound = false;
protected boolean tableRowsFound = false;
protected boolean tableCellsFound = false;
/**
* @param parent FONode that is the parent of the object
@@ -93,7 +93,7 @@ public class TableBody extends FObj {
*/
protected void endOfNode() throws FOPException {
getFOEventHandler().endBody(this);
if (!(tableRowsFound || tableColumnsFound)) {
if (!(tableRowsFound || tableCellsFound)) {
if (getUserAgent().validateStrictly()) {
missingChildElementError("marker* (table-row+|table-cell+)");
} else {
@@ -113,21 +113,21 @@ public class TableBody extends FObj {
throws ValidationException {
if (nsURI == FO_URI) {
if (localName.equals("marker")) {
if (tableRowsFound || tableColumnsFound) {
if (tableRowsFound || tableCellsFound) {
nodesOutOfOrderError(loc, "fo:marker", "(table-row+|table-cell+)");
}
} else if (localName.equals("table-row")) {
tableRowsFound = true;
if (tableColumnsFound) {
if (tableCellsFound) {
invalidChildError(loc, nsURI, localName, "Either fo:table-rows" +
" or fo:table-columns may be children of an fo:table-body" +
" or fo:table-cells may be children of an " + getName() +
" but not both");
}
} else if (localName.equals("table-column")) {
tableColumnsFound = true;
} else if (localName.equals("table-cell")) {
tableCellsFound = true;
if (tableRowsFound) {
invalidChildError(loc, nsURI, localName, "Either fo:table-rows" +
" or fo:table-columns may be children of an fo:table-body" +
" or fo:table-cells may be children of an " + getName() +
" but not both");
}
} else {

+ 2
- 38
src/java/org/apache/fop/fo/flow/TableFooter.java Voir le fichier

@@ -1,5 +1,5 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
* Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,9 +37,6 @@ public class TableFooter extends TableBody {
super(parent);
}

private boolean tableRowsFound = false;
private boolean tableColumnsFound = false;

/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
@@ -47,45 +44,12 @@ public class TableFooter extends TableBody {
// getFOEventHandler().startBody(this);
}

/**
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
* XSL Content Model: marker* (table-row+|table-cell+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
if (nsURI == FO_URI) {
if (localName.equals("marker")) {
if (tableRowsFound || tableColumnsFound) {
nodesOutOfOrderError(loc, "fo:marker", "(table-row+|table-cell+)");
}
} else if (localName.equals("table-row")) {
tableRowsFound = true;
if (tableColumnsFound) {
invalidChildError(loc, nsURI, localName, "Either fo:table-rows" +
" or fo:table-columns may be children of an fo:table-footer" +
" but not both");
}
} else if (localName.equals("table-column")) {
tableColumnsFound = true;
if (tableRowsFound) {
invalidChildError(loc, nsURI, localName, "Either fo:table-rows" +
" or fo:table-columns may be children of an fo:table-footer" +
" but not both");
}
} else {
invalidChildError(loc, nsURI, localName);
}
} else {
invalidChildError(loc, nsURI, localName);
}
}

/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
// getFOEventHandler().endFooter(this);
if (!(tableRowsFound || tableColumnsFound)) {
if (!(tableRowsFound || tableCellsFound)) {
missingChildElementError("marker* (table-row+|table-cell+)");
}
// convertCellsToRows();

Chargement…
Annuler
Enregistrer