Package org.jfree.layouting.renderer.model

Examples of org.jfree.layouting.renderer.model.ComputedLayoutProperties



  protected void finishInlineLevelBox(final RenderBox box)
  {
    // Sum up the width; Maximize the height.; add borders and padding
    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();

    // horizontal border and padding ..
    final long hbp = blp.getBorderLeft() + blp.getBorderRight() +
        blp.getPaddingLeft() + blp.getPaddingRight() +
        blp.getMarginLeft() + blp.getMarginRight();

    long minChunkWidth = 0;
    long maxBoxWidth = 0;

    RenderNode node = box.getVisibleFirst();
View Full Code Here


  }

  protected void finishBlockLevelBox(final RenderBox box)
  {
    // Sum up the height; Maximize the width.; add borders and padding
    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();

    // horizontal border and padding ..
    final long hbp = blp.getBorderLeft() + blp.getBorderRight() +
        blp.getPaddingLeft() + blp.getPaddingRight() +
        blp.getMarginLeft() + blp.getMarginRight();

    if (box instanceof ParagraphRenderBox)
    {
      // No margins, no additional checks. And we can be sure that this one
      // is the only child. (This is a cheap shortcut).
View Full Code Here

    final CSSValue dominantBaselineValue = box.getDominantBaseline();
    setDominantBaseline(TextUtility.translateDominantBaseline
        (dominantBaselineValue, baselineInfo.getDominantBaseline()));

    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();
    insetsTop = blp.getBorderTop() + blp.getPaddingTop();
    insetsBottom = blp.getBorderBottom() + blp.getPaddingBottom();

    baselines = (long[]) baselineInfo.getBaselines().clone();
    for (int i = 1; i < baselines.length; i++)
    {
      baselines[i] += insetsTop;
View Full Code Here

  protected void computeInlineBlock(final RenderBox box,
                                    final long position,
                                    final long itemElementWidth)
  {
    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();
    box.setX(position + blp.getMarginLeft());
    final long width = itemElementWidth - blp.getMarginLeft() - blp.getMarginRight();
    if (width == 0)
    {
      ModelPrinter.printParents(box);

      throw new IllegalStateException("A box without any width? " +
          Integer.toHexString(System.identityHashCode(box)) + ' ' + box.getClass());
    }
    box.setWidth(width);

    final long leftInsets = blp.getPaddingLeft() + blp.getBorderLeft();
    final long rightInsets = blp.getPaddingRight() + blp.getBorderRight();
    box.setContentAreaX1(box.getX() + leftInsets);
    box.setContentAreaX2(box.getX() + box.getWidth() - rightInsets);

    final InfiniteMinorAxisLayoutStep layoutStep = new InfiniteMinorAxisLayoutStep();
    layoutStep.continueComputation(getPageGrid(), box);
View Full Code Here

    {
      infiniteMarginTop = (visiblePrev == null);
    }
    else
    {
      final ComputedLayoutProperties sBlp = boxParent.getComputedLayoutProperties();
      final BoxLayoutProperties pBlp = boxParent.getBoxLayoutProperties();
      infiniteMarginTop =
          (pBlp.isInfiniteMarginTop() && visiblePrev == null &&
          sBlp.getBorderTop() == 0 && sBlp.getPaddingTop() != 0);
    }

    marginCollection.clear();

    // Collect all elements that will contribute to the margins.
    RenderBox marginBox = box;
    while (true)
    {
      marginCollection.add(marginBox);

      final ComputedLayoutProperties cblp = marginBox.getComputedLayoutProperties();
      if (cblp.getBorderBottom() != 0)
      {
        break;
      }
      if (cblp.getPaddingBottom() != 0)
      {
        break;
      }

      final RenderNode node = marginBox.getVisibleFirst();
      if (node instanceof RenderBox == false)
      {
        break;
      }

      marginBox = (RenderBox) node;
    }

    // If we are the first child on an infinite margin area, copy the
    // infinite area to yourself ..
    if (infiniteMarginTop)
    {
      for (int i = 0; i < marginCollection.size(); i++)
      {
        final RenderBox renderBox = (RenderBox) marginCollection.get(i);
        final BoxLayoutProperties cblp = renderBox.getBoxLayoutProperties();
        cblp.setEffectiveMarginTop(0);
        cblp.setInfiniteMarginTop(true);
        cblp.setMarginOpenState(marginChangeKey);
      }
      return true;
    }

    // Compute the top margin.
    long topMarginPositive = 0;
    long topMarginNegative = 0;
    final ComputedLayoutProperties sblp = box.getComputedLayoutProperties();
    final long marginTop = sblp.getMarginTop();
    if (marginTop < 0)
    {
      topMarginNegative = marginTop;
    }
    else
    {
      topMarginPositive = marginTop;
    }

    if (visiblePrev != null)
    {
      final long effectiveMarginBottom =
          visiblePrev.getEffectiveMarginBottom();

      if (effectiveMarginBottom < 0)
      {
        topMarginNegative = Math.min(topMarginNegative, effectiveMarginBottom);
      }
      else
      {
        topMarginPositive = Math.max(topMarginPositive, effectiveMarginBottom);
      }
    }

    // Dive into all other childs, and set their effective margin to zero.
    // Perform the collapsing, but the result only affects the first child.
    // The margin is already handled by the first element.
    for (int i = 1; i < marginCollection.size(); i++)
    {
      final RenderBox renderBox = (RenderBox) marginCollection.get(i);
      final BoxLayoutProperties cblp = renderBox.getBoxLayoutProperties();
      final ComputedLayoutProperties scblp = renderBox.getComputedLayoutProperties();
      final long childMarginTop = scblp.getMarginTop();

      if (childMarginTop < 0)
      {
        topMarginNegative = Math.min(topMarginNegative, childMarginTop);
      }
View Full Code Here

      final RenderBox parent = marginBox.getParent();
      if (parent == null)
      {
        break;
      }
      final ComputedLayoutProperties sblp = parent.getComputedLayoutProperties();
      if (sblp.getBorderBottom() != 0)
      {
        break;
      }
      if (sblp.getPaddingBottom() != 0)
      {
        break;
      }
      marginBox = parent;
    }

    // Check, whether we have an infinite margin ..
    final RenderBox lastBox = (RenderBox)
        marginCollection.get(marginCollection.size() - 1);
    if (lastBox.getParent() == null)
    {
      // Looks like that's it.
      // Strive for the simple solution here.
      for (int i = 0; i < marginCollection.size(); i++)
      {
        final RenderBox renderBox = (RenderBox) marginCollection.get(i);
        final BoxLayoutProperties cblp = renderBox.getBoxLayoutProperties();
        cblp.setMarginCloseState(marginChangeKey);
        cblp.setInfiniteMarginBottom(true);
        cblp.setEffectiveMarginBottom(0);
      }
      return;
    }

    long marginNegative = 0;
    long marginPositive = 0;

    // Collapsing the margins. Seek the big one ..
    for (int i = 0; i < marginCollection.size(); i++)
    {
      final RenderBox renderBox = (RenderBox) marginCollection.get(i);
      final BoxLayoutProperties cblp = renderBox.getBoxLayoutProperties();
      cblp.setMarginCloseState(marginChangeKey);
      cblp.setInfiniteMarginBottom(false);
      cblp.setEffectiveMarginBottom(0);

      final ComputedLayoutProperties sblp = renderBox.getComputedLayoutProperties();
      marginNegative = Math.min (marginNegative, sblp.getMarginBottom());
      marginPositive = Math.max (marginPositive, sblp.getMarginBottom());
    }

    final BoxLayoutProperties lblp = lastBox.getBoxLayoutProperties();
    lblp.setEffectiveMarginBottom(marginPositive + marginNegative);
    lblp.setInfiniteMarginBottom(false);
View Full Code Here

    if (node instanceof RenderBox == false)
    {
      return false;
    }
    final RenderBox marginBox = (RenderBox) node;
    final ComputedLayoutProperties blp = marginBox.getComputedLayoutProperties();
    if (blp.getBorderTop() != 0)
    {
      return false;
    }
    if (blp.getPaddingTop() != 0)
    {
      return false;
    }
    // This one is collapsible ..
    return true;
View Full Code Here

        node.setDirty(true);
        node.setY(marginTop + prev.getY() + prev.getHeight());
      }
      else
      {
        final ComputedLayoutProperties blp = parent.getComputedLayoutProperties();
        final long insetTop = (blp.getBorderTop() + blp.getPaddingTop());

        node.setDirty(true);
        node.setY(marginTop + insetTop + parent.getY());
      }
    }
    // The parent is a inline box.
    else if (parent != null)
    {
      final ComputedLayoutProperties blp = parent.getComputedLayoutProperties();
      final long insetTop = (blp.getBorderTop() + blp.getPaddingTop());

      node.setDirty(true);
      node.setY(marginTop + insetTop + parent.getY());
    }
    else
View Full Code Here

  }

  protected void finishBlockLevelBox(final RenderBox box)
  {
    // Check the height. Set the height.
    final ComputedLayoutProperties clp = box.getComputedLayoutProperties();
    final RenderLength computedWidth = clp.getComputedWidth();
    final RenderLength preferredHeight = box.getBoxDefinition().getPreferredHeight();
    final long computedHeight =
        preferredHeight.resolve(computedWidth.resolve(0));

    final ComputedLayoutProperties blp = box.getComputedLayoutProperties();
    final long insetBottom = blp.getBorderBottom() + blp.getPaddingBottom();

    final RenderNode lastChildNode = box.getLastChild();
    if (lastChildNode != null)
    {
      // grab the node's y2
      final long childY2 = lastChildNode.getY() + lastChildNode.getHeight() +
          lastChildNode.getEffectiveMarginBottom();
      final long effectiveHeight = (childY2 - box.getY()) + insetBottom;
      final long height = Math.max(effectiveHeight, computedHeight);
      box.setHeight(height);
    }
    else
    {
      final long insetTop = blp.getBorderTop() + blp.getBorderTop();
      box.setHeight(Math.max(computedHeight, insetTop + insetBottom));
    }

    if (breakState != null)
    {
View Full Code Here

    // This aligns all direct childs. Once that is finished, we have to
    // check, whether possibly existing inner-paragraphs are still valid
    // or whether moving them violated any of the inner-pagebreak constraints.
    final VerticalAlignmentProcessor processor = new VerticalAlignmentProcessor();

    final ComputedLayoutProperties blp = inlineRenderBox.getComputedLayoutProperties();
    final long insetTop = (blp.getBorderTop() + blp.getPaddingTop());

    final long contentAreaY1 = inlineRenderBox.getY() + insetTop;
    final RenderLength lineHeight = inlineRenderBox.getLineHeight();
    final ComputedLayoutProperties clp = inlineRenderBox.getComputedLayoutProperties();
    final RenderLength bcw = clp.getBlockContextWidth();
    processor.align (boxAlignContext, contentAreaY1,
        lineHeight.resolve(bcw.resolve(0)));
  }
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.model.ComputedLayoutProperties

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.