From: arved Date: Thu, 10 May 2001 00:53:22 +0000 (+0000) Subject: G. Pretterhofer: added support for 'number-columns-repeated' X-Git-Tag: PRE_CODEFORMATTING~142 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=67f022367e160f8d962d7c79fb76a8ce9a413254;p=xmlgraphics-fop.git G. Pretterhofer: added support for 'number-columns-repeated' git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194235 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 1cc52e316..8468dc0cf 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -179,18 +179,20 @@ public class Table extends FObj { FONode fo = (FONode) children.elementAt(i); if (fo instanceof TableColumn) { TableColumn c = (TableColumn) fo; - int num = c.getColumnNumber(); - if (num == 0) { - num = currentColumnNumber + 1; + c.doSetup(areaContainer); + int numColumnsRepeated = c.getNumColumnsRepeated(); + //int currentColumnNumber = c.getColumnNumber(); + + for (int j = 0; j < numColumnsRepeated; j++) { + currentColumnNumber++; + if (currentColumnNumber > columns.size()) { + columns.setSize(currentColumnNumber); + } + columns.setElementAt(c, currentColumnNumber - 1); + c.setColumnOffset(offset); + c.layout(areaContainer); + offset += c.getColumnWidth(); } - currentColumnNumber = num; - if (num > columns.size()) { - columns.setSize(num); - } - columns.setElementAt(c, num - 1); - c.setColumnOffset(offset); - fo.layout(areaContainer); - offset += c.getColumnWidth(); } } areaContainer.setAllocationWidth(offset); diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java index 5d43155dc..5bde1115e 100644 --- a/src/org/apache/fop/fo/flow/TableColumn.java +++ b/src/org/apache/fop/fo/flow/TableColumn.java @@ -64,6 +64,9 @@ public class TableColumn extends FObj { int columnWidth; int columnOffset; + int numColumnsRepeated; + + boolean setup = false; AreaContainer areaContainer; @@ -91,22 +94,38 @@ public class TableColumn extends FObj { return 0; // not implemented yet } + public int getNumColumnsRepeated() { + return numColumnsRepeated; + } + + public void doSetup(Area area) throws FOPException { + + this.numColumnsRepeated = + this.properties.get("number-columns-repeated").getNumber().intValue(); + + this.backgroundColor = + this.properties.get("background-color").getColorType(); + + this.columnWidth = + this.properties.get("column-width").getLength().mvalue(); + + // initialize id + String id = this.properties.get("id").getString(); + area.getIDReferences().initializeID(id,area); + + setup = true; + } + public Status layout(Area area) throws FOPException { if (this.marker == BREAK_AFTER) { return new Status(Status.OK); } - if (this.marker == START) { - this.backgroundColor = - this.properties.get("background-color").getColorType(); - - this.columnWidth = - this.properties.get("column-width").getLength().mvalue(); - - // initialize id - String id = this.properties.get("id").getString(); - area.getIDReferences().initializeID(id,area); + if (this.marker == START) { + if (!setup) { + doSetup(area); } + } this.areaContainer = new AreaContainer(propMgr.getFontState(area.getFontInfo()),