Package org.pentaho.reporting.engine.classic.core.layout.model

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderLength


  private long resolveComputedWidth(final RenderBox box)
  {
    final long bcw = ProcessUtility.computeBlockContextWidth(box);
    final BoxDefinition boxDef = box.getBoxDefinition();
    final RenderLength minLength = boxDef.getMinimumWidth();
    final RenderLength prefLength = boxDef.getPreferredWidth();
    final RenderLength maxLength = boxDef.getMaximumWidth();

    final long min = minLength.resolve(bcw, 0);
    final long pref = prefLength.resolve(bcw, 0);
    final long max = maxLength.resolve(bcw, ComputeStaticPropertiesProcessStep.MAX_AUTO);
    return ProcessUtility.computeLength(min, max, pref);
  }
View Full Code Here


    // computed width is box-size, so it contains the paddings already
    final long computedWidth = box.getComputedWidth();

    final long bcw = ProcessUtility.computeBlockContextWidth(box);
    final BoxDefinition boxDef = box.getBoxDefinition();
    final RenderLength minLength = boxDef.getMinimumWidth();
    final RenderLength prefLength = boxDef.getPreferredWidth();
    final RenderLength maxLength = boxDef.getMaximumWidth();
    final long min = minLength.resolve(bcw, 0);
    final long max = maxLength.resolve(bcw, ComputeStaticPropertiesProcessStep.MAX_AUTO);

    final long contentAreaX1 = x + leftPadding;
    box.setContentAreaX1(contentAreaX1);

    if (box.getBoxDefinition().isSizeSpecifiesBorderBox())
View Full Code Here

    }
    final long usedContentWidth = (usedX2 - contentAreaX1);

    final long bcw = ProcessUtility.computeBlockContextWidth(box);
    final BoxDefinition boxDef = box.getBoxDefinition();
    final RenderLength minLength = boxDef.getMinimumWidth();
    final RenderLength prefLength = boxDef.getPreferredWidth();
    final RenderLength maxLength = boxDef.getMaximumWidth();

    final long min = minLength.resolve(bcw, 0);
    final long max = maxLength.resolve(bcw, ComputeStaticPropertiesProcessStep.MAX_AUTO);

    if (box.getBoxDefinition().isSizeSpecifiesBorderBox())
    {
      final long minChunkWidth = usedContentWidth + leftPadding + rightPadding;
      final long pref = prefLength.resolve(bcw, Math.max(computedWidth, minChunkWidth));
View Full Code Here

      throw new IllegalArgumentException("ResovleSize cannot be negative");
    }

    // Check the height. Set the height.
    final BoxDefinition boxDefinition = box.getBoxDefinition();
    final RenderLength preferredHeight = boxDefinition.getPreferredHeight();
    final RenderLength minimumHeight = boxDefinition.getMinimumHeight();
    final RenderLength maximumHeight = boxDefinition.getMaximumHeight();

    final long usedHeight;
    final long childY2;
    final long childY1;
    final RenderNode lastChildNode = box.getLastChild();
    if (lastChildNode != null)
    {
      childY1 = box.getFirstChild().getCachedY();
      childY2 = lastChildNode.getCachedY() + lastChildNode.getCachedHeight() + lastChildNode.getEffectiveMarginBottom();
      usedHeight = (childY2 - childY1);
    }
    else
    {
      usedHeight = 0;
      childY2 = 0;
      childY1 = 0;
    }

    final long rminH = minimumHeight.resolve(resolveSize, 0);
    final long rmaxH = maximumHeight.resolve(resolveSize, CanvasMajorAxisLayoutStep.MAX_AUTO);

    final StaticBoxLayoutProperties blp = box.getStaticBoxLayoutProperties();
    final long insetBottom = blp.getBorderBottom() + boxDefinition.getPaddingBottom();
    final long insetTop = blp.getBorderTop() + boxDefinition.getPaddingTop();
//todo
View Full Code Here

      return lpb.getPageHeight();
    }

    // Check the height. Set the height.
    final BoxDefinition boxDefinition = box.getBoxDefinition();
    final RenderLength preferredHeight = boxDefinition.getPreferredHeight();
    final RenderLength minimumHeight = boxDefinition.getMinimumHeight();
    final RenderLength maximumHeight = boxDefinition.getMaximumHeight();

    final StaticBoxLayoutProperties blp = box.getStaticBoxLayoutProperties();
    final long insetBottom = blp.getBorderBottom() + boxDefinition.getPaddingBottom();
    final long insetTop = blp.getBorderTop() + boxDefinition.getPaddingTop();

    final long usedHeight;
    RenderNode child = box.getFirstChild();
    // initialize with the values computed in the InfMajorStep
    long maxChildY2 = box.getCachedY() + box.getCachedHeight();
    if (child != null)
    {
      while (child != null)
      {
        maxChildY2 = Math.max(child.getCachedY() + child.getCachedHeight() + child.getEffectiveMarginBottom(),
            maxChildY2);

        child = child.getNext();
      }
      usedHeight = (maxChildY2 - (box.getCachedY() + insetTop));
    }
    else
    {
      usedHeight = 0;
    }

    final long rminH = minimumHeight.resolve(resolveSize, 0);
    final long rmaxH = maximumHeight.resolve(resolveSize, CanvasMajorAxisLayoutStep.MAX_AUTO);

    final long computedContentHeight;
    if (boxDefinition.isSizeSpecifiesBorderBox())
    {
      final long rprefH = preferredHeight.resolve(resolveSize, usedHeight + insetTop + insetBottom);
View Full Code Here

      // a preferred height may create overflowing childs, as it limits the height of the box to the defined value
      if (RenderLength.AUTO.equals(bdef.getPreferredHeight()))
      {
        // the check is only valid if there is no max height
        // a max height may create overflowing childs, as it limits the height of the box to the defined value
        final RenderLength maxHeight = bdef.getMaximumHeight();
        if (RenderLength.AUTO.equals(maxHeight) ||
            (maxHeight.isPercentage() == false && maxHeight.getValue() >= StrictGeomUtility.toInternalValue(
                Short.MAX_VALUE)))
        {
          final long childConsumedHeight = parentAvailableHeight - node.getCachedHeight();
          if (childConsumedHeight < 0)
          {
View Full Code Here

  {
    final StaticBoxLayoutProperties blp = box.getStaticBoxLayoutProperties();
    final BoxDefinition bdef = box.getBoxDefinition();

    final BoxDefinition boxDefinition = box.getBoxDefinition();
    final RenderLength minHeight = boxDefinition.getMinimumHeight();
    final RenderLength preferredHeight = boxDefinition.getPreferredHeight();
    final RenderLength maxHeight = boxDefinition.getMaximumHeight();

    final long insetsTop = (blp.getBorderTop() + bdef.getPaddingTop());
    final long insetsBottom = blp.getBorderBottom() + bdef.getPaddingBottom();
    final long insets = insetsTop + insetsBottom;

    final long parentHeight;
    final long usableParentHeight;
    if (heightResolvesToZero)
    {
      parentHeight = 0;
      usableParentHeight = 0;
    }
    else
    {
      parentHeight = Math.max(resolveParentHeight(box), box.getCachedHeight());
      usableParentHeight = resolveUseableParentHeight(box);
    }
    // find the maximum of the used height (for all childs) and the specified min-height.
    long consumedHeight = Math.max(box.getCachedHeight(),
        Math.min(minHeight.resolve(parentHeight), usableParentHeight));

    // The consumed height computed above specifies the size at the border-edge.
    // However, depending on the box-sizing property, we may have to resolve them against the
    // content-edge instead.

    if (box.isSizeSpecifiesBorderBox())
    {
      final long minHeightResolved = minHeight.resolve(parentHeight);
      final long maxHeightResolved = maxHeight.resolve(parentHeight);
      final long prefHeightResolved;
      if (RenderLength.AUTO.equals(preferredHeight))
      {
        prefHeightResolved = consumedHeight;
      }
      else
      {
        prefHeightResolved = preferredHeight.resolve(parentHeight);
      }

      final long height = ProcessUtility.computeLength(minHeightResolved, maxHeightResolved, prefHeightResolved);
      if (heightResolvesToZero)
        return height;
      return Math.min(height, usableParentHeight);
    }
    else
    {
      consumedHeight = Math.max(0, consumedHeight - insets);
      final long minHeightResolved = minHeight.resolve(parentHeight);
      final long maxHeightResolved = maxHeight.resolve(parentHeight);
      final long prefHeightResolved;
      if (RenderLength.AUTO.equals(preferredHeight))
      {
        prefHeightResolved = consumedHeight;
      }
View Full Code Here

  public static long computeWidthInternal(final RenderableReplacedContentBox contentBox,
                                          final long blockContextWidth)
  {
    final RenderableReplacedContent content = contentBox.getContent();
    final RenderLength requestedWidth = content.getRequestedWidth();
    final RenderLength requestedHeight = content.getRequestedHeight();
    if (RenderLength.AUTO.equals(requestedWidth))
    {
      // if width is auto, and height is auto,
      if (RenderLength.AUTO.equals(requestedHeight))
      {
        // use the intrinsic width ..
        return content.getContentWidth();
      }
      // if height is not auto, but the width is, then compute a width that
      // preserves the aspect ratio. (
      else
      {
        final long contentHeight = content.getContentHeight();
        if (contentHeight > 0)
        {
          final long height = requestedHeight.resolve(blockContextWidth);
          return height * contentBox.getComputedWidth() / contentHeight;
        }
        else
        {
          return 0;
View Full Code Here

  }

  private static long computeHeightInternal(final RenderableReplacedContent content,
                                            final long blockContextWidth, final long computedWidth)
  {
    final RenderLength requestedHeight = content.getRequestedHeight();
    if (RenderLength.AUTO.equals(content.getRequestedWidth()))
    {
      // if width is auto, and height is auto,
      if (RenderLength.AUTO.equals(requestedHeight))
      {
        final long contentWidth = content.getContentWidth();
        if (contentWidth > 0 && computedWidth != 0)
        {
          // Intrinsic height must be computed to preserve the aspect ratio.
          return computedWidth * content.getContentHeight() / contentWidth;
        }

        // use the intrinsic height ..
        return content.getContentHeight();
      }
      // if height is not auto, then use the declared height.
      else
      {
        // A percentage is now relative to the intrinsinc size.
        // And yes, I'm aware that this is not what the standard says ..
        return requestedHeight.resolve(blockContextWidth);
      }
    }
    else
    {
      // width is not auto.
      // If the height is auto, we have to preserve the aspect ratio ..
      if (RenderLength.AUTO.equals(requestedHeight))
      {
        final long contentWidth = content.getContentWidth();
        if (contentWidth > 0)
        {
          // Requested height must be computed to preserve the aspect ratio.
          return computedWidth * content.getContentHeight() / contentWidth;
        }
        else
        {
          return 0;
        }
      }
      else
      {
        // height is something fixed ..
        return requestedHeight.resolve(blockContextWidth);
      }
    }
  }
View Full Code Here

    final int breakIndicator = box.getManualBreakIndicator();

    // First check the simple cases:
    // If the box wants to break, then there's no point in waiting: Shift the box and continue.
    final RenderLength fixedPosition = box.getBoxDefinition().getFixedPosition();

    final long fixedPositionResolved = fixedPosition.resolve(pageHeight, 0);
    if (breakIndicator == RenderBox.DIRECT_MANUAL_BREAK || breakPending)
    {
      // find the next major break and shift the box to this position.
      // update the 'shift' to reflect this new change. Process the contents of this box as well, as the box may
      // have additional breaks inside (or may overflow, or whatever ..).
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.layout.model.RenderLength

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.