cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr/table Row.java Cell.java

2005-02-22 Thread jeremias
jeremias2005/02/22 01:52:03

  Modified:src/java/org/apache/fop/layoutmgr/table Row.java Cell.java
  Log:
  Individual grid unit block areas for painting the resolved borders.
  Bugfix in Row for searching the adjacent cell at end edge.
  Setting the borders that are already resolved on the right grid units.
  
  Revision  ChangesPath
  1.24  +23 -10xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java
  
  Index: Row.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Row.java  21 Feb 2005 21:52:14 -  1.23
  +++ Row.java  22 Feb 2005 09:52:03 -  1.24
  @@ -200,12 +200,13 @@
   
   //Border resolution now that the empty grid units are filled
   for (int pos = 1; pos = gridUnits.size(); pos++) {
  -GridUnit gu = (GridUnit)gridUnits.get(pos - 1);
  +GridUnit starting = (GridUnit)gridUnits.get(pos - 1);

   //Border resolution
   if (getTable().isSeparateBorderModel()) {
  -gu.assignBorder(gu.layoutManager);
  +starting.assignBorder(starting.layoutManager);
   } else {
  +//Neighbouring grid unit at start edge 
   GridUnit start = null;
   int find = pos - 1;
   while (find = 1) {
  @@ -216,6 +217,13 @@
   }
   find--;
   }
  +
  +//Ending grid unit for current cell
  +GridUnit ending = null;
  +pos += 
starting.layoutManager.getFObj().getNumberColumnsSpanned() - 1;
  +ending = (GridUnit)gridUnits.get(pos - 1);
  +
  +//Neighbouring grid unit at end edge 
   GridUnit end = null;
   find = pos + 1;
   while (find = gridUnits.size()) {
  @@ -224,15 +232,20 @@
   end = candidate;
   break;
   }
  +find++;
   }
   CommonBorderPaddingBackground borders = new 
CommonBorderPaddingBackground();
  -GridUnit.resolveBorder(getTable(), borders, gu, 
  +GridUnit.resolveBorder(getTable(), borders, starting, 
   (start != null ? start : null), 
   CommonBorderPaddingBackground.START);
  -GridUnit.resolveBorder(getTable(), borders, gu, 
  +starting.effBorders = borders;
  +if (starting != ending) {
  +borders = new CommonBorderPaddingBackground();
  +}
  +GridUnit.resolveBorder(getTable(), borders, ending, 
   (end != null ? end : null), 
   CommonBorderPaddingBackground.END);
  -gu.effBorders = borders;
  +ending.effBorders = borders;
   //Only start and end borders here, before and after during 
layout
   //TODO resolve before and after borders during layout
   }
  @@ -412,21 +425,21 @@
   }
   
   /**
  - * Determines the columns that are spanned by the given cell.
  + * Determines the grid units that are spanned by the given cell.
* @param cellLM table-cell LM
* @param startCell starting cell index (must be = 1)
  - * @param spannedColumns List to receive the applicable columns
  + * @param spannedGridUnits List to receive the applicable grid units
*/
  -private void getGridUnitsForCell(Cell cellLM, int startCell, List 
spannedColumns) {
  +private void getGridUnitsForCell(Cell cellLM, int startCell, List 
spannedGridUnits) {
   int count;
   if (cellLM != null) {
   count = cellLM.getFObj().getNumberColumnsSpanned();
   } else {
   count = 1;
   }
  -spannedColumns.clear();
  +spannedGridUnits.clear();
   for (int i = 0; i  count; i++) {
  -spannedColumns.add(this.gridUnits.get(startCell + i - 1));
  +spannedGridUnits.add(this.gridUnits.get(startCell + i - 1));
   }
   }
   
  
  
  
  1.24  +29 -0 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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Cell.java 21 Feb 2005 21:52:14 -  1.23
  +++ Cell.java 22 Feb 2005 09:52:03 -  1.24
  @@ -311,9 +311,38 @@
   //Can set the borders directly if there's no span
   

cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr/table Row.java Cell.java

2005-02-22 Thread jeremias
jeremias2005/02/22 07:32:45

  Modified:src/java/org/apache/fop/fo/properties
CommonBorderPaddingBackground.java
   src/java/org/apache/fop/layoutmgr/table Row.java Cell.java
  Log:
  Should run my own tests :-(
  Bugfix for NPE on empty cells.
  Skip adding helper areas for border painting when there are no borders to 
paint.
  
  Revision  ChangesPath
  1.13  +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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CommonBorderPaddingBackground.java21 Feb 2005 21:52:14 -  
1.12
  +++ CommonBorderPaddingBackground.java22 Feb 2005 15:32:45 -  
1.13
  @@ -339,6 +339,12 @@
   return ((backgroundColor != null || getFopImage() != null));
   }
   
  +/** @return true if border is non-zero. */
  +public boolean hasBorder() {
  +return ((getBorderBeforeWidth(false) + getBorderAfterWidth(false) 
  ++ getBorderStartWidth(false) + getBorderEndWidth(false))  
0);
  +}
  +
   /** @return true if padding is non-zero. */
   public boolean hasPadding() {
   return ((getPaddingBefore(false) + getPaddingAfter(false) 
  
  
  
  1.25  +3 -1  xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java
  
  Index: Row.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Row.java  22 Feb 2005 09:52:03 -  1.24
  +++ Row.java  22 Feb 2005 15:32:45 -  1.25
  @@ -220,7 +220,9 @@
   
   //Ending grid unit for current cell
   GridUnit ending = null;
  -pos += 
starting.layoutManager.getFObj().getNumberColumnsSpanned() - 1;
  +if (starting.layoutManager != null) {
  +pos += 
starting.layoutManager.getFObj().getNumberColumnsSpanned() - 1;
  +}
   ending = (GridUnit)gridUnits.get(pos - 1);
   
   //Neighbouring grid unit at end edge 
  
  
  
  1.25  +4 -0  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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Cell.java 22 Feb 2005 09:52:03 -  1.24
  +++ Cell.java 22 Feb 2005 15:32:45 -  1.25
  @@ -324,6 +324,10 @@
   int lastRowHeight = 0;
   for (int x = 0; x  gridUnits.size(); x++) {
   GridUnit gu = (GridUnit)gridUnits.get(x);
  +if (!gu.effBorders.hasBorder()) {
  +continue;
  +}
  +
   //Blocks for painting grid unit borders
   Block block = new Block();
   block.addTrait(Trait.IS_REFERENCE_AREA, 
Boolean.TRUE);
  
  
  

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



cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr/table Row.java Cell.java

2005-02-09 Thread jeremias
jeremias2005/02/09 03:51:30

  Modified:src/java/org/apache/fop/layoutmgr/table Row.java Cell.java
  Log:
  Fix for handling of horizontal border-separation. My first interpretation was 
wrong.
  
  Revision  ChangesPath
  1.22  +2 -12 xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java
  
  Index: Row.java
  ===
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/table/Row.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Row.java  8 Feb 2005 16:37:23 -   1.21
  +++ Row.java  9 Feb 2005 11:51:30 -   1.22
  @@ -229,16 +229,10 @@
   //Determine which columns this cell will occupy
   getColumnsForCell(cellLM, startColumn, spannedColumns);
   int childRefIPD = 0;
  -Iterator i = spannedColumns.iterator();
  -while (i.hasNext()) {
  -Column col = (Column)i.next();
  +for (int i = 0; i  spannedColumns.size(); i++) {
  +Column col = (Column)spannedColumns.get(i);
   childRefIPD += col.getWidth().getValue();
   }
  -//Handle border-separation when border-collapse=separate
  -if (getTable().getBorderCollapse() == EN_SEPARATE) {
  -childRefIPD += (spannedColumns.size() - 1) 
  -* 
getTable().getBorderSeparation().getIPD().getLength().getValue();
  -}
   childLC.setRefIPD(childRefIPD);
   
   if (cellLM != null) {
  @@ -280,11 +274,7 @@
   }
   
   //Adjust in-row x offset for individual cells
  -//TODO Probably needs more work to support writing modes
   ipdOffset += childRefIPD;
  -if (getTable().getBorderCollapse() == EN_SEPARATE) {
  -ipdOffset += 
getTable().getBorderSeparation().getIPD().getLength().getValue();
  -}
   
   
   // the min is the maximum min of all cells
  
  
  
  1.19  +24 -1 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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Cell.java 8 Feb 2005 17:41:23 -   1.18
  +++ Cell.java 9 Feb 2005 11:51:30 -   1.19
  @@ -18,6 +18,8 @@

   package org.apache.fop.layoutmgr.table;
   
  +import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.flow.Table;
   import org.apache.fop.fo.flow.TableCell;
   import org.apache.fop.fo.properties.LengthRangeProperty;
   import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
  @@ -74,6 +76,17 @@
   return this.fobj;
   }
   
  +/**
  + * @return the table owning this cell
  + */
  +public Table getTable() {
  +FONode node = fobj.getParent();
  +while (!(node instanceof Table)) {
  +node = node.getParent();
  +}
  +return (Table)node;
  +}
  +
   private int getIPIndents() {
   int iIndents = 0;
   iIndents += 
fobj.getCommonBorderPaddingBackground().getIPPaddingAndBorder(false);
  @@ -102,6 +115,11 @@
   referenceIPD = context.getRefIPD(); 
   cellIPD = referenceIPD;
   cellIPD -= getIPIndents();
  +if (getTable().getBorderCollapse() == EN_SEPARATE) {
  +int borderSep = getTable().getBorderSeparation().getLengthPair()
  +.getIPD().getLength().getValue();
  +cellIPD -= borderSep;
  +}
   
   while ((curLM = getChildLM()) != null) {
   if (curLM.generatesInlineAreas()) {
  @@ -294,7 +312,12 @@
   indent += 
fobj.getCommonBorderPaddingBackground().getBorderStartWidth(false);
   indent += 
fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
   // set position
  -curBlockArea.setXOffset(xoffset + inRowIPDOffset + indent);
  +int halfBorderSep = 0;
  +if (getTable().getBorderCollapse() == EN_SEPARATE) {
  +halfBorderSep = 
getTable().getBorderSeparation().getLengthPair()
  +.getIPD().getLength().getValue() / 2;
  +}
  +curBlockArea.setXOffset(xoffset + inRowIPDOffset + halfBorderSep 
+ indent);
   curBlockArea.setYOffset(yoffset);
   curBlockArea.setIPD(cellIPD);
   //curBlockArea.setHeight();
  
  
  

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