}
/**
- * 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;
&& 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);
}
}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr.table;
+
+import org.apache.fop.fo.flow.table.GridUnit;
+import org.apache.fop.fo.flow.table.PrimaryGridUnit;
+
+/**
+ * Represents a non-dividable part of a grid unit. Used by the table stepper.
+ */
+class CellPart {
+
+ /** Primary grid unit */
+ protected PrimaryGridUnit pgu;
+ /** Index of the starting element of this part */
+ protected int start;
+ /** Index of the ending element of this part */
+ protected int end;
+
+ /**
+ * Creates a new CellPart.
+ * @param pgu Primary grid unit
+ * @param start starting element
+ * @param end ending element
+ */
+ protected CellPart(PrimaryGridUnit pgu, int start, int end) {
+ this.pgu = pgu;
+ this.start = start;
+ this.end = end;
+ }
+
+ /** @return true if this part is the first part of a cell */
+ public boolean isFirstPart() {
+ return (start == 0);
+ }
+
+ /** @return true if this part is the last part of a cell */
+ public boolean isLastPart() {
+ return (end >= 0 && end == pgu.getElements().size() - 1);
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ StringBuffer sb = new StringBuffer("Part: ");
+ sb.append(start).append("-").append(end);
+ sb.append(" [").append(isFirstPart() ? "F" : "-").append(isLastPart() ? "L" : "-");
+ sb.append("] ").append(pgu);
+ return sb.toString();
+ }
+
+ boolean mustKeepWithPrevious() {
+ return pgu.getFlag(GridUnit.KEEP_WITH_PREVIOUS_PENDING)
+ || (pgu.getRow() != null && pgu.getRow().mustKeepWithPrevious());
+ }
+
+}
+++ /dev/null
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.layoutmgr.table;
-
-import org.apache.fop.fo.flow.table.GridUnit;
-import org.apache.fop.fo.flow.table.PrimaryGridUnit;
-
-/**
- * Represents a non-dividable part of a grid unit. Used by the table stepper.
- */
-class GridUnitPart {
-
- /** Primary grid unit */
- protected PrimaryGridUnit pgu;
- /** Index of the starting element of this part */
- protected int start;
- /** Index of the ending element of this part */
- protected int end;
-
- /**
- * Creates a new GridUnitPart.
- * @param pgu Primary grid unit
- * @param start starting element
- * @param end ending element
- */
- protected GridUnitPart(PrimaryGridUnit pgu, int start, int end) {
- this.pgu = pgu;
- this.start = start;
- this.end = end;
- }
-
- /** @return true if this part is the first part of a cell */
- public boolean isFirstPart() {
- return (start == 0);
- }
-
- /** @return true if this part is the last part of a cell */
- public boolean isLastPart() {
- return (end >= 0 && end == pgu.getElements().size() - 1);
- }
-
- /** {@inheritDoc} */
- public String toString() {
- StringBuffer sb = new StringBuffer("Part: ");
- sb.append(start).append("-").append(end);
- sb.append(" [").append(isFirstPart() ? "F" : "-").append(isLastPart() ? "L" : "-");
- sb.append("] ").append(pgu);
- return sb.toString();
- }
-
- boolean mustKeepWithPrevious() {
- return pgu.getFlag(GridUnit.KEEP_WITH_PREVIOUS_PENDING)
- || (pgu.getRow() != null && pgu.getRow().mustKeepWithPrevious());
- }
-
-}
}
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;
}
}
}
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],
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();
}
/** 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 */
/**
* 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;
}
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();
}
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);
}