Package org.apache.fop.fo.flow

Examples of org.apache.fop.fo.flow.TableRow


        }

        if (currentGridRowFinished) {
            removeCellsEndingOnCurrentRow();
            if (activeRowIndex < rowGroup.length - 1) {
                TableRow rowFO = getActiveRow().getTableRow();
                if (rowFO != null && rowFO.getBreakAfter() != Constants.EN_AUTO) {
                    log.warn(FONode.decorateWithContextInfo(
                            "break-after ignored on table-row because of row spanning "
                            + "in progress (See XSL 1.0, 7.19.1)", rowFO));
                }
                activeRowIndex++;
                if (log.isDebugEnabled()) {
                    log.debug("===> new row: " + activeRowIndex);
                }
                initializeElementLists();
                rowFO = getActiveRow().getTableRow();
                if (rowFO != null && rowFO.getBreakBefore() != Constants.EN_AUTO) {
                    log.warn(FONode.decorateWithContextInfo(
                            "break-before ignored on table-row because of row spanning "
                            + "in progress (See XSL 1.0, 7.19.2)", rowFO));
                }
            }
View Full Code Here


            LayoutContext context, int alignment, int bodyType) {
        LinkedList returnList = new LinkedList();
        EffRow[] rowGroup = null;
        while ((rowGroup = iter.getNextRowGroup()) != null) {
            //Check for break-before on the table-row at the start of the row group
            TableRow rowFO = rowGroup[0].getTableRow();
            if (rowFO != null && rowFO.getBreakBefore() != Constants.EN_AUTO) {
                log.info("break-before found");
                if (returnList.size() > 0) {
                    ListElement last = (ListElement)returnList.getLast();
                    if (last.isPenalty()) {
                        KnuthPenalty pen = (KnuthPenalty)last;
                        pen.setP(-KnuthPenalty.INFINITE);
                        pen.setBreakClass(rowFO.getBreakBefore());
                    } else {//if (last instanceof BreakElement) { // TODO vh: seems the only possibility
                        BreakElement breakPoss = (BreakElement) last;
                        breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
                        breakPoss.setBreakClass(rowFO.getBreakBefore());
                    }
                } else {
                    returnList.add(new BreakElement(new Position(getTableLM()),
                            0, -KnuthPenalty.INFINITE, rowFO.getBreakBefore(), context));
                }
            }
           
            //Border resolution
            if (!isSeparateBorderModel()) {
                resolveNormalBeforeAfterBordersForRowGroup(rowGroup, iter);
            }

            //Reset keep-with-next when remaining inside the table.
            //The context flag is only used to propagate keep-with-next to the outside.
            //The clearing is ok here because createElementsForRowGroup already handles
            //the keep when inside a table.
            context.setFlags(LayoutContext.KEEP_WITH_NEXT_PENDING, false);
           
            //Element list creation
            createElementsForRowGroup(context, alignment, bodyType,
                        returnList, rowGroup);
           
            //Handle keeps
            if (context.isKeepWithNextPending()) {
                log.debug("child LM (row group) signals pending keep-with-next");
            }
            if (context.isKeepWithPreviousPending()) {
                log.debug("child LM (row group) signals pending keep-with-previous");
                if (returnList.size() > 0) {
                    //Modify last penalty
                    ListElement last = (ListElement)returnList.getLast();
                    if (last.isPenalty()) {
                        BreakElement breakPoss = (BreakElement)last;
                        //Only honor keep if there's no forced break
                        if (!breakPoss.isForcedBreak()) {
                            breakPoss.setPenaltyValue(KnuthPenalty.INFINITE);
                        }
                    }
                }
            }
           
            //Check for break-after on the table-row at the end of the row group
            rowFO = rowGroup[rowGroup.length - 1].getTableRow();
            if (rowFO != null && rowFO.getBreakAfter() != Constants.EN_AUTO) {
                if (returnList.size() > 0) {
                    ListElement last = (ListElement)returnList.getLast();
                    if (last instanceof KnuthPenalty) {
                        KnuthPenalty pen = (KnuthPenalty)last;
                        pen.setP(-KnuthPenalty.INFINITE);
                        pen.setBreakClass(rowFO.getBreakAfter());
                    } else if (last instanceof BreakElement) {
                        BreakElement breakPoss = (BreakElement)last;
                        breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
                        breakPoss.setBreakClass(rowFO.getBreakAfter());
                    }
                }
            }
        }
       
View Full Code Here

            row = rowGroup[rgi];
            rowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
            explicitRowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
           
            pgus.clear();
            TableRow tableRow = null;
            // The row's minimum content height; 0 if the row's height is auto, otherwise
            // the .minimum component of the explicitely specified value
            int minContentHeight = 0;
            int maxCellHeight = 0;
            int effRowContentHeight = 0;
            for (int j = 0; j < row.getGridUnits().size(); j++) {
//                assert maxColumnCount == 0 || maxColumnCount == row.getGridUnits().size(); // TODO vh
                maxColumnCount = Math.max(maxColumnCount, row.getGridUnits().size());
                GridUnit gu = row.getGridUnit(j);
                if ((gu.isPrimary() || (gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()))
                        && !gu.isEmpty()) {
                    PrimaryGridUnit primary = gu.getPrimary();
                   
                    if (gu.isPrimary()) {
                        primary.getCellLM().setParent(getTableLM());
                    
                        //Determine the table-row if any
                        if (tableRow == null && primary.getRow() != null) {
                            tableRow = primary.getRow();
                           
                            //Check for bpd on row, see CSS21, 17.5.3 Table height algorithms
                            LengthRangeProperty bpd = tableRow.getBlockProgressionDimension();
                            if (!bpd.getMinimum(getTableLM()).isAuto()) {
                                minContentHeight = Math.max(
                                        minContentHeight,
                                        bpd.getMinimum(
                                                getTableLM()).getLength().getValue(getTableLM()));
View Full Code Here

        while (node instanceof Marker) {
            node = tablePartChildIterator.next();
        }
        this.currentRow.clear();
        this.fetchIndex++;
        TableRow rowFO = null;
        if (node instanceof TableRow) {
            rowFO = (TableRow)node;
            ListIterator cellIterator = rowFO.getChildNodes();
            while (cellIterator.hasNext()) {
                this.currentRow.add(cellIterator.next());
            }
        } else if (node instanceof TableCell) {
            this.currentRow.add(node);
View Full Code Here

            //If there is no background-color specified for the cell,
            //then try to read it from table-row or table-header.
            CommonBorderPaddingBackground brd = null;
           
            if (fobj.getParent() instanceof TableRow) {
                TableRow parentRow = (TableRow)fobj.getParent();
                brd = parentRow.getCommonBorderPaddingBackground();
                color = brd.backgroundColor;
            } else if (fobj.getParent() instanceof TableHeader) {
                TableHeader parentHeader = (TableHeader)fobj.getParent();
                brd = parentHeader.getCommonBorderPaddingBackground();
                color = brd.backgroundColor;
View Full Code Here

            row = rowGroup[rgi];
            rowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
            explicitRowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
           
            pgus.clear();
            TableRow tableRow = null;
            int minContentHeight = 0;
            int maxCellHeight = 0;
            int effRowContentHeight = 0;
            for (int j = 0; j < row.getGridUnits().size(); j++) {
                maxColumnCount = Math.max(maxColumnCount, row.getGridUnits().size());
                GridUnit gu = row.getGridUnit(j);
                if ((gu.isPrimary() || (gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()))
                        && !gu.isEmpty()) {
                    PrimaryGridUnit primary = gu.getPrimary();
                   
                    if (gu.isPrimary()) {
                        primary.getCellLM().setParent(getTableLM());
                    
                        //Determine the table-row if any
                        if (tableRow == null && primary.getRow() != null) {
                            tableRow = primary.getRow();
                           
                            //Check for bpd on row, see CSS21, 17.5.3 Table height algorithms
                            LengthRangeProperty bpd = tableRow.getBlockProgressionDimension();
                            if (!bpd.getMinimum(getTableLM()).isAuto()) {
                                minContentHeight = Math.max(
                                        minContentHeight,
                                        bpd.getMinimum(
                                                getTableLM()).getLength().getValue(getTableLM()));
View Full Code Here

            //If there is no background-color specified for the cell,
            //then try to read it from table-row or table-header.
            CommonBorderPaddingBackground brd = null;
           
            if (fobj.getParent() instanceof TableRow) {
                TableRow parentRow = (TableRow)fobj.getParent();
                brd = parentRow.getCommonBorderPaddingBackground();
                color = brd.backgroundColor;
            } else if (fobj.getParent() instanceof TableHeader) {
                TableHeader parentHeader = (TableHeader)fobj.getParent();
                brd = parentHeader.getCommonBorderPaddingBackground();
                color = brd.backgroundColor;
View Full Code Here

            LayoutContext context, int alignment, int bodyType) {
        LinkedList returnList = new LinkedList();
        EffRow[] rowGroup = null;
        while ((rowGroup = iter.getNextRowGroup()) != null) {
            //Check for break-before on the table-row at the start of the row group
            TableRow rowFO = rowGroup[0].getTableRow();
            if (rowFO != null && rowFO.getBreakBefore() != Constants.EN_AUTO) {
                log.info("break-before found");
                if (returnList.size() > 0) {
                    ListElement last = (ListElement)returnList.getLast();
                    if (last.isPenalty()) {
                        KnuthPenalty pen = (KnuthPenalty)last;
                        pen.setP(-KnuthPenalty.INFINITE);
                        pen.setBreakClass(rowFO.getBreakBefore());
                    } else if (last instanceof BreakElement) {
                        BreakElement breakPoss = (BreakElement) last;
                        breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
                        breakPoss.setBreakClass(rowFO.getBreakBefore());
                    }
                } else {
                    if (!firstBreakBeforeServed) {
                        returnList.add(new BreakElement(new Position(getTableLM()),
                                0, -KnuthPenalty.INFINITE, rowFO.getBreakBefore(), context));
                        iter.backToPreviousRow();
                        firstBreakBeforeServed = true;
                        break;
                    }
                }
            }
            firstBreakBeforeServed = true;
           
            //Border resolution
            if (!isSeparateBorderModel()) {
                resolveNormalBeforeAfterBordersForRowGroup(rowGroup, iter);
            }
           
            //Element list creation
            createElementsForRowGroup(context, alignment, bodyType,
                        returnList, rowGroup);
           
            //Handle keeps
            if (context.isKeepWithNextPending()) {
                log.debug("child LM (row group) signals pending keep-with-next");
            }
            if (context.isKeepWithPreviousPending()) {
                log.debug("child LM (row group) signals pending keep-with-previous");
                if (returnList.size() > 0) {
                    //Modify last penalty
                    ListElement last = (ListElement)returnList.getLast();
                    if (last.isPenalty()) {
                        BreakElement breakPoss = (BreakElement)last;
                        //Only honor keep if there's no forced break
                        if (!breakPoss.isForcedBreak()) {
                            breakPoss.setPenaltyValue(KnuthPenalty.INFINITE);
                        }
                    }
                }
            }
           
            //Check for break-after on the table-row at the end of the row group
            rowFO = rowGroup[rowGroup.length - 1].getTableRow();
            if (rowFO != null && rowFO.getBreakAfter() != Constants.EN_AUTO) {
                if (returnList.size() > 0) {
                    ListElement last = (ListElement)returnList.getLast();
                    if (last instanceof KnuthPenalty) {
                        KnuthPenalty pen = (KnuthPenalty)last;
                        pen.setP(-KnuthPenalty.INFINITE);
                        pen.setBreakClass(rowFO.getBreakAfter());
                    } else if (last instanceof BreakElement) {
                        BreakElement breakPoss = (BreakElement)last;
                        breakPoss.setPenaltyValue(-KnuthPenalty.INFINITE);
                        breakPoss.setBreakClass(rowFO.getBreakAfter());
                    }
                }
            }
        }
       
View Full Code Here

        if (otherGridUnit != null) {
            otherCell = otherGridUnit.getCell();
        }
       
        //Get rows
        TableRow currentRow = currentGridUnit.getRow();
        TableRow otherRow = null;
        if (vertical && otherCell != null) {
            otherRow = otherGridUnit.getRow();
        }
       
        //get bodies
        TableBody currentBody = currentGridUnit.getBody();
        TableBody otherBody = null;
        if (otherRow != null) {
            otherBody = otherGridUnit.getBody();
        }

        //get columns
        TableColumn currentColumn = currentGridUnit.getColumn();
        TableColumn otherColumn = null;
        if (otherGridUnit != null) {
            otherColumn = otherGridUnit.getColumn();
        }
       
        //TODO get column groups
       
        //Get table
        Table table = currentGridUnit.getTable();
       
        //----------------------------------------------------------------------
        //We're creating two arrays containing the applicable BorderInfos for
        //each cell in question.
        //0 = cell, 1 = row, 2 = row group (body), 3 = column,
        //4 = col group (spanned column, see 6.7.3), 5 = table

        BorderInfo[] current = new BorderInfo[6];
        BorderInfo[] other = new BorderInfo[6];
        //cell
        current[0] = currentGridUnit.getOriginalBorderInfoForCell(side);
        if (otherGridUnit != null) {
            other[0] = otherGridUnit.getOriginalBorderInfoForCell(otherSide);
        }
        if ((currentRow != null)
                && (side == BEFORE
                    || side == AFTER
                    || (currentGridUnit.getFlag(GridUnit.IN_FIRST_COLUMN) && side == START)
                    || (currentGridUnit.getFlag(GridUnit.IN_LAST_COLUMN) && side == END))) {
            //row
            current[1] = currentRow.getCommonBorderPaddingBackground().getBorderInfo(side);
        }
        if (otherRow != null) {
            //row
            other[1] = otherRow.getCommonBorderPaddingBackground().getBorderInfo(otherSide);
        }
        if (currentBody != null
                && ((side == BEFORE && currentGridUnit.getFlag(GridUnit.FIRST_IN_PART))
                || (side == AFTER && currentGridUnit.getFlag(GridUnit.LAST_IN_PART))
                || (currentGridUnit.getFlag(GridUnit.IN_FIRST_COLUMN) && side == START)
View Full Code Here

        while (node instanceof Marker) {
            node = tablePartChildIterator.next();
        }
        this.currentRow.clear();
        this.fetchIndex++;
        TableRow rowFO = null;
        if (node instanceof TableRow) {
            rowFO = (TableRow)node;
            ListIterator cellIterator = rowFO.getChildNodes();
            while (cellIterator.hasNext()) {
                this.currentRow.add(cellIterator.next());
            }
        } else if (node instanceof TableCell) {
            this.currentRow.add(node);
View Full Code Here

TOP

Related Classes of org.apache.fop.fo.flow.TableRow

Copyright © 2018 www.massapicom. 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.