jeremias    2005/02/15 11:30:51

  Modified:    src/java/org/apache/fop/layoutmgr/table
                        TableLayoutManager.java Cell.java
               src/java/org/apache/fop/fo/properties
                        CommonBorderPaddingBackground.java
               src/java/org/apache/fop/fo/flow TableRow.java TableCell.java
                        Table.java
  Log:
  Set border traits for fo:table only if border-collapse="separate".
  Some clean-up.
  
  Revision  Changes    Path
  1.19      +3 -1      
xml-fop/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
  
  Index: TableLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TableLayoutManager.java   11 Feb 2005 10:45:24 -0000      1.18
  +++ TableLayoutManager.java   15 Feb 2005 19:30:51 -0000      1.19
  @@ -387,7 +387,9 @@
   
           curBlockArea.setBPD(tableHeight);
   
  -        TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +        if (fobj.isSeparateBorderModel()) {
  +            TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
  +        }
           TraitSetter.addBackground(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
           TraitSetter.addMargins(curBlockArea,
                   fobj.getCommonBorderPaddingBackground(), 
  
  
  
  1.21      +6 -6      xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java
  
  Index: Cell.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Cell.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Cell.java 11 Feb 2005 12:19:05 -0000      1.20
  +++ Cell.java 15 Feb 2005 19:30:51 -0000      1.21
  @@ -115,8 +115,8 @@
           referenceIPD = context.getRefIPD(); 
           cellIPD = referenceIPD;
           cellIPD -= getIPIndents();
  -        if (getTable().getBorderCollapse() == EN_SEPARATE) {
  -            int borderSep = getTable().getBorderSeparation().getLengthPair()
  +        if (fobj.isSeparateBorderModel()) {
  +            int borderSep = fobj.getBorderSeparation().getLengthPair()
                       .getIPD().getLength().getValue();
               cellIPD -= borderSep;
           }
  @@ -252,8 +252,8 @@
               addID(fobj.getId());
           }
   
  -        if (!emptyCell || (getTable().getBorderCollapse() == EN_SEPARATE 
  -                && fobj.showEmptyCells())) {
  +        if (!emptyCell 
  +                || (fobj.isSeparateBorderModel() && fobj.showEmptyCells())) {
               TraitSetter.addBorders(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
               TraitSetter.addBackground(curBlockArea, 
fobj.getCommonBorderPaddingBackground());
           }
  @@ -320,8 +320,8 @@
               indent += 
fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
               // set position
               int halfBorderSep = 0;
  -            if (getTable().getBorderCollapse() == EN_SEPARATE) {
  -                halfBorderSep = 
getTable().getBorderSeparation().getLengthPair()
  +            if (fobj.isSeparateBorderModel()) {
  +                halfBorderSep = fobj.getBorderSeparation().getLengthPair()
                           .getIPD().getLength().getValue() / 2;
               }
               curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep 
+ indent);
  
  
  
  1.10      +7 -1      
xml-fop/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java
  
  Index: CommonBorderPaddingBackground.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/CommonBorderPaddingBackground.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CommonBorderPaddingBackground.java        7 Feb 2005 10:53:26 -0000       
1.9
  +++ CommonBorderPaddingBackground.java        15 Feb 2005 19:30:51 -0000      
1.10
  @@ -279,4 +279,10 @@
       public boolean hasBackground() {
           return ((backgroundColor != null || getFopImage() != null));
       }
  +
  +    /** @return true if padding is non-zero. */
  +    public boolean hasPadding() {
  +        return ((getPaddingBefore(false) + getPaddingAfter(false) 
  +                + getPaddingStart(false) + getPaddingEnd(false)) > 0);
  +    }
   }
  
  
  
  1.46      +0 -1      xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java
  
  Index: TableRow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableRow.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- TableRow.java     8 Feb 2005 09:20:41 -0000       1.45
  +++ TableRow.java     15 Feb 2005 19:30:51 -0000      1.46
  @@ -25,7 +25,6 @@
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.FObj;
   import org.apache.fop.fo.PropertyList;
  -import org.apache.fop.fo.StaticPropertyList;
   import org.apache.fop.fo.ValidationException;
   import org.apache.fop.fo.properties.CommonAccessibility;
   import org.apache.fop.fo.properties.CommonAural;
  
  
  
  1.47      +17 -2     xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java
  
  Index: TableCell.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/TableCell.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- TableCell.java    11 Feb 2005 12:19:04 -0000      1.46
  +++ TableCell.java    15 Feb 2005 19:30:51 -0000      1.47
  @@ -49,8 +49,8 @@
       // private ToBeImplementedProperty borderEndPrecedence;
       // private ToBeImplementedProperty borderStartPrecedence;
       private LengthRangeProperty blockProgressionDimension;
  -    private int borderCollapse;
  -    private LengthPairProperty borderSeparation;
  +    private int borderCollapse; //inherited from fo:table
  +    private LengthPairProperty borderSeparation; //inherited from fo:table
       private Numeric columnNumber;
       private int displayAlign;
       private int relativeAlign;
  @@ -303,6 +303,21 @@
           return (this.emptyCells == EN_SHOW);
       }
       
  +    /** @return the "border-collapse" property (inherited from fo:table). */
  +    public int getBorderCollapse() {
  +        return borderCollapse;
  +    }
  +
  +    /** @return true if the separate border model is active */
  +    public boolean isSeparateBorderModel() {
  +        return (getBorderCollapse() == EN_SEPARATE);
  +    }
  +    
  +    /** @return the "border-separation" property (inherited from fo:table). 
*/
  +    public LengthPairProperty getBorderSeparation() {
  +        return borderSeparation;
  +    }
  +
       /**
        * @return the "id" property.
        */
  
  
  
  1.49      +10 -0     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.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Table.java        11 Feb 2005 10:45:24 -0000      1.48
  +++ Table.java        15 Feb 2005 19:30:51 -0000      1.49
  @@ -122,6 +122,11 @@
           PropertyList colPList = new StaticPropertyList(defaultColumn, pList);
           colPList.setWritingMode();
           defaultColumn.bind(colPList);
  +        
  +        if (borderCollapse != EN_SEPARATE && 
commonBorderPaddingBackground.hasPadding()) {
  +            //See "17.6.2 The collapsing border model" in CSS2
  +            getLogger().error("Table may not have padding when using the 
collapsing border model.");
  +        }
       }
   
       /**
  @@ -237,6 +242,11 @@
           return borderCollapse;
       }
   
  +    /** @return true if the separate border model is active */
  +    public boolean isSeparateBorderModel() {
  +        return (getBorderCollapse() == EN_SEPARATE);
  +    }
  +    
       /** @return the "border-separation" property. */
       public LengthPairProperty getBorderSeparation() {
           return borderSeparation;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to