Examples of RenderLength


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

  {
    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

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

  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

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

  }

  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

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

    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

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

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

  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

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

  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

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

  }

  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

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

  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

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

  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
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.