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 je...@apache.org on 2005/05/23 15:52:27 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fo/flow Table.java

jeremias    2005/05/23 06:52:26

  Modified:    src/java/org/apache/fop/layoutmgr/table TableStepper.java
                        TableContentLayoutManager.java
               src/java/org/apache/fop/fo/flow Table.java
  Log:
  Initial keep-together support on table.
  
  Revision  Changes    Path
  1.5       +7 -2      xml-fop/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
  
  Index: TableStepper.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/TableStepper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TableStepper.java	23 May 2005 13:02:41 -0000	1.4
  +++ TableStepper.java	23 May 2005 13:52:26 -0000	1.5
  @@ -141,6 +141,7 @@
               }
               if (pgu.isLastGridUnitRowSpan() && pgu.getRow() != null) {
                   makeBoxForWholeRow |= pgu.getRow().mustKeepTogether();
  +                makeBoxForWholeRow |= pgu.getTable().mustKeepTogether();
               }
               if (makeBoxForWholeRow) {
                   List list = new java.util.ArrayList(1);
  @@ -243,7 +244,11 @@
                       penaltyPos.footerElements = tclm.getFooterElements();
                   }
               }
  -            returnList.add(new KnuthPenalty(effPenaltyLen, 0, false, penaltyPos, false));
  +            int p = 0;
  +            if (getTableLM().mustKeepTogether()) {
  +                p = KnuthPenalty.INFINITE;
  +            }
  +            returnList.add(new KnuthPenalty(effPenaltyLen, p, false, penaltyPos, false));
   
               log.debug("step=" + step + " (+" + increase + ")"
                       + " box=" + boxLen 
  
  
  
  1.9       +2 -2      xml-fop/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
  
  Index: TableContentLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TableContentLayoutManager.java	23 May 2005 13:02:41 -0000	1.8
  +++ TableContentLayoutManager.java	23 May 2005 13:52:26 -0000	1.9
  @@ -198,7 +198,7 @@
           if (returnList.size() > 0) {
               //Remove last penalty
               KnuthElement last = (KnuthElement)returnList.getLast();
  -            if (last.isPenalty() && last.getP() == 0) {
  +            if (last.isPenalty()) {
                   returnList.removeLast();
               }
           }
  
  
  
  1.53      +14 -1     xml-fop/src/java/org/apache/fop/fo/flow/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Table.java	13 May 2005 19:16:51 -0000	1.52
  +++ Table.java	23 May 2005 13:52:26 -0000	1.53
  @@ -200,7 +200,8 @@
        */
       protected void endOfNode() throws FOPException {
           if (!tableBodyFound) {
  -           missingChildElementError("(marker*,table-column*,table-header?,table-footer?,table-body+)");
  +           missingChildElementError(
  +                   "(marker*,table-column*,table-header?,table-footer?,table-body+)");
           }
   
           getFOEventHandler().endTable(this);
  @@ -235,6 +236,7 @@
           return this.defaultColumn;
       }
       
  +    /** @return the list of table-column elements. */
       public List getColumns() {
           return columns;
       }
  @@ -247,10 +249,12 @@
           return (TableBody)childNodes.get(index);
       }
   
  +    /** @return the body for the table-header. */
       public TableBody getTableHeader() {
           return tableHeader;
       }
   
  +    /** @return the body for the table-footer. */
       public TableBody getTableFooter() {
           return tableFooter;
       }
  @@ -318,6 +322,15 @@
           return keepTogether;
       }
   
  +    /**
  +     * Convenience method to check if a keep-together constraint is specified.
  +     * @return true if keep-together is active.
  +     */
  +    public boolean mustKeepTogether() {
  +        return !getKeepTogether().getWithinPage().isAuto()
  +                || !getKeepTogether().getWithinColumn().isAuto();
  +    }
  +    
       /** @return the "border-collapse" property. */
       public int getBorderCollapse() {
           return borderCollapse;
  
  
  

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