]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
G. Pretterhofer: added support for 'number-columns-repeated'
authorarved <arved@unknown>
Thu, 10 May 2001 00:53:22 +0000 (00:53 +0000)
committerarved <arved@unknown>
Thu, 10 May 2001 00:53:22 +0000 (00:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194235 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableColumn.java

index 1cc52e316095722f0e733862a4cb4b4b57b1a6da..8468dc0cf3ab3715d7a5115a9835e560782677ac 100644 (file)
@@ -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);
index 5d43155dc0d7bfd50d35e7150d07347a8cea9741..5bde1115ee6f63829c98752d9689626026c36f1c 100644 (file)
@@ -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()),