diff options
author | Keiron Liddle <keiron@apache.org> | 2000-12-12 03:12:52 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2000-12-12 03:12:52 +0000 |
commit | 7464d725f84b11e5e55f210817b1b1a02726497a (patch) | |
tree | 3fc2fa98583bb933e910615fa29567364a4aa081 /src/org/apache/fop/fo/flow/TableRow.java | |
parent | b6b0b4133426dfca547b243ac5d7a7ff44f48bff (diff) | |
download | xmlgraphics-fop-7464d725f84b11e5e55f210817b1b1a02726497a.tar.gz xmlgraphics-fop-7464d725f84b11e5e55f210817b1b1a02726497a.zip |
Updated tables to handle headers, footers, keep-with
colspan is partly done
Also fixed the bug where some of a block was missing if near end of page
Code changes sponsored by Dresdner Bank, Germany
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193859 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/fo/flow/TableRow.java')
-rw-r--r-- | src/org/apache/fop/fo/flow/TableRow.java | 87 |
1 files changed, 73 insertions, 14 deletions
diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index fdc571c3d..8c6e0b5d4 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -75,6 +75,8 @@ public class TableRow extends FObj { return new TableRow.Maker(); } + boolean setup = false; + FontState fs; int spaceBefore; int spaceAfter; @@ -97,6 +99,8 @@ public class TableRow extends FObj { int paddingBottom; int paddingLeft; int paddingRight; + int keepWithNext; + int keepWithPrevious; int widthOfCellsSoFar = 0; int largestCellHeight = 0; @@ -155,6 +159,7 @@ public class TableRow extends FObj { /** the width of the cell so far.*/ private int widthOfCellSoFar; + private int column = 0; /** * simple no args constructor. @@ -223,6 +228,11 @@ public class TableRow extends FObj { public final void setWidthOfCellSoFar(int aWidth) { widthOfCellSoFar = aWidth; } + public int getColumn() + { return column; } + + public void setColumn(int col) + { column = col; } } @@ -235,12 +245,13 @@ public class TableRow extends FObj { this.columns = columns; } - public Status layout(Area area) throws FOPException { - if (this.marker == BREAK_AFTER) { - return new Status(Status.OK); - } + public int getKeepWithPrevious() + { + return keepWithPrevious; + } - if (this.marker == START) { + public void doSetup(Area area) throws FOPException + { String fontFamily = this.properties.get("font-family").getString(); String fontStyle = @@ -303,6 +314,10 @@ public class TableRow extends FObj { this.borderRightStyle = this.properties.get("border-right-style").getEnum(); } + this.keepWithNext = + this.properties.get("keep-with-next").getNumber().intValue(); + this.keepWithPrevious = + this.properties.get("keep-with-previous").getNumber().intValue(); this.paddingTop = this.properties.get("padding").getLength().mvalue(); this.paddingLeft = this.paddingTop; @@ -320,6 +335,17 @@ public class TableRow extends FObj { } this.id= this.properties.get("id").getString(); + setup = true; + } + + public Status layout(Area area) throws FOPException { + if (this.marker == BREAK_AFTER) { + return new Status(Status.OK); + } + + if (this.marker == START) { + if(!setup) + doSetup(area); if (area instanceof BlockArea) { area.end(); @@ -386,10 +412,10 @@ public class TableRow extends FObj { areaContainer.setIDReferences(area.getIDReferences()); int numChildren = this.children.size(); - if (numChildren != columns.size()) { - MessageHandler.errorln("WARNING: Number of children under table-row not equal to number of table-columns"); - return new Status(Status.OK); - } +// if (numChildren != columns.size()) { +// MessageHandler.errorln("WARNING: Number of children under table-row not equal to number of table-columns"); +// return new Status(Status.OK); +// } // added by Eric Schaeffer widthOfCellsSoFar = 0; @@ -398,13 +424,20 @@ public class TableRow extends FObj { // added by Hani Elabed 11/27/2000 boolean someCellDidNotLayoutCompletely = false; - + int colCount = -1; for (int i = this.marker; i < numChildren; i++) { TableCell cell = (TableCell) children.elementAt(i); // added by Hani Elabed 11/22/2000 CellState cellState = (CellState) cells.elementAt( i ); + if(colCount == -1) { + colCount = cellState.getColumn(); + } + cell.doSetup(areaContainer); + int numCols = cell.getNumColumnsSpanned(); + int numRows = cell.getNumRowsSpanned(); + //if (this.isInListBody) { //fo.setIsInListBody(); @@ -419,7 +452,12 @@ public class TableRow extends FObj { //cell.setStartOffset(widthOfCellsSoFar); cell.setStartOffset( cellState.getWidthOfCellSoFar() ); - int width = ((TableColumn) columns.elementAt(i)).getColumnWidth(); + int width = 0; + cellState.setColumn(colCount); + for(int count = 0; count < numCols && count < columns.size(); count++) { + width += ((TableColumn) columns.elementAt(colCount)).getColumnWidth(); + colCount++; + } cell.setWidth(width); widthOfCellsSoFar += width; @@ -428,10 +466,10 @@ public class TableRow extends FObj { if ((status = cell.layout(areaContainer)).isIncomplete()) { this.marker = i; - if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) +/* if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE)) { status = new Status(Status.AREA_FULL_SOME); - } + }*/ if( status.getCode() == Status.AREA_FULL_SOME ) @@ -464,6 +502,7 @@ public class TableRow extends FObj { // removing something that was added by succession // of cell.layout() // just to keep my sanity here, Hani + area.increaseHeight(areaContainer.getHeight()); area.removeChild(areaContainer); this.resetMarker(); this.removeID(area.getIDReferences()); @@ -495,8 +534,10 @@ public class TableRow extends FObj { } // added by Dresdner Bank, Germany - if(spacer != null) + if(spacer != null) { area.addChild(spacer); + spacer = null; + } area.addChild(areaContainer); areaContainer.end(); @@ -544,6 +585,9 @@ public class TableRow extends FObj { } else { + if (keepWithNext != 0) { + return new Status(Status.KEEP_WITH_NEXT); + } return new Status(Status.OK); } @@ -552,4 +596,19 @@ public class TableRow extends FObj { public int getAreaHeight() { return areaContainer.getHeight(); } + + public void removeLayout(Area area) + { + if(spacer != null) + area.removeChild(spacer); + + // removing something that was added by succession + // of cell.layout() + // just to keep my sanity here, Hani +// area.increaseHeight(areaContainer.getHeight()); + area.removeChild(areaContainer); + this.resetMarker(); + this.removeID(area.getIDReferences()); + marker = 0; + } } |