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 ke...@locus.apache.org on 2000/12/19 04:57:33 UTC

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

keiron      00/12/18 19:57:31

  Modified:    src/org/apache/fop/fo/flow TableBody.java TableRow.java
  Log:
  removes space after if a row needs to be removed
  fixed a bug where the extra space after was left behind for rows
  going over a page
  
  Revision  Changes    Path
  1.18      +10 -4     xml-fop/src/org/apache/fop/fo/flow/TableBody.java
  
  Index: TableBody.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableBody.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TableBody.java	2000/12/14 06:38:31	1.17
  +++ TableBody.java	2000/12/19 03:57:28	1.18
  @@ -1,4 +1,4 @@
  -/*-- $Id: TableBody.java,v 1.17 2000/12/14 06:38:31 keiron Exp $ --
  +/*-- $Id: TableBody.java,v 1.18 2000/12/19 03:57:28 keiron Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -189,7 +189,7 @@
               row.setColumns(columns);
               row.doSetup(areaContainer);
               if (row.getKeepWithPrevious() != 0 && lastRow != null &&
  -                    keepWith.indexOf(lastRow) != -1) {
  +                    keepWith.indexOf(lastRow) == -1) {
                   keepWith.addElement(lastRow);
               }
   
  @@ -275,12 +275,18 @@
           return new Status(Status.OK);
       }
   
  -    public int getAreaHeight() {
  +/*    public int getAreaHeight() {
           return areaContainer.getHeight();
  -    }
  +    }*/
   
       public void removeLayout(Area area) {
           area.removeChild(areaContainer);
  +        if (spaceBefore != 0) {
  +            area.increaseHeight(-spaceBefore);
  +        }
  +        if (spaceAfter != 0) {
  +            area.increaseHeight(-spaceAfter);
  +        }
           this.resetMarker();
       }
   }
  
  
  
  1.29      +33 -21    xml-fop/src/org/apache/fop/fo/flow/TableRow.java
  
  Index: TableRow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableRow.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- TableRow.java	2000/12/18 23:24:31	1.28
  +++ TableRow.java	2000/12/19 03:57:28	1.29
  @@ -1,4 +1,4 @@
  -/*-- $Id: TableRow.java,v 1.28 2000/12/18 23:24:31 kellyc Exp $ --
  +/*-- $Id: TableRow.java,v 1.29 2000/12/19 03:57:28 keiron Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -111,6 +111,7 @@
   
       // added by Dresdner Bank, Germany
       DisplaySpace spacer = null;
  +    boolean hasAddedSpacer = false;
       DisplaySpace spacerAfter = null;
   
       /**
  @@ -359,7 +360,6 @@
               this.marker = 0;
           }
   
  -
           if ((spaceBefore != 0) && (this.marker == 0)) {
               spacer = new DisplaySpace(spaceBefore);
               area.increaseHeight(spaceBefore);
  @@ -482,8 +482,9 @@
                       }
                   } else {
                       // added on 11/28/2000, by Dresdner Bank, Germany
  -                    if (spacer != null)
  +                    if (hasAddedSpacer && spacer != null)
                           area.removeChild(spacer);
  +                    hasAddedSpacer = false;
                       if(spacerAfter != null)
                           area.removeChild(spacerAfter);
   
  @@ -517,9 +518,9 @@
           }
   
           // added by Dresdner Bank, Germany
  -        if (spacer != null) {
  +        if (!hasAddedSpacer && spacer != null) {
               area.addChild(spacer);
  -            spacer = null;
  +            hasAddedSpacer = true;
           }
   
           area.addChild(areaContainer);
  @@ -533,16 +534,6 @@
           // bug fix from Eric Schaeffer
           //area.increaseHeight(largestCellHeight);
   
  -        if (spaceAfter != 0) {
  -            spacerAfter = new DisplaySpace(spaceAfter);
  -            area.increaseHeight(spaceAfter);
  -            area.addChild(spacerAfter);
  -        }
  -
  -        if (area instanceof BlockArea) {
  -            area.start();
  -        }
  -
           // test to see if some cells are not
           // completely laid out.
           // Hani Elabed 11/22/2000
  @@ -555,6 +546,16 @@
               }
           }
   
  +        if (!someCellDidNotLayoutCompletely && spaceAfter != 0) {
  +            spacerAfter = new DisplaySpace(spaceAfter);
  +            area.increaseHeight(spaceAfter);
  +            area.addChild(spacerAfter);
  +        }
  +
  +        if (area instanceof BlockArea) {
  +            area.start();
  +        }
  +
           // replaced by Hani Elabed 11/27/2000
           //return new Status(Status.OK);
   
  @@ -574,17 +575,28 @@
       }
   
       public void removeLayout(Area area) {
  -        if (spacer != null)
  -            area.removeChild(spacer);
  +        if (spacer != null) {
  +            if(hasAddedSpacer) {
  +                area.removeChild(spacer);
  +            } else {
  +                area.increaseHeight(-spaceBefore);
  +            }
  +        }
  +        hasAddedSpacer = false;
           if(spacerAfter != null)
               area.removeChild(spacerAfter);
  -        // removing something that was added by succession
  -        // of cell.layout()
  -        // just to keep my sanity here, Hani
  -        //    	        area.increaseHeight(areaContainer.getHeight());
  +        //area.increaseHeight(areaContainer.getHeight());
           area.removeChild(areaContainer);
           this.resetMarker();
           cells = null;
           this.removeID(area.getIDReferences());
  +    }
  +
  +    public void resetMarker()
  +    {
  +        super.resetMarker();
  +        spacer = null;
  +        spacerAfter = null;
  +        hasAddedSpacer = false;
       }
   }