private TableContentLayoutManager tclm;
private EffRow[] rowGroup;
+ /** Number of columns in the row group. */
+ private int columnCount;
private int totalHeight;
private int activeRowIndex;
/**
* @param columnCount number of columns the row group has
*/
private void setup(int columnCount) {
+ this.columnCount = columnCount;
this.activeRowIndex = 0;
elementLists = new List[columnCount];
startRow = new int[columnCount];
}
private boolean isBreakCondition() {
- for (int i = 0; i < forcedBreaks.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (forcedBreaks[i]) {
return true;
}
private int getMaxRemainingHeight() {
int maxW = 0;
if (!rowBacktrackForLastStep) {
- for (int i = 0; i < widths.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (elementLists[i] == null) {
continue;
}
startRow[column] = activeRowIndex;
keepWithNextSignals[column] = false;
forcedBreaks[column] = false;
- } else {
- log.trace("TableStepper.setupElementList: not empty nor primary grid unit");
}
}
int addedBoxLen = 0;
TableContentPosition lastTCPos = null;
LinkedList returnList = new LinkedList();
- while ((step = getNextStep(laststep)) >= 0) {
+ while ((step = getNextStep()) >= 0) {
int normalRow = activeRowIndex;
if (rowBacktrackForLastStep) {
//Even though we've already switched to the next row, we have to
//Put all involved grid units into a list
List gridUnitParts = new java.util.ArrayList(maxColumnCount);
- for (int i = 0; i < start.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (end[i] >= start[i]) {
PrimaryGridUnit pgu = rowGroup[startRow[i]].getGridUnit(i).getPrimary();
if (start[i] == 0 && end[i] == 0
int p = 0;
boolean allCellsHaveContributed = true;
signalKeepWithNext = false;
- for (int i = 0; i < start.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (start[i] == 0 && end[i] < 0 && elementLists[i] != null) {
allCellsHaveContributed = false;
}
/**
* Finds the smallest increment leading to the next legal break inside the row-group.
*
- * @param lastStep used for log only
* @return the size of the increment, -1 if no next step is available (end of row-group reached)
*/
- private int getNextStep(int lastStep) {
+ private int getNextStep() {
log.trace("Entering getNextStep");
this.lastMaxPenaltyLength = 0;
//Check for forced break conditions
return -1;
}*/
- int[] backupWidths = new int[start.length];
- System.arraycopy(widths, 0, backupWidths, 0, backupWidths.length);
+ int[] backupWidths = new int[columnCount];
+ System.arraycopy(widths, 0, backupWidths, 0, columnCount);
//set starting points
// We assume that the current grid row is finished. If this is not the case this
// boolean will be reset (see below)
boolean currentGridRowFinished = true;
- for (int i = 0; i < start.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
// null element lists probably correspond to empty cells
if (elementLists[i] == null) {
continue;
log.debug("===> new row: " + activeRowIndex);
}
initializeElementLists();
- for (int i = 0; i < backupWidths.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (end[i] < 0) {
backupWidths[i] = 0;
}
//Get next possible sequence for each cell
int seqCount = 0;
- for (int i = 0; i < start.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (elementLists[i] == null) {
continue;
}
//Determine smallest possible step
int minStep = Integer.MAX_VALUE;
StringBuffer sb = new StringBuffer();
- for (int i = 0; i < widths.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
baseWidth[i] = 0;
for (int prevRow = 0; prevRow < startRow[i]; prevRow++) {
baseWidth[i] += rowGroup[prevRow].getHeight().opt;
}
}
if (log.isDebugEnabled()) {
- log.debug("candidate steps: " + sb + " lastStep=" + lastStep);
+ log.debug("candidate steps: " + sb);
}
//Check for constellations that would result in overlapping borders
/*
- for (int i = 0; i < widths.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
}*/
//See http://people.apache.org/~jeremias/fop/NextStepAlgoNotes.pdf
rowBacktrackForLastStep = false;
skippedStep = false;
- for (int i = 0; i < widths.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
int len = baseWidth[i] + widths[i];
if (len > minStep) {
widths[i] = backupWidths[i];
}
if (log.isDebugEnabled()) {
/*StringBuffer*/ sb = new StringBuffer("[col nb: start-end(width)] ");
- for (int i = 0; i < widths.length; i++) {
+ for (int i = 0; i < columnCount; i++) {
if (end[i] >= start[i]) {
sb.append(i + ": " + start[i] + "-" + end[i] + "(" + widths[i] + "), ");
} else {