jeremias 2005/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 Changes Path 1.24 +23 -10 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.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- Row.java 21 Feb 2005 21:52:14 -0000 1.23 +++ Row.java 22 Feb 2005 09:52:03 -0000 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 -0000 1.23 +++ Cell.java 22 Feb 2005 09:52:03 -0000 1.24 @@ -311,9 +311,38 @@ //Can set the borders directly if there's no span CommonBorderPaddingBackground effBorders = ((GridUnit)((List)rows.get(0)).get(0)).effBorders; + //TODO Next line is a temporary hack! + TraitSetter.addCollapsingBorders(curBlockArea, + fobj.getCommonBorderPaddingBackground(), outer); TraitSetter.addCollapsingBorders(curBlockArea, effBorders, outer); } else { + int dy = yoffset; + for (int y = 0; y < rows.size(); y++) { + List gridUnits = (List)rows.get(y); + int dx = xoffset; + int lastRowHeight = 0; + for (int x = 0; x < gridUnits.size(); x++) { + GridUnit gu = (GridUnit)gridUnits.get(x); + //Blocks for painting grid unit borders + Block block = new Block(); + block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); + block.setPositioning(Block.ABSOLUTE); + block.setBPD(gu.row.getRowHeight()); + lastRowHeight = gu.row.getRowHeight(); + int ipd = gu.column.getWidth().getValue(); + int borderStartWidth = gu.effBorders.getBorderStartWidth(false) / 2; + ipd -= borderStartWidth; + ipd -= gu.effBorders.getBorderEndWidth(false) / 2; + block.setIPD(ipd); + block.setXOffset(dx + borderStartWidth); + block.setYOffset(dy); + TraitSetter.addCollapsingBorders(block, gu.effBorders, outer); + parentLM.addChild(block); + dx += gu.column.getWidth().getValue(); + } + dy += lastRowHeight; + } log.warn("TODO Add collapsed border painting for spanned cells"); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]