Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JRLineBox


   
    frame.setMode(cell.getModeValue());
    frame.setBackcolor(cell.getBackcolor());
    frame.setStyle(reportConverter.resolveStyle(cell));
   
    JRLineBox box = cell.getLineBox();
    if (box != null)
    {
      frame.copyBox(box);
     
      boolean copyLeft = left && box.getLeftPen().getLineWidth().floatValue() <= 0f && box.getRightPen().getLineWidth().floatValue() > 0f;
      boolean copyRight = right && box.getRightPen().getLineWidth().floatValue() <= 0f && box.getLeftPen().getLineWidth().floatValue() > 0f;
      boolean copyTop = top && box.getTopPen().getLineWidth().floatValue() <= 0f && box.getBottomPen().getLineWidth().floatValue() > 0f;
     
      if (copyLeft)
      {
        ((JRBaseLineBox)frame.getLineBox()).copyLeftPen(box.getRightPen());
      }
     
      if (copyRight)
      {
        ((JRBaseLineBox)frame.getLineBox()).copyRightPen(box.getLeftPen());
      }
     
      if (copyTop)
      {
        ((JRBaseLineBox)frame.getLineBox()).copyTopPen(box.getBottomPen());
      }
    }
   
//    List children = cell.getChildren();
//    if (children != null)
View Full Code Here


   */
  public static class Right extends JRPenFactory
  {
    public Object createObject(Attributes atts)
    {
      JRLineBox box = (JRLineBox) digester.peek();
      setPenAttributes(atts, box.getRightPen());
      return box;
    }
View Full Code Here

      hash = computeHash();
    }

    public BoxStyle(JRExporterGridCell gridCell)
    {
      JRLineBox lineBox = gridCell.getBox();
      if (lineBox != null)
      {
        setBox(lineBox);
      }
      JRPrintElement element = gridCell.getElement();
View Full Code Here

  /**
   *
   */
  protected void exportLine(TableBuilder tableBuilder, JRPrintLine line, JRExporterGridCell gridCell) throws IOException
  {
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = null;
    float ratio = line.getWidth() / line.getHeight();
    if (ratio > 1)
    {
      if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
      {
        pen = box.getTopPen();
      }
      else
      {
        pen = box.getBottomPen();
      }
    }
    else
    {
      if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
      {
        pen = box.getLeftPen();
      }
      else
      {
        pen = box.getRightPen();
      }
    }
    pen.setLineColor(line.getLinePen().getLineColor());
    pen.setLineStyle(line.getLinePen().getLineStyleValue());
    pen.setLineWidth(line.getLinePen().getLineWidth());
View Full Code Here

  /**
   *
   */
  protected void exportEllipse(TableBuilder tableBuilder, JRPrintEllipse ellipse, JRExporterGridCell gridCell) throws IOException
  {
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = box.getPen();
    pen.setLineColor(ellipse.getLinePen().getLineColor());
    pen.setLineStyle(ellipse.getLinePen().getLineStyleValue());
    pen.setLineWidth(ellipse.getLinePen().getLineWidth());

    gridCell.setBox(box);//CAUTION: only some exporters set the cell box
View Full Code Here

  protected void appendSizeStyle(JRPrintElement element, JRBoxContainer boxContainer, StringBuffer styleBuffer)
  {
    int widthDiff = 0;
    int heightDiff = 0;

    JRLineBox box = boxContainer == null ? null :  boxContainer.getLineBox();
    if (box != null)
    {
      widthDiff =
        box.getLeftPadding().intValue() + box.getRightPadding().intValue()
        + getInsideBorderOffset(box.getLeftPen().getLineWidth().floatValue())
        + getInsideBorderOffset(box.getRightPen().getLineWidth().floatValue());
      heightDiff =
        box.getTopPadding().intValue() + box.getBottomPadding().intValue()
        + getInsideBorderOffset(box.getTopPen().getLineWidth().floatValue())
        + getInsideBorderOffset(box.getBottomPen().getLineWidth().floatValue());
    }
   
    styleBuffer.append("width:");
    styleBuffer.append(toSizeUnit(element.getWidth() - widthDiff));
    styleBuffer.append(";");
View Full Code Here

          int leftDiff = 0;
          int topDiff = 0;
          int widthDiff = 0;
          int heightDiff = 0;

          JRLineBox box = image.getLineBox();
          if (box != null)
          {
            leftDiff = box.getLeftPadding().intValue();
            topDiff = box.getTopPadding().intValue();
            widthDiff =
              getInsideBorderOffset(box.getLeftPen().getLineWidth().floatValue())
              + getInsideBorderOffset(box.getRightPen().getLineWidth().floatValue());
            heightDiff =
              getInsideBorderOffset(box.getTopPen().getLineWidth().floatValue())
              + getInsideBorderOffset(box.getBottomPen().getLineWidth().floatValue());
          }
         
          writer.write(" style=\"position:absolute;left:");
          writer.write(toSizeUnit(leftDiff));
          writer.write(";top:");
          writer.write(toSizeUnit(topDiff));
          writer.write(";width:");
          writer.write(toSizeUnit(availableImageWidth - widthDiff));
          writer.write(";height:");
          writer.write(toSizeUnit(availableImageHeight - heightDiff));
          writer.write("\"");
   
          break;
        }
        case CLIP :
        {
          double normalWidth = availableImageWidth;
          double normalHeight = availableImageHeight;
   
          if (!image.isLazy())
          {
            // Image load might fail.
            JRRenderable tmpRenderer =
              JRImageRenderer.getOnErrorRendererForDimension(renderer, image.getOnErrorTypeValue());
            Dimension2D dimension = tmpRenderer == null ? null : tmpRenderer.getDimension();
            // If renderer was replaced, ignore image dimension.
            if (tmpRenderer == renderer && dimension != null)
            {
              normalWidth = dimension.getWidth();
              normalHeight = dimension.getHeight();
            }
          }

          int leftDiff = 0;
          int topDiff = 0;
          int widthDiff = 0;
          int heightDiff = 0;

          JRLineBox box = image.getLineBox();
          if (box != null)
          {
            leftDiff = box.getLeftPadding().intValue();
            topDiff = box.getTopPadding().intValue();
            widthDiff =
              getInsideBorderOffset(box.getLeftPen().getLineWidth().floatValue())
              + getInsideBorderOffset(box.getRightPen().getLineWidth().floatValue());
            heightDiff =
              getInsideBorderOffset(box.getTopPen().getLineWidth().floatValue())
              + getInsideBorderOffset(box.getBottomPen().getLineWidth().floatValue());
          }
         
          writer.write(" style=\"position:absolute;left:");
          writer.write(toSizeUnit((int)(leftDiff + xAlignFactor * (availableImageWidth - widthDiff - normalWidth))));
          writer.write(";top:");
          writer.write(toSizeUnit((int)(topDiff + yAlignFactor * (availableImageHeight - heightDiff - normalHeight))));
          writer.write(";width:");
          writer.write(toSizeUnit((int)normalWidth));
          writer.write(";height:");
          writer.write(toSizeUnit((int)normalHeight));
          writer.write(";clip:rect(");
          writer.write(toSizeUnit((int)(yAlignFactor * (normalHeight - availableImageHeight + heightDiff))));
          writer.write(",");
          writer.write(toSizeUnit((int)(xAlignFactor * normalWidth + (1 - xAlignFactor) * (availableImageWidth - widthDiff))));
          writer.write(",");
          writer.write(toSizeUnit((int)(yAlignFactor * normalHeight + (1 - yAlignFactor) * (availableImageHeight - heightDiff))));
          writer.write(",");
          writer.write(toSizeUnit((int)(xAlignFactor * (normalWidth - availableImageWidth + widthDiff))));
          writer.write(")\"");

          break;
        }
        case RETAIN_SHAPE :
        default :
        {
          double normalWidth = availableImageWidth;
          double normalHeight = availableImageHeight;
   
          if (!image.isLazy())
          {
            // Image load might fail.
            JRRenderable tmpRenderer =
              JRImageRenderer.getOnErrorRendererForDimension(renderer, image.getOnErrorTypeValue());
            Dimension2D dimension = tmpRenderer == null ? null : tmpRenderer.getDimension();
            // If renderer was replaced, ignore image dimension.
            if (tmpRenderer == renderer && dimension != null)
            {
              normalWidth = dimension.getWidth();
              normalHeight = dimension.getHeight();
            }
          }
   
          int leftDiff = 0;
          int topDiff = 0;
          int widthDiff = 0;
          int heightDiff = 0;

          JRLineBox box = image.getLineBox();
          if (box != null)
          {
            leftDiff = box.getLeftPadding().intValue();
            topDiff = box.getTopPadding().intValue();
            widthDiff =
              getInsideBorderOffset(box.getLeftPen().getLineWidth().floatValue())
              + getInsideBorderOffset(box.getRightPen().getLineWidth().floatValue());
            heightDiff =
              getInsideBorderOffset(box.getTopPen().getLineWidth().floatValue())
              + getInsideBorderOffset(box.getBottomPen().getLineWidth().floatValue());
          }
         
          if (availableImageHeight > 0)
          {
            double ratio = normalWidth / normalHeight;
View Full Code Here

        int topPadding = 0;
        int leftPadding = 0;
        int bottomPadding = 0;
        int rightPadding = 0;

        JRLineBox box = contents.getLineBox();
        if (box != null)
        {
          topPadding = box.getTopPadding().intValue();
          leftPadding = box.getLeftPadding().intValue();
          bottomPadding = box.getBottomPadding().intValue();
          rightPadding = box.getRightPadding().intValue();
        }

        int cellWidth = contents.getWidth();
        boolean widthCalculated = cellWidth != JRCellContents.NOT_CALCULATED;
        int avlblWidth = cellWidth - leftPadding - rightPadding;
View Full Code Here

      boolean allowRowResize = false;
      int maxBottomPadding = 0; //for some strange reason, the bottom margin affects the row height; subtracting it here
      for(int col = 0; col < grid[0].length; col++)
      {
        JRExporterGridCell gridCell = grid[row][col];
        JRLineBox box = gridCell.getBox();
        if (
          box != null
          && box.getBottomPadding() != null
          && maxBottomPadding < box.getBottomPadding().intValue()
          )
        {
          maxBottomPadding = box.getBottomPadding().intValue();
        }
       
        allowRowResize =
          flexibleRowHeight
          && (allowRowResize
View Full Code Here

  /**
   *
   */
  protected void exportLine(DocxTableHelper tableHelper, JRPrintLine line, JRExporterGridCell gridCell)
  {
    JRLineBox box = new JRBaseLineBox(null);
    JRPen pen = null;
    float ratio = line.getWidth() / line.getHeight();
    if (ratio > 1)
    {
      if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
      {
        pen = box.getTopPen();
      }
      else
      {
        pen = box.getBottomPen();
      }
    }
    else
    {
      if (line.getDirectionValue() == LineDirectionEnum.TOP_DOWN)
      {
        pen = box.getLeftPen();
      }
      else
      {
        pen = box.getRightPen();
      }
    }
    pen.setLineColor(line.getLinePen().getLineColor());
    pen.setLineStyle(line.getLinePen().getLineStyleValue());
    pen.setLineWidth(line.getLinePen().getLineWidth());
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JRLineBox

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.