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

Examples of org.pentaho.reporting.engine.classic.core.ElementAlignment


  {
    // Aligns elements with vertical-align TOP and vertical-align BOTTOM
    AlignContext child = box.getFirstChild();
    while (child != null)
    {
      final ElementAlignment verticalAlignment = child.getNode().getNodeLayoutProperties().getVerticalAlignment();
      if (ElementAlignment.TOP.equals(verticalAlignment))
      {
        final long childTopEdge = child.getBeforeEdge();
        final long parentTopEdge = lineBox.getBeforeEdge();
        child.shift(parentTopEdge - childTopEdge);
View Full Code Here


        return;
      }

      final double scaleFactor = computeImageScaleFactor();

      final ElementAlignment horizontalAlignment =
          (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.ALIGNMENT);
      final ElementAlignment verticalAlignment =
          (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.VALIGNMENT);

      final long internalImageWidth = StrictGeomUtility.toInternalValue(scaleFactor * imageWidth);
      final long internalImageHeight = StrictGeomUtility.toInternalValue(scaleFactor * imageHeight);

 
View Full Code Here

      final boolean value = style.getBooleanStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "avoid-page-break", String.valueOf(value));
    }
    if (style.isLocalKey(ElementStyleKeys.ALIGNMENT))
    {
      final ElementAlignment value = (ElementAlignment) style.getStyleProperty(ElementStyleKeys.ALIGNMENT);
      if (ElementAlignment.CENTER.equals(value))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "alignment", "center");
      }
      else if (ElementAlignment.RIGHT.equals(value))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "alignment", "right");
      }
      else if (ElementAlignment.JUSTIFY.equals(value))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "alignment", "justify");
      }
      else if (ElementAlignment.LEFT.equals(value))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "alignment", "left");
      }
    }
    if (style.isLocalKey(ElementStyleKeys.VALIGNMENT))
    {
      final ElementAlignment value = (ElementAlignment) style.getStyleProperty(ElementStyleKeys.VALIGNMENT);
      if (ElementAlignment.MIDDLE.equals(value))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "vertical-alignment", "middle");
      }
      else if (ElementAlignment.BOTTOM.equals(value))
View Full Code Here

    {
      // grab the node's y2
      if (computedContentHeight > usedHeight)
      {
        // we have extra space to distribute. So lets shift some boxes.
        final ElementAlignment valign = box.getNodeLayoutProperties().getVerticalAlignment();
        if (ElementAlignment.BOTTOM.equals(valign))
        {
          final long boxBottom = (box.getCachedY() + computedContentHeight - insetBottom);
          final long delta = boxBottom - childY2;
          CacheBoxShifter.shiftBoxChilds(box, delta);
View Full Code Here

    if (paragraphContext == null)
    {
      return -SAFETY_MARGIN;
    }

    ElementAlignment alignment;
    if (node.getNext() == null)
    {
      alignment = paragraphContext.getLastLineAlignment();
    }
    else
View Full Code Here

    if (paragraphContext == null)
    {
      return SAFETY_MARGIN;
    }

    ElementAlignment alignment;
    if (node.getNext() == null)
    {
      alignment = paragraphContext.getLastLineAlignment();
    }
    else
View Full Code Here

    }
  }

  private int mapAlignment(final RenderableComplexText node)
  {
    ElementAlignment alignment;
    if (node.getNext() == null)
    {
      alignment = paragraphContext.getLastLineAlignment();
    }
    else
View Full Code Here

        }
      }

      final int clipWidth = Math.min(width, (int) Math.ceil(deviceScaleFactor * imageWidth));
      final int clipHeight = Math.min(height, (int) Math.ceil(deviceScaleFactor * imageHeight));
      final ElementAlignment horizontalAlignment =
          (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.ALIGNMENT);
      final ElementAlignment verticalAlignment =
          (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.VALIGNMENT);
      final int alignmentX = (int) RenderUtility.computeHorizontalAlignment(horizontalAlignment, width, clipWidth);
      final int alignmentY = (int) RenderUtility.computeVerticalAlignment(verticalAlignment, height, clipHeight);

      g2 = (Graphics2D) getGraphics().create();
      g2.clip(drawAreaBounds);
      g2.translate(x, y);
      g2.translate(alignmentX, alignmentY);
      g2.clip(new Rectangle2D.Float(0, 0, clipWidth, clipHeight));
      g2.scale(deviceScaleFactor, deviceScaleFactor);

      scaleTransform = null;
    }
    else
    {
      g2 = (Graphics2D) getGraphics().create();
      g2.clip(drawAreaBounds);
      g2.translate(x, y);
      g2.clip(new Rectangle2D.Float(0, 0, width, height));

      final double scaleX;
      final double scaleY;

      final boolean keepAspectRatio = layoutContext.getBooleanStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO);
      if (keepAspectRatio)
      {
        final double scaleFactor = Math.min(width / (double) imageWidth, height / (double) imageHeight);
        scaleX = scaleFactor;
        scaleY = scaleFactor;
      }
      else
      {
        scaleX = width / (double) imageWidth;
        scaleY = height / (double) imageHeight;
      }

      final int clipWidth = (int) (scaleX * imageWidth);
      final int clipHeight = (int) (scaleY * imageHeight);

      final ElementAlignment horizontalAlignment =
          (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.ALIGNMENT);
      final ElementAlignment verticalAlignment =
          (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.VALIGNMENT);
      final int alignmentX = (int) RenderUtility.computeHorizontalAlignment(horizontalAlignment, width, clipWidth);
      final int alignmentY = (int) RenderUtility.computeVerticalAlignment(verticalAlignment, height, clipHeight);

      g2.translate(alignmentX, alignmentY);
View Full Code Here

    }

    if (align)
    {
      child = box.getFirstChild();
      final ElementAlignment valign = box.getNodeLayoutProperties().getVerticalAlignment();
      final long boxY1 = box.getCachedY() + insetTop;
      final long boxY2 = boxY1 + computedContentHeight;
      while (child != null)
      {
        final long childY1 = child.getCachedY();
View Full Code Here

      if (fontSize != null)
      {
        attList.setAttribute(WizardCoreModule.NAMESPACE, "font-size", String.valueOf(fontSize));
      }
      final ElementAlignmentValueConverter elementAlignmentValueConverter = new ElementAlignmentValueConverter();
      final ElementAlignment horizontalAlignment = definition.getHorizontalAlignment();
      if (horizontalAlignment != null)
      {
        attList.setAttribute(WizardCoreModule.NAMESPACE, "horizontal-align",
            elementAlignmentValueConverter.toAttributeValue(horizontalAlignment));
      }
      final ElementAlignment verticalAlignment = definition.getVerticalAlignment();
      if (verticalAlignment != null)
      {
        attList.setAttribute(WizardCoreModule.NAMESPACE, "vertical-align",
            elementAlignmentValueConverter.toAttributeValue(verticalAlignment));
      }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.ElementAlignment

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.