Examples of MinOptMax


Examples of org.apache.fop.traits.MinOptMax

        getParentArea(null);

        // if this will create the first block area in a page
        // and display-align is bottom or center, add space before
        if (layoutContext.getSpaceBefore() > 0) {
            addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
        }

        LayoutManager childLM = null;
        LayoutManager lastLM = null;
        LayoutContext lc = new LayoutContext(0);
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

            performSpaceResolutionRules2to3(secondPart, secondPartLengths);
        }
    }
   
    private MinOptMax sum(MinOptMax[] lengths) {
        MinOptMax sum = new MinOptMax();
        for (int i = 0; i < lengths.length; i++) {
            if (lengths[i] != null) {
                sum.add(lengths[i]);
            }
        }
        return sum;
    }
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

        }
        return sum;
    }
   
    private void generate(ListIterator iter) {
        MinOptMax noBreakLength = new MinOptMax();
        MinOptMax glue1; //space before break possibility if break occurs
        //MinOptMax glue2; //difference between glue 1 and 3 when no break occurs
        MinOptMax glue3; //space after break possibility if break occurs
        glue1 = sum(firstPartLengths);
        glue3 = sum(secondPartLengths);
        noBreakLength = sum(noBreakLengths);
       
        //This doesn't produce the right glue2
        //glue2 = new MinOptMax(noBreakLength);
        //glue2.subtract(glue1);
        //glue2.subtract(glue3);
       
        int glue2w = noBreakLength.opt - glue1.opt - glue3.opt;
        int glue2stretch = (noBreakLength.max - noBreakLength.opt);
        int glue2shrink = (noBreakLength.opt - noBreakLength.min);
        glue2stretch -= glue1.max - glue1.opt;
        glue2stretch -= glue3.max - glue3.opt;
        glue2shrink -= glue1.opt - glue1.min;
        glue2shrink -= glue3.opt - glue3.min;
       
        boolean hasPrecedingNonBlock = false;
        boolean forcedBreak = false;
        if (log.isDebugEnabled()) {
            log.debug("noBreakLength=" + noBreakLength
                    + ", glue1=" + glue1
                    + ", glue2=" + glue2w + "+" + glue2stretch + "-" + glue2shrink
                    + ", glue3=" + glue3);
        }
        if (breakPoss != null) {
            if (glue1.isNonZero()) {
                iter.add(new KnuthPenalty(0, KnuthPenalty.INFINITE,
                        false, (Position)null, true));
                iter.add(new KnuthGlue(glue1.opt, glue1.max - glue1.opt, glue1.opt - glue1.min,
                        (Position)null, true));
            }
            iter.add(new KnuthPenalty(breakPoss.getPenaltyWidth(), breakPoss.getPenaltyValue(),
                    false, breakPoss.getBreakClass(),
                    new SpaceHandlingBreakPosition(this, breakPoss), false));
            if (breakPoss.getPenaltyValue() <= -KnuthPenalty.INFINITE) {
                return; //return early. Not necessary (even wrong) to add additional elements
            }
            if (glue2w != 0 || glue2stretch != 0 || glue2shrink != 0) {
                iter.add(new KnuthGlue(glue2w, glue2stretch, glue2shrink,
                        (Position)null, true));
            }
        } else {
            if (glue1.isNonZero()) {
                throw new IllegalStateException("glue1 should be 0 in this case");
            }
        }
        Position pos = null;
        if (breakPoss == null) {
            pos = new SpaceHandlingPosition(this);
        }
        if (glue3.isNonZero() || pos != null) {
            iter.add(new KnuthBox(0, pos, true));
        }
        if (glue3.isNonZero()) {
            iter.add(new KnuthPenalty(0, KnuthPenalty.INFINITE,
                    false, (Position)null, true));
            iter.add(new KnuthGlue(glue3.opt, glue3.max - glue3.opt, glue3.opt - glue3.min,
                    (Position)null, true));
            hasPrecedingNonBlock = true;
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

    /**
     * @see org.apache.fop.layoutmgr.LayoutManager
     */
    public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
        MinOptMax stackLimit = new MinOptMax(context.getStackLimit());

        referenceIPD = context.getRefIPD();
        cellIPD = referenceIPD;
        cellIPD -= getIPIndents();
        if (isSeparateBorderModel()) {
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

     * @param autoHeight true if warnings about overflows should be disabled because the
     *                   the BPD is really undefined (for footnote-separators, for example)
     */
    public void doLayout(int flowBPD, boolean autoHeight) {
        LayoutContext childLC = createLayoutContext();
        childLC.setStackLimit(new MinOptMax(flowBPD));

        if (getCurrentDisplayAlign() == Constants.EN_X_FILL) {
            //EN_X_FILL is non-standard (by LF)
            alignment = Constants.EN_JUSTIFY;
        } else if (getCurrentDisplayAlign() == Constants.EN_X_DISTRIBUTE) {
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

                /* *** *** non-standard extension *** *** */
                if (displayAlign == Constants.EN_X_FILL) {
                    int averageLineLength = optimizeLineLength(effectiveList,
                            startElementIndex, endElementIndex);
                    if (averageLineLength != 0) {
                        childLC.setStackLimit(new MinOptMax(averageLineLength));
                    }
                }
                /* *** *** non-standard extension *** *** */

                // Handle SpaceHandling(Break)Positions, see SpaceResolver!
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

            firstElementIndex = sequenceIterator.previousIndex();
            sequenceIterator.previous();

            // scan the sub-sequence representing a page,
            // collecting information about potential adjustments
            MinOptMax lineNumberMaxAdjustment = new MinOptMax(0);
            MinOptMax spaceMaxAdjustment = new MinOptMax(0);
            double spaceAdjustmentRatio = 0.0;
            LinkedList blockSpacesList = new LinkedList();
            LinkedList unconfirmedList = new LinkedList();
            LinkedList adjustableLinesList = new LinkedList();
            boolean bBoxSeen = false;
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

                    + " bigger than the available space ("
                    + getContentAreaIPD() + "mpt > " + context.getRefIPD() + "mpt)",
                    getBlockContainerFO()));
        }
       
        MinOptMax stackLimit = new MinOptMax(relDims.bpd);

        LinkedList returnedList = null;
        LinkedList contentList = new LinkedList();
        LinkedList returnList = new LinkedList();
       
        if (!breakBeforeServed) {
            breakBeforeServed = true;
            if (!context.suppressBreakBefore()) {
                if (addKnuthElementsForBreakBefore(returnList, context)) {
                    return returnList;
                }
            }
        }

        if (!firstVisibleMarkServed) {
            addKnuthElementsForSpaceBefore(returnList, alignment);
        }
       
        addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
        firstVisibleMarkServed = true;

        if (autoHeight && inlineElementList) {
            //Spaces, border and padding to be repeated at each break
            addPendingMarks(context);

            BlockLevelLayoutManager curLM; // currently active LM
            BlockLevelLayoutManager prevLM = null; // previously active LM
            while ((curLM = (BlockLevelLayoutManager) getChildLM()) != null) {
                LayoutContext childLC = new LayoutContext(0);
                childLC.copyPendingMarksFrom(context);
                // curLM is a ?
                childLC.setStackLimitBP(MinOptMax.subtract(context.getStackLimitBP(), stackLimit));
                childLC.setRefIPD(relDims.ipd);
                childLC.setWritingMode(getBlockContainerFO().getWritingMode());
                if (curLM == this.childLMs.get(0)) {
                    childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
                    //Handled already by the parent (break collapsing, see above)
                }

                // get elements from curLM
                returnedList = curLM.getNextKnuthElements(childLC, alignment);
                if (returnedList.size() == 1
                        && ((ListElement)returnedList.getFirst()).isForcedBreak()) {
                    // a descendant of this block has break-before
                    /*
                    if (returnList.size() == 0) {
                        // the first child (or its first child ...) has
                        // break-before;
                        // all this block, including space before, will be put in
                        // the
                        // following page
                        bSpaceBeforeServed = false;
                    }*/
                    contentList.addAll(returnedList);

                    // "wrap" the Position inside each element
                    // moving the elements from contentList to returnList
                    returnedList = new LinkedList();
                    wrapPositionElements(contentList, returnList);

                    return returnList;
                } else {
                    if (prevLM != null) {
                        // there is a block handled by prevLM
                        // before the one handled by curLM
                        if (mustKeepTogether()
                                || prevLM.mustKeepWithNext()
                                || curLM.mustKeepWithPrevious()) {
                            // add an infinite penalty to forbid a break between
                            // blocks
                            contentList.add(new BreakElement(
                                    new Position(this), KnuthElement.INFINITE, context));
                        } else if (!((ListElement) contentList.getLast()).isGlue()) {
                            // add a null penalty to allow a break between blocks
                            contentList.add(new BreakElement(
                                    new Position(this), 0, context));
                        } else {
                            // the last element in contentList is a glue;
                            // it is a feasible breakpoint, there is no need to add
                            // a penalty
                        }
                    }
                    contentList.addAll(returnedList);
                    if (returnedList.size() == 0) {
                        //Avoid NoSuchElementException below (happens with empty blocks)
                        continue;
                    }
                    if (((ListElement)returnedList.getLast()).isForcedBreak()) {
                        // a descendant of this block has break-after
                        if (curLM.isFinished()) {
                            // there is no other content in this block;
                            // it's useless to add space after before a page break
                            setFinished(true);
                        }

                        returnedList = new LinkedList();
                        wrapPositionElements(contentList, returnList);

                        return returnList;
                    }
                }
                prevLM = curLM;
            }

            returnedList = new LinkedList();
            wrapPositionElements(contentList, returnList);

        } else {
            MinOptMax range = new MinOptMax(relDims.ipd);
            BlockContainerBreaker breaker = new BlockContainerBreaker(this, range);
            breaker.doLayout(relDims.bpd, autoHeight);
            boolean contentOverflows = breaker.isOverflow();
            if (autoHeight) {
                //Update content BPD now that it is known
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

        vpContentBPD = allocBPD - getBPIndents();
        setContentAreaIPD(allocIPD - getIPIndents());
       
        updateRelDims(0, 0, autoHeight);

        MinOptMax range = new MinOptMax(relDims.ipd);
        BlockContainerBreaker breaker = new BlockContainerBreaker(this, range);
        breaker.doLayout((autoHeight ? 0 : relDims.bpd), autoHeight);
        boolean contentOverflows = breaker.isOverflow();
        if (autoHeight) {
            //Update content BPD now that it is known
View Full Code Here

Examples of org.apache.fop.traits.MinOptMax

        getParentArea(null);

        // if this will create the first block area in a page
        // and display-align is bottom or center, add space before
        if (layoutContext.getSpaceBefore() > 0) {
            addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
        }

        LayoutManager childLM = null;
        LayoutManager lastLM = null;
        LayoutContext lc = new LayoutContext(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.