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 vh...@apache.org on 2007/02/08 17:55:12 UTC

svn commit: r504958 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table: TableContentLayoutManager.java TableLayoutManager.java TableRowIterator.java TableStepper.java

Author: vhennebert
Date: Thu Feb  8 08:55:11 2007
New Revision: 504958

URL: http://svn.apache.org/viewvc?view=rev&rev=504958
Log:
Javadoc for the table layout code

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?view=diff&rev=504958&r1=504957&r2=504958
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Thu Feb  8 08:55:11 2007
@@ -217,7 +217,7 @@
                         KnuthPenalty pen = (KnuthPenalty)last;
                         pen.setP(-KnuthPenalty.INFINITE);
                         pen.setBreakClass(rowFO.getBreakBefore());
-                    } else if (last instanceof BreakElement) {
+                    } else {//if (last instanceof BreakElement) { // TODO vh: seems the only possibility
                         BreakElement breakPoss = (BreakElement) last;
                         breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
                         breakPoss.setBreakClass(rowFO.getBreakBefore());
@@ -432,10 +432,11 @@
             
             pgus.clear();
             TableRow tableRow = null;
-            int minContentHeight = 0;
+            int minContentHeight = 0;  // Minimum content height for the row
             int maxCellHeight = 0;
             int effRowContentHeight = 0;
             for (int j = 0; j < row.getGridUnits().size(); j++) {
+//                assert maxColumnCount == 0 || maxColumnCount == row.getGridUnits().size(); // TODO vh
                 maxColumnCount = Math.max(maxColumnCount, row.getGridUnits().size());
                 GridUnit gu = row.getGridUnit(j);
                 if ((gu.isPrimary() || (gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan())) 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?view=diff&rev=504958&r1=504957&r2=504958
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Thu Feb  8 08:55:11 2007
@@ -144,7 +144,14 @@
         return halfBorderSeparationIPD;
     }
     
-    /** @see org.apache.fop.layoutmgr.LayoutManager */
+    /**
+     * Handles the Knuth elements at the table level: mainly breaks, spaces and borders
+     * before and after the table. The Knuth elements for the table cells are handled by
+     * TableContentLayoutManager.
+     *
+     * @see org.apache.fop.layoutmgr.LayoutManager
+     * @see TableContentLayoutManager#getNextKnuthElements(LayoutContext, int)
+     */
     public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
         
         LinkedList returnList = new LinkedList();
@@ -159,8 +166,10 @@
             }
         }
 
+        /*
+         * Compute the IPD and adjust it if necessary (overconstrained)
+         */
         referenceIPD = context.getRefIPD();
-
         if (getTable().getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
             int contentIPD = getTable().getInlineProgressionDimension().getOptimum(this)
                     .getLength().getValue(this);
@@ -173,7 +182,6 @@
             }
             updateContentAreaIPDwithOverconstrainedAdjust();
         }
-
         int sumOfColumns = columns.getSumOfColumnWidths(this);
         if (!autoLayout && sumOfColumns > getContentAreaIPD()) {
             log.debug(FONode.decorateWithContextInfo(
@@ -181,7 +189,6 @@
                     getTable()));
             updateContentAreaIPDwithOverconstrainedAdjust(sumOfColumns);
         }
-
         int availableIPD = referenceIPD - getIPIndents();
         if (getContentAreaIPD() > availableIPD) {
             log.warn(FONode.decorateWithContextInfo(
@@ -210,6 +217,7 @@
         //Spaces, border and padding to be repeated at each break
         addPendingMarks(context);
 
+        // Elements for the table-header/footer/body
         LinkedList contentKnuthElements = null;
         LinkedList contentList = new LinkedList();
         //Position returnPosition = new NonLeafPosition(this, null);
@@ -537,4 +545,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java?view=diff&rev=504958&r1=504957&r2=504958
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableRowIterator.java Thu Feb  8 08:55:11 2007
@@ -77,7 +77,7 @@
 
     //TODO rows should later be a Jakarta Commons LinkedList so concurrent modifications while
     //using a ListIterator are possible
-    /** List of cached rows. This a list of EffRow elements. */
+    /** List of cached rows. This is a list of EffRow elements. */
     private List fetchedRows = new java.util.ArrayList();
 
     /**

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?view=diff&rev=504958&r1=504957&r2=504958
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Thu Feb  8 08:55:11 2007
@@ -51,10 +51,25 @@
     private EffRow[] rowGroup;
     private int totalHeight;
     private int activeRow;
+    /**
+     * Knuth elements for active cells, per column. Active cells are cells spanning over
+     * the currently active row.
+     */
     private List[] elementLists;
     private int[] startRow;
+    /**
+     * For each column, index, in the cell's list of Knuth elements, of the element
+     * starting the current row.
+     */
     private int[] start;
+    /**
+     * For each column, index, in the cell's list of Knuth elements, of the element
+     * ending the current row.
+     */
     private int[] end;
+    /**
+     * For each column, widths of the Knuth elements which will be on the current row. 
+     */
     private int[] widths;
     private int[] baseWidth;
     private int[] borderBefore;
@@ -105,10 +120,22 @@
         return false;
     }
     
+    /**
+     * Returns the row currently being processed.
+     *
+     * @return the row currently being processed
+     */
     private EffRow getActiveRow() {
         return rowGroup[activeRow];
     }
     
+    /**
+     * Returns the grid unit at the given column number on the active row.
+     *
+     * @param column column number of the grid unit to get
+     * @return the corresponding grid unit (may be null)
+     * @see TableStepper#getActiveRow
+     */
     private GridUnit getActiveGridUnit(int column) {
         return getActiveRow().safelyGetGridUnit(column);
     }
@@ -200,7 +227,7 @@
                 if (height == 0) {
                     height = row.getHeight().opt;
                 }
-                list.add(new KnuthBoxCellWithBPD(height, pgu));
+                list.add(new KnuthBoxCellWithBPD(height));
                 elementLists[column] = list;
             } else {
                 //Copy elements (LinkedList) to array lists to improve 
@@ -234,7 +261,7 @@
      * @param context Active LayoutContext
      * @param rowGroup the row group
      * @param maxColumnCount the maximum number of columns to expect
-     * @param bodyType Indicates what type of body is processed (boder, header or footer)
+     * @param bodyType Indicates what type of body is processed (body, header or footer)
      * @return the combined element list
      */
     public LinkedList getCombinedKnuthElementsForRowGroup(
@@ -599,13 +626,13 @@
         return this.tclm.getTableLM();
     }
 
+    /**
+     * Marker class denoting table cells fitting in just one box (no legal break inside).
+     */
     private class KnuthBoxCellWithBPD extends KnuthBox {
         
-        private PrimaryGridUnit pgu;
-        
-        public KnuthBoxCellWithBPD(int w, PrimaryGridUnit pgu) {
+        public KnuthBoxCellWithBPD(int w) {
             super(w, null, true);
-            this.pgu = pgu;
         }
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org