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

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


  private LayoutResult lastValidateResult;

  protected AbstractRenderer(final OutputProcessor outputProcessor)
  {
    final BoxDefinition boxDefinition = new BoxDefinition();
    boxDefinition.setPreferredHeight(new RenderLength(100000, true));
    this.watermarkBoxDefinition = boxDefinition.lock();

    this.outputProcessor = outputProcessor;
    this.metaData = outputProcessor.getMetaData();
    this.normalFlowLayoutBuilder = createNormalFlowLayoutBuilder(metaData);
View Full Code Here


  public static 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

  private 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 * blockContextWidth / 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

  private static long resolveNodeWidthOnStartInternal(final RenderBox box,
                                                      final MinorAxisNodeContext nodeContext)
  {
    final long minChunkWidth = 0;
    final BoxDefinition boxDef = box.getBoxDefinition();
    final RenderLength minLength = boxDef.getMinimumWidth();
    final RenderLength prefLength = boxDef.getPreferredWidth();
    final RenderLength maxLength = boxDef.getMaximumWidth();

    final long bcw = nodeContext.getBlockContextWidth();
    final long min = minLength.resolve(bcw, 0);
    final long max = maxLength.resolve(bcw, ComputeStaticPropertiesProcessStep.MAX_AUTO);
    if (box.getBoxDefinition().isSizeSpecifiesBorderBox())
    {
      final long parentSize = nodeContext.getResolvedPreferredSize();
      // We are assuming that any size specified by the user already includes the padding and borders.
      // min-chunk-width must take insets into account. We will not add the insets to the computed width.
View Full Code Here

  private static long resolveNodeWidthOnStartForCanvasLegacyInternal(final RenderBox box,
                                                                     final MinorAxisNodeContext nodeContext)
  {
    final long minChunkWidth = 0;
    final BoxDefinition boxDef = box.getBoxDefinition();
    final RenderLength definedMinLength = boxDef.getMinimumWidth();

    final RenderLength minLength;
    if (definedMinLength.getValue() == 0)
    {
      // PRD-3857 - Auto-correcting min-size to 100% for zero-defined boxes that are not canvas
      // blows up the min-chunk-width test
      minLength = FULL_WIDTH_LENGTH;
    }
    else
    {
      minLength = definedMinLength;
    }

    final RenderLength prefLength = boxDef.getPreferredWidth();
    final RenderLength maxLength = boxDef.getMaximumWidth();

    final long bcw = nodeContext.getBlockContextWidth();
    final long min = minLength.resolve(bcw, 0);
    final long max = maxLength.resolve(bcw, ComputeStaticPropertiesProcessStep.MAX_AUTO);
    if (box.getBoxDefinition().isSizeSpecifiesBorderBox())
    {
      final long parentSize = nodeContext.getResolvedPreferredSize();
      // We are assuming that any size specified by the user already includes the padding and borders.
      // min-chunk-width must take insets into account. We will not add the insets to the computed width.
View Full Code Here

    {
      return nodeContext.getWidth();
    }

    final long minChunkWidth;
    final RenderLength minLength;
    if (strictLegacyMode == false || box.useMinimumChunkWidth())
    {
      minChunkWidth = nodeContext.getMaxChildX2() - nodeContext.getX1();
      minLength = boxDef.getMinimumWidth();
    }
    else
    {
      minChunkWidth = nodeContext.getX2() - nodeContext.getX1();
      if (boxDef.getMinimumWidth().getValue() == 0)
      {
        minLength = FULL_WIDTH_LENGTH;
      }
      else
      {
        minLength = boxDef.getMinimumWidth();
      }
    }

    final RenderLength maxLength = boxDef.getMaximumWidth();

    final long bcw = nodeContext.getBlockContextWidth();
    final long min = minLength.resolve(bcw, 0);
    final long max = maxLength.resolve(bcw, ComputeStaticPropertiesProcessStep.MAX_AUTO);
    if (box.getBoxDefinition().isSizeSpecifiesBorderBox())
    {
      final long parentSize = nodeContext.getResolvedPreferredSize();
      // We are assuming that any size specified by the user already includes the padding and borders.
      // min-chunk-width must take insets into account. We will not add the insets to the computed width.
View Full Code Here

   * @return
   */
  public static long resolveNodeWidthForMinChunkCalculation(final RenderBox 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(0, 0);
    final long max = maxLength.resolve(0, ComputeStaticPropertiesProcessStep.MAX_AUTO);
    if (box.getBoxDefinition().isSizeSpecifiesBorderBox())
    {
      // We are assuming that any size specified by the user already includes the padding and borders.
      // min-chunk-width must take insets into account. We will not add the insets to the computed width.
      final long pref = prefLength.resolve(0, box.getInsets());
View Full Code Here

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

    // Check the height. Set the height.
    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();
      if (lastChildNode.isVisible())
      {
        childY2 = lastChildNode.getCachedY() + lastChildNode.getCachedHeight() + lastChildNode.getEffectiveMarginBottom();
      }
      else
      {
        childY2 = lastChildNode.getCachedY();
      }
      usedHeight = (childY2 - childY1);
    }
    else
    {
      usedHeight = 0;
      childY2 = 0;
      childY1 = 0;
    }

    //final long blockContextWidth = box.getStaticBoxLayoutProperties().getBlockContextWidth();
    final long rminH = minimumHeight.resolve(resolveSize, 0);
    final long rmaxH = maximumHeight.resolve(resolveSize, InfiniteMajorAxisLayoutStep.MAX_AUTO);

    final StaticBoxLayoutProperties blp = box.getStaticBoxLayoutProperties();
    final long insetBottom = blp.getBorderBottom() + boxDefinition.getPaddingBottom();
    final long insetTop = blp.getBorderTop() + boxDefinition.getPaddingTop();
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();

    // usedHeight already contains the insetsTop ..
    final long usedHeight;
    RenderNode child = box.getFirstChild();
    if (child != null)
    {
      long maxChildY2 = 0;
      while (child != null)
      {
        if (child.isVisible())
        {
          final long childY2 = child.getCachedY() + child.getCachedHeight() + child.getEffectiveMarginBottom();
          maxChildY2 = Math.max(childY2, maxChildY2);
        }
        child = child.getNext();
      }
      usedHeight = (maxChildY2 - box.getCachedY());
    }
    else
    {
      usedHeight = insetTop;
    }

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

    final long computedHeight; // always the height of the content box
    if (boxDefinition.isSizeSpecifiesBorderBox())
    {
      final long rprefH = preferredHeight.resolve(resolveSize, usedHeight + insetBottom);
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.