One for Jeremias, I guess... Just browsing through a global diff I made, trying to iron out some minor differences between the repository and my local sandbox.

In TableContentLayoutManager, there's a small remark about the possibility of re-using the TableStepper. Upon reading that, I tried this very simple:

Index: src/java/org/apache/fop/layoutmgr/table/ TableContentLayoutManager.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/table/ TableContentLayoutManager.java +++ src/java/org/apache/fop/layoutmgr/table/ TableContentLayoutManager.java
@@ -77,6 +77,8 @@
     private int startXOffset;
     private int usedBPD;

+    private TableStepper stepper = new TableStepper(this);
+
     /**
      * Main constructor
      * @param parent Parent layout manager
@@ -573,9 +575,7 @@
log.debug(" height=" + rowHeights[i] + " explicit=" + explicitRowHeights[i]);
             }
         }
- //TODO It may make sense to reuse the stepper since it allocates quite some space
-        TableStepper stepper = new TableStepper(this);
- LinkedList returnedList = stepper.getCombinedKnuthElementsForRowGroup( + LinkedList returnedList = this.stepper.getCombinedKnuthElementsForRowGroup(
                 context, rowGroup, maxColumnCount, bodyType);
         if (returnedList != null) {
             returnList.addAll(returnedList);
Index: src/java/org/apache/fop/layoutmgr/table/TableStepper.java
===================================================================
--- src/java/org/apache/fop/layoutmgr/table/TableStepper.java   
+++ src/java/org/apache/fop/layoutmgr/table/TableStepper.java   
@@ -72,10 +72,10 @@
      */
     public TableStepper(TableContentLayoutManager tclm) {
         this.tclm = tclm;
-        this.activeRow = 0;
     }

     private void setup(int columnCount) {
+        this.activeRow = 0;
         elementLists = new List[columnCount];
         startRow = new int[columnCount];
         start = new int[columnCount];


Seems to work (read: doesn't break any tests), but since the code is originally yours, I just thought I'd check if that was actually what you had in mind when writing that TODO (I assume you put it there?)

If OK, I'll commit this, so it's out of the way. If not, I'll undo this damage locally :) Or expand upon these first steps if they go in the right direction but it would take more than the above...


Cheers,

Andreas

Reply via email to