Browse Source

Renaming GridUnitPart into the more accurate CellPart. Moreover I was always making the confusion between gup and pgu


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@604965 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_95beta
Vincent Hennebert 16 years ago
parent
commit
040987c532

+ 5
- 5
src/java/org/apache/fop/layoutmgr/table/ActiveCell.java View File

@@ -266,12 +266,12 @@ class ActiveCell {
}

/**
* Creates and returns a GridUnitPart instance for the content of this cell which
* Creates and returns a CellPart instance for the content of this cell which
* is included in the next step.
*
* @return a GridUnitPart instance
* @return a CellPart instance
*/
GridUnitPart createGridUnitPart() {
CellPart createCellPart() {
if (end + 1 == elementList.size()) {
if (pgu.getFlag(GridUnit.KEEP_WITH_NEXT_PENDING)) {
keepWithNextSignal = true;
@@ -284,9 +284,9 @@ class ActiveCell {
&& elementList.size() == 1
&& elementList.get(0) instanceof KnuthBoxCellWithBPD) {
//Special case: Cell with fixed BPD
return new GridUnitPart(pgu, 0, pgu.getElements().size() - 1);
return new CellPart(pgu, 0, pgu.getElements().size() - 1);
} else {
return new GridUnitPart(pgu, start, end);
return new CellPart(pgu, start, end);
}
}


src/java/org/apache/fop/layoutmgr/table/GridUnitPart.java → src/java/org/apache/fop/layoutmgr/table/CellPart.java View File

@@ -25,7 +25,7 @@ import org.apache.fop.fo.flow.table.PrimaryGridUnit;
/**
* Represents a non-dividable part of a grid unit. Used by the table stepper.
*/
class GridUnitPart {
class CellPart {

/** Primary grid unit */
protected PrimaryGridUnit pgu;
@@ -35,12 +35,12 @@ class GridUnitPart {
protected int end;

/**
* Creates a new GridUnitPart.
* Creates a new CellPart.
* @param pgu Primary grid unit
* @param start starting element
* @param end ending element
*/
protected GridUnitPart(PrimaryGridUnit pgu, int start, int end) {
protected CellPart(PrimaryGridUnit pgu, int start, int end) {
this.pgu = pgu;
this.start = start;
this.end = end;

+ 11
- 11
src/java/org/apache/fop/layoutmgr/table/RowPainter.java View File

@@ -110,27 +110,27 @@ class RowPainter {
}
rowFO = tcpos.row.getTableRow();
lastRow = tcpos.row;
Iterator partIter = tcpos.gridUnitParts.iterator();
Iterator partIter = tcpos.cellParts.iterator();
//Iterate over all grid units in the current step
while (partIter.hasNext()) {
GridUnitPart gup = (GridUnitPart)partIter.next();
CellPart cellPart = (CellPart)partIter.next();
if (log.isDebugEnabled()) {
log.debug(">" + gup);
log.debug(">" + cellPart);
}
int colIndex = gup.pgu.getStartCol();
if (primaryGridUnits[colIndex] != gup.pgu) {
int colIndex = cellPart.pgu.getStartCol();
if (primaryGridUnits[colIndex] != cellPart.pgu) {
if (primaryGridUnits[colIndex] != null) {
log.warn("Replacing GU in slot " + colIndex
+ ". Some content may not be painted.");
}
primaryGridUnits[colIndex] = gup.pgu;
start[colIndex] = gup.start;
end[colIndex] = gup.end;
primaryGridUnits[colIndex] = cellPart.pgu;
start[colIndex] = cellPart.start;
end[colIndex] = cellPart.end;
} else {
if (gup.end < end[colIndex]) {
if (cellPart.end < end[colIndex]) {
throw new IllegalStateException("Internal Error: stepper problem");
}
end[colIndex] = gup.end;
end[colIndex] = cellPart.end;
}
}
}
@@ -175,7 +175,7 @@ class RowPainter {
if (forcedFlush || ((end[i] == primaryGridUnits[i].getElements().size() - 1)
&& (currentGU == null || currentGU.isLastGridUnitRowSpan()))) {
//the last line in the "if" above is to avoid a premature end of a
//row-spanned cell because no GridUnitParts are generated after a cell is
//row-spanned cell because no CellParts are generated after a cell is
//finished with its content.
//See table-cell_number-rows-spanned_bug38397.xml
addAreasForCell(primaryGridUnits[i], start[i], end[i], lastRow, partBPD[i],

+ 1
- 1
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java View File

@@ -387,7 +387,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
if (pos instanceof TableContentPosition) {
TableContentPosition tcpos = (TableContentPosition)pos;
lst.add(tcpos);
GridUnitPart part = (GridUnitPart)tcpos.gridUnitParts.get(0);
CellPart part = (CellPart)tcpos.cellParts.get(0);
if (body == null) {
body = part.pgu.getBody();
}

+ 6
- 6
src/java/org/apache/fop/layoutmgr/table/TableContentPosition.java View File

@@ -36,8 +36,8 @@ class TableContentPosition extends Position {
/** The position is the last of the row group. */
public static final int LAST_IN_ROWGROUP = 2;

/** the list of GridUnitParts making up this position */
protected List gridUnitParts;
/** the list of CellParts making up this position */
protected List cellParts;
/** effective row this position belongs to */
protected EffRow row;
/** flags for the position */
@@ -46,13 +46,13 @@ class TableContentPosition extends Position {
/**
* Creates a new TableContentPosition.
* @param lm applicable layout manager
* @param gridUnitParts the list of GridUnitPart instances
* @param cellParts the list of CellPart instances
* @param row effective row this position belongs to
*/
protected TableContentPosition(LayoutManager lm, List gridUnitParts,
protected TableContentPosition(LayoutManager lm, List cellParts,
EffRow row) {
super(lm);
this.gridUnitParts = gridUnitParts;
this.cellParts = cellParts;
this.row = row;
}

@@ -90,7 +90,7 @@ class TableContentPosition extends Position {
sb.append(getFlag(FIRST_IN_ROWGROUP) ? "F" : "-");
sb.append(getFlag(LAST_IN_ROWGROUP) ? "L" : "-").append("]");
sb.append("(");
sb.append(gridUnitParts);
sb.append(cellParts);
sb.append(")");
return sb.toString();
}

+ 7
- 6
src/java/org/apache/fop/layoutmgr/table/TableStepper.java View File

@@ -169,26 +169,27 @@ public class TableStepper {
boolean forcedBreak = false;
int breakClass = -1;
//Put all involved grid units into a list
List gridUnitParts = new java.util.ArrayList(maxColumnCount);
List cellParts = new java.util.ArrayList(maxColumnCount);
for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
ActiveCell activeCell = (ActiveCell) iter.next();
if (activeCell.contributesContent()) {
GridUnitPart gup = activeCell.createGridUnitPart();
gridUnitParts.add(gup);
CellPart part = activeCell.createCellPart();
cellParts.add(part);
forcedBreak = activeCell.isLastForcedBreak();
if (forcedBreak) {
breakClass = activeCell.getLastBreakClass();
}
if (returnList.size() == 0 && gup.isFirstPart() && gup.mustKeepWithPrevious()) {
if (returnList.size() == 0 && part.isFirstPart()
&& part.mustKeepWithPrevious()) {
context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
}
}
}
//log.debug(">>> guPARTS: " + gridUnitParts);
//log.debug(">>> guPARTS: " + cellParts);

//Create elements for step
TableContentPosition tcpos = new TableContentPosition(getTableLM(),
gridUnitParts, rowGroup[normalRow]);
cellParts, rowGroup[normalRow]);
if (returnList.size() == 0) {
tcpos.setFlag(TableContentPosition.FIRST_IN_ROWGROUP, true);
}

Loading…
Cancel
Save