You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2005/05/13 09:07:53 UTC
cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr/table TableContentLayoutManager.java EffRow.java
jeremias 2005/05/13 00:07:53
Modified: src/java/org/apache/fop/layoutmgr/table Tag:
Temp_KnuthStylePageBreaking
TableContentLayoutManager.java EffRow.java
Log:
More careful approach to handling missing grid units during addAreas stage.
Plus some comments in code.
Revision Changes Path
No revision
No revision
1.1.2.14 +6 -2 xml-fop/src/java/org/apache/fop/layoutmgr/table/Attic/TableContentLayoutManager.java
Index: TableContentLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Attic/TableContentLayoutManager.java,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- TableContentLayoutManager.java 12 May 2005 14:13:45 -0000 1.1.2.13
+++ TableContentLayoutManager.java 13 May 2005 07:07:53 -0000 1.1.2.14
@@ -706,10 +706,14 @@
//Add areas for row
//addRowBackgroundArea(rowFO, lastRowHeight, layoutContext.getRefIPD(), yoffset);
for (int i = 0; i < gridUnits.length; i++) {
- GridUnit currentGU = lastRow.getGridUnit(i);
+ GridUnit currentGU = lastRow.safelyGetGridUnit(i);
if ((gridUnits[i] != null)
&& (forcedFlush || (end[i] == gridUnits[i].getElements().size() - 1))
&& (currentGU == null || currentGU.isLastGridUnitRowSpan())) {
+ //the last line in the "if" above is to avoid a premature end of an
+ //row-spanned cell because no GridUnitParts are generated after a cell is
+ //finished with its content. currentGU can be null if there's no grid unit
+ //at this place in the current row (empty cell and no borders to process)
if (log.isDebugEnabled()) {
log.debug((forcedFlush ? "FORCED " : "") + "flushing..." + i + " "
+ start[i] + "-" + end[i]);
1.1.2.3 +20 -4 xml-fop/src/java/org/apache/fop/layoutmgr/table/Attic/EffRow.java
Index: EffRow.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Attic/EffRow.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- EffRow.java 12 May 2005 14:13:45 -0000 1.1.2.2
+++ EffRow.java 13 May 2005 07:07:53 -0000 1.1.2.3
@@ -60,9 +60,25 @@
return gridUnits;
}
- public GridUnit getGridUnit(int index) {
- if (index >= 0 && index < gridUnits.size()) {
- return (GridUnit)gridUnits.get(index);
+ /**
+ * Returns the grid unit at a given position.
+ * @param column index of the grid unit in the row (zero based)
+ * @return the requested grid unit.
+ */
+ public GridUnit getGridUnit(int column) {
+ return (GridUnit)gridUnits.get(column);
+ }
+
+ /**
+ * Returns the grid unit at a given position. In contrast to getGridUnit() this
+ * method returns null if there's no grid unit at the given position. The number of
+ * grid units for row x can be smaller than the number of grid units for row x-1.
+ * @param column index of the grid unit in the row (zero based)
+ * @return the requested grid unit or null if there's no grid unit at this position.
+ */
+ public GridUnit safelyGetGridUnit(int column) {
+ if (column < gridUnits.size()) {
+ return (GridUnit)gridUnits.get(column);
} else {
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org