Examples of GridUnit


Examples of org.apache.fop.fo.flow.table.GridUnit

     * @param rowIndex the index of the row from which cells must be activated
     */
    private void activateCells(List activeCellList, int rowIndex) {
        EffRow row = rowGroup[rowIndex];
        for (int i = 0; i < columnCount; i++) {
            GridUnit gu = row.getGridUnit(i);
            if (!gu.isEmpty() && gu.isPrimary()) {
                activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex,
                        previousRowsLength, getTableLM()));
            }
        }
    }
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

        recordRowOffset(currentRow.getIndex(), currentRowOffset);

        // Need to compute the actual row height first
        int actualRowHeight = 0;
        for (int i = 0; i < colCount; i++) {
            GridUnit currentGU = currentRow.getGridUnit(i);           
            if (!currentGU.isEmpty() && currentGU.getColSpanIndex() == 0
                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
                    && firstCellParts[i] != null) {
                // TODO
                // The last test above is a workaround for the stepping algorithm's
                // fundamental flaw making it unable to produce the right element list for
                // multiple breaks inside a same row group.
                // (see http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnownProblems)
                // In some extremely rare cases (forced breaks, very small page height), a
                // TableContentPosition produced during row delaying may end up alone on a
                // page. It will not contain the CellPart instances for the cells starting
                // the next row, so firstCellParts[i] will still be null for those ones.
                int cellHeight = cellHeights[i];
                cellHeight += lastCellParts[i].getConditionalAfterContentLength();
                cellHeight += lastCellParts[i].getBorderPaddingAfter(lastInPart);
                int cellOffset = getRowOffset(Math.max(firstCellParts[i].pgu.getRowIndex(),
                        firstRowIndex));
                actualRowHeight = Math.max(actualRowHeight, cellOffset + cellHeight
                        - currentRowOffset);
            }
        }

        // Then add areas for cells finishing on the current row
        for (int i = 0; i < colCount; i++) {
            GridUnit currentGU = currentRow.getGridUnit(i);
            if (currentGU.isEmpty()) {
                // TODO remove once missing cells are properly implemented (i.e., replaced
                // by an fo:table-cell element containing an empty fo:block)
                firstCellOnPage[i] = false;
            } else if (currentGU.getColSpanIndex() == 0
                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
                    && firstCellParts[i] != null) {
                assert firstCellParts[i].pgu == currentGU.getPrimary();
                int borderBeforeWhich;
                if (firstCellParts[i].start == 0) {
                    if (firstCellOnPage[i]) {
                        borderBeforeWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
                        borderBeforeWhich = ConditionalBorder.NORMAL;
                    }
                } else {
                    assert firstCellOnPage[i];
                    borderBeforeWhich = ConditionalBorder.REST;
                }
                int borderAfterWhich;
                if (lastCellParts[i].isLastPart()) {
                    if (lastInPart) {
                        borderAfterWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
                        borderAfterWhich = ConditionalBorder.NORMAL;
                    }
                } else {
                    borderAfterWhich = ConditionalBorder.REST;
                }
                addAreasForCell(firstCellParts[i].pgu,
                        firstCellParts[i].start, lastCellParts[i].end,
                        actualRowHeight, borderBeforeWhich, borderAfterWhich,
                        lastOnPage);
                firstCellParts[i] = null;
                Arrays.fill(firstCellOnPage, i, i + currentGU.getCell().getNumberColumnsSpanned(),
                        false);
            }
        }
        currentRowOffset += actualRowHeight;
        if (lastInPart) {
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

                adjustYOffset(curBlockArea, borderBeforeWidth);
                Block[][] blocks = new Block[getTableCell().getNumberRowsSpanned()][getTableCell()
                        .getNumberColumnsSpanned()];
                GridUnit[] gridUnits = (GridUnit[]) primaryGridUnit.getRows().get(startRow);
                for (int x = 0; x < getTableCell().getNumberColumnsSpanned(); x++) {
                    GridUnit gu = gridUnits[x];
                    BorderInfo border = gu.getBorderBefore(borderBeforeWhich);
                    int borderWidth = border.getRetainedWidth() / 2;
                    if (borderWidth > 0) {
                        addBorder(blocks, startRow, x, Trait.BORDER_BEFORE, border, firstOnPage);
                        adjustYOffset(blocks[startRow][x], -borderWidth);
                        adjustBPD(blocks[startRow][x], -borderWidth);
                    }
                }
                gridUnits = (GridUnit[]) primaryGridUnit.getRows().get(endRow);
                for (int x = 0; x < getTableCell().getNumberColumnsSpanned(); x++) {
                    GridUnit gu = gridUnits[x];
                    BorderInfo border = gu.getBorderAfter(borderAfterWhich);
                    int borderWidth = border.getRetainedWidth() / 2;
                    if (borderWidth > 0) {
                        addBorder(blocks, endRow, x, Trait.BORDER_AFTER, border, lastOnPage);
                        adjustBPD(blocks[endRow][x], -borderWidth);
                    }
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

     * @param rowIndex the index of the row from which cells must be activated
     */
    private void activateCells(List activeCellList, int rowIndex) {
        EffRow row = rowGroup[rowIndex];
        for (int i = 0; i < columnCount; i++) {
            GridUnit gu = row.getGridUnit(i);
            if (!gu.isEmpty() && gu.isPrimary()) {
                activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex,
                        previousRowsLength, getTableLM()));
            }
        }
    }
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

        recordRowOffset(currentRow.getIndex(), currentRowOffset);

        // Need to compute the actual row height first
        int actualRowHeight = 0;
        for (int i = 0; i < colCount; i++) {
            GridUnit currentGU = currentRow.getGridUnit(i);           
            if (!currentGU.isEmpty() && currentGU.getColSpanIndex() == 0
                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
                    && firstCellParts[i] != null) {
                // TODO
                // The last test above is a workaround for the stepping algorithm's
                // fundamental flaw making it unable to produce the right element list for
                // multiple breaks inside a same row group.
                // (see http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnownProblems)
                // In some extremely rare cases (forced breaks, very small page height), a
                // TableContentPosition produced during row delaying may end up alone on a
                // page. It will not contain the CellPart instances for the cells starting
                // the next row, so firstCellParts[i] will still be null for those ones.
                int cellHeight = cellHeights[i];
                cellHeight += lastCellParts[i].getConditionalAfterContentLength();
                cellHeight += lastCellParts[i].getBorderPaddingAfter(lastInPart);
                int cellOffset = getRowOffset(Math.max(firstCellParts[i].pgu.getRowIndex(),
                        firstRowIndex));
                actualRowHeight = Math.max(actualRowHeight, cellOffset + cellHeight
                        - currentRowOffset);
            }
        }

        // Then add areas for cells finishing on the current row
        for (int i = 0; i < colCount; i++) {
            GridUnit currentGU = currentRow.getGridUnit(i);           
            if (!currentGU.isEmpty() && currentGU.getColSpanIndex() == 0
                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
                    && firstCellParts[i] != null) {
                assert firstCellParts[i].pgu == currentGU.getPrimary();
                int borderBeforeWhich;
                if (firstCellParts[i].start == 0) {
                    if (firstCellOnPage[i]) {
                        borderBeforeWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

        log.debug("Handling row group with " + rowGroup.length + " rows...");
        EffRow row;
        for (int rgi = 0; rgi < rowGroup.length; rgi++) {
            row = rowGroup[rgi];
            for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) {
                GridUnit gu = (GridUnit) iter.next();
                if (gu.isPrimary()) {
                    PrimaryGridUnit primary = gu.getPrimary();
                    // TODO a new LM must be created for every new static-content
                    primary.createCellLM();
                    primary.getCellLM().setParent(tableLM);
                    //Calculate width of cell
                    int spanWidth = 0;
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

                LengthRangeProperty rowBPD = tableRowFO.getBlockProgressionDimension();
                rowHeights[rgi] = MinOptMaxUtil.toMinOptMax(rowBPD, tableLM);
                explicitRowHeight = MinOptMaxUtil.toMinOptMax(rowBPD, tableLM);
            }
            for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) {
                GridUnit gu = (GridUnit) iter.next();
                if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
                    PrimaryGridUnit primary = gu.getPrimary();
                    int effectiveCellBPD = 0;
                    LengthRangeProperty cellBPD = primary.getCell().getBlockProgressionDimension();
                    if (!cellBPD.getMinimum(tableLM).isAuto()) {
                        effectiveCellBPD = cellBPD.getMinimum(tableLM).getLength()
                                .getValue(tableLM);
                    }
                    if (!cellBPD.getOptimum(tableLM).isAuto()) {
                        effectiveCellBPD = cellBPD.getOptimum(tableLM).getLength()
                                .getValue(tableLM);
                    }
                    if (gu.getRowSpanIndex() == 0) {
                        effectiveCellBPD = Math.max(effectiveCellBPD, explicitRowHeight.opt);
                    }
                    effectiveCellBPD = Math.max(effectiveCellBPD, primary.getContentLength());
                    int borderWidths = primary.getBeforeAfterBorderWidth();
                    int padding = 0;
                    CommonBorderPaddingBackground cbpb = primary.getCell()
                            .getCommonBorderPaddingBackground();
                    padding += cbpb.getPaddingBefore(false, primary.getCellLM());
                    padding += cbpb.getPaddingAfter(false, primary.getCellLM());
                    int effRowHeight = effectiveCellBPD + padding + borderWidths;
                    for (int prev = rgi - 1; prev >= rgi - gu.getRowSpanIndex(); prev--) {
                        effRowHeight -= rowHeights[prev].opt;
                    }
                    if (effRowHeight > rowHeights[rgi].min) {
                        // This is the new height of the (grid) row
                        MinOptMaxUtil.extendMinimum(rowHeights[rgi], effRowHeight);
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

        // and determine border behaviour for empty cells
        boolean firstCellPart = true;
        boolean lastCellPart = true;
        int actualRowHeight = 0;
        for (int i = 0; i < colCount; i++) {
            GridUnit currentGU = currentRow.getGridUnit(i);
            if (currentGU.isEmpty()) {
                continue;
            }
            if (currentGU.getColSpanIndex() == 0
                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
                    && firstCellParts[i] != null) {
                // TODO
                // The last test above is a workaround for the stepping algorithm's
                // fundamental flaw making it unable to produce the right element list for
                // multiple breaks inside a same row group.
                // (see http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnownProblems)
                // In some extremely rare cases (forced breaks, very small page height), a
                // TableContentPosition produced during row delaying may end up alone on a
                // page. It will not contain the CellPart instances for the cells starting
                // the next row, so firstCellParts[i] will still be null for those ones.
                int cellHeight = cellHeights[i];
                cellHeight += lastCellParts[i].getConditionalAfterContentLength();
                cellHeight += lastCellParts[i].getBorderPaddingAfter(lastInPart);
                int cellOffset = getRowOffset(Math.max(firstCellParts[i].pgu.getRowIndex(),
                        firstRowIndex));
                actualRowHeight = Math.max(actualRowHeight, cellOffset + cellHeight
                        - currentRowOffset);
            }

            if (firstCellParts[i] != null && !firstCellParts[i].isFirstPart()) {
                firstCellPart = false;
            }
            if (lastCellParts[i] != null && !lastCellParts[i].isLastPart()) {
                lastCellPart = false;
            }
        }

        // Then add areas for cells finishing on the current row
        for (int i = 0; i < colCount; i++) {
            GridUnit currentGU = currentRow.getGridUnit(i);
            if (currentGU.isEmpty() && !tclm.isSeparateBorderModel()) {
                int borderBeforeWhich;
                if (firstCellPart) {
                    if (firstCellOnPage[i]) {
                        borderBeforeWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
                        borderBeforeWhich = ConditionalBorder.NORMAL;
                    }
                } else {
                    borderBeforeWhich = ConditionalBorder.REST;
                }
                int borderAfterWhich;
                if (lastCellPart) {
                    if (lastInPart) {
                        borderAfterWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
                        borderAfterWhich = ConditionalBorder.NORMAL;
                    }
                } else {
                    borderAfterWhich = ConditionalBorder.REST;
                }
                addAreaForEmptyGridUnit((EmptyGridUnit)currentGU,
                        currentRow.getIndex(), i,
                        actualRowHeight,
                        borderBeforeWhich, borderAfterWhich,
                        lastOnPage);

                firstCellOnPage[i] = false;
            } else if (currentGU.getColSpanIndex() == 0
                    && (lastInPart || currentGU.isLastGridUnitRowSpan())
                    && firstCellParts[i] != null) {
                assert firstCellParts[i].pgu == currentGU.getPrimary();

                int borderBeforeWhich;
                if (firstCellParts[i].isFirstPart()) {
                    if (firstCellOnPage[i]) {
                        borderBeforeWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
                        borderBeforeWhich = ConditionalBorder.NORMAL;
                    }
                } else {
                    assert firstCellOnPage[i];
                    borderBeforeWhich = ConditionalBorder.REST;
                }
                int borderAfterWhich;
                if (lastCellParts[i].isLastPart()) {
                    if (lastInPart) {
                        borderAfterWhich = ConditionalBorder.LEADING_TRAILING;
                    } else {
                        borderAfterWhich = ConditionalBorder.NORMAL;
                    }
                } else {
                    borderAfterWhich = ConditionalBorder.REST;
                }

                addAreasForCell(firstCellParts[i].pgu,
                        firstCellParts[i].start, lastCellParts[i].end,
                        actualRowHeight, borderBeforeWhich, borderAfterWhich,
                        lastOnPage);
                firstCellParts[i] = null;
                Arrays.fill(firstCellOnPage, i, i + currentGU.getCell().getNumberColumnsSpanned(),
                        false);
            }
        }
        currentRowOffset += actualRowHeight;
        if (lastInPart) {
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

     * @param rowIndex the index of the row from which cells must be activated
     */
    private void activateCells(List activeCellList, int rowIndex) {
        EffRow row = rowGroup[rowIndex];
        for (int i = 0; i < columnCount; i++) {
            GridUnit gu = row.getGridUnit(i);
            if (!gu.isEmpty() && gu.isPrimary()) {
                activeCellList.add(new ActiveCell((PrimaryGridUnit) gu, row, rowIndex,
                        previousRowsLength, getTableLM()));
            }
        }
    }
View Full Code Here

Examples of org.apache.fop.fo.flow.table.GridUnit

        log.debug("Handling row group with " + rowGroup.length + " rows...");
        EffRow row;
        for (int rgi = 0; rgi < rowGroup.length; rgi++) {
            row = rowGroup[rgi];
            for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) {
                GridUnit gu = (GridUnit) iter.next();
                if (gu.isPrimary()) {
                    PrimaryGridUnit primary = gu.getPrimary();
                    // TODO a new LM must be created for every new static-content
                    primary.createCellLM();
                    primary.getCellLM().setParent(tableLM);
                    //Calculate width of cell
                    int spanWidth = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.