Examples of SheetLayout


Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

    }

    // Start a new page.
    try
    {
      final SheetLayout sheetLayout = contentProducer.getSheetLayout();
      final int columnCount = contentProducer.getColumnCount();
      if (table == null)
      {
        final int rowCount = contentProducer.getRowCount();
        table = new Table(columnCount, rowCount);
        table.setAutoFillEmptyCells(false);
        table.setWidth(100); // span the full page..
        // and finally the content ..

        final float[] cellWidths = new float[columnCount];
        for (int i = 0; i < columnCount; i++)
        {
          cellWidths[i] = (float) StrictGeomUtility.toExternalValue(sheetLayout.getCellWidth(i, i + 1));
        }
        table.setWidths(cellWidths);
      }

      //logger.debug ("Processing: " + startRow + " " + finishRow + " " + incremental);

      for (int row = startRow; row < finishRow; row++)
      {
        for (short col = 0; col < columnCount; col++)
        {
          final RenderBox content = contentProducer.getContent(row, col);
          final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);

          if (content == null)
          {
            final RenderBox backgroundBox = contentProducer.getBackground(row, col);
            final CellBackground background;
            if (backgroundBox != null)
            {
              background = cellBackgroundProducer.getBackgroundForBox
                  (logicalPage, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
            }
            else
            {
              background = cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
            }
            if (background == null)
            {
              // An empty cell .. ignore
              final PatchRtfCell cell = new PatchRtfCell();
              cell.setBorderWidth(0);
              cell.setMinimumHeight((float) StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row)));
              table.addCell(cell, row, col);
              continue;
            }

            // A empty cell with a defined background ..
            final PatchRtfCell cell = new PatchRtfCell();
            cell.setBorderWidth(0);
            cell.setMinimumHeight((float) StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row)));
            updateCellStyle(cell, background);
            table.addCell(cell, row, col);
            continue;
          }

          if (content.isCommited() == false)
          {
            throw new InvalidReportStateException("Uncommited content encountered");
          }

          final long contentOffset = contentProducer.getContentOffset(row, col);
          final long colPos = sheetLayout.getXPosition(col);
          final long rowPos = sheetLayout.getYPosition(row);
          if (content.getX() != colPos || (content.getY() + contentOffset) != rowPos)
          {
            // A spanned cell ..
            continue;
          }

          final int colSpan = sheetLayout.getColSpan(col, content.getX() + content.getWidth());
          final int rowSpan = sheetLayout.getRowSpan(row, content.getY() + content.getHeight() + contentOffset);

          final CellBackground realBackground = cellBackgroundProducer.getBackgroundForBox
              (logicalPage, sheetLayout, col, row, colSpan, rowSpan, false, sectionType, content);

          final PatchRtfCell cell = new PatchRtfCell();
          cell.setRowspan(rowSpan);
          cell.setColspan(colSpan);
          cell.setBorderWidth(0);
          cell.setMinimumHeight((float) StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row)));
          if (realBackground != null)
          {
            updateCellStyle(cell, realBackground);
          }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

      configureSheetPaperSize(sheet, logicalPage.getPageGrid().getPage(0, 0));
      configureSheetColumnWidths(sheet, contentProducer.getSheetLayout(), contentProducer.getColumnCount());
    }

    // and finally the content ..
    final SheetLayout sheetLayout = contentProducer.getSheetLayout();
    final int colCount = sheetLayout.getColumnCount();

    for (int row = startRow; row < finishRow; row++)
    {
      final Row hssfRow = getRowAt(row);
      final double lastRowHeight = StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row));
      hssfRow.setHeightInPoints((float) (lastRowHeight));

      for (int col = 0; col < colCount; col++)
      {
        final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
        final RenderBox content = contentProducer.getContent(row, col);

        if (content == null)
        {
          final RenderBox backgroundBox = contentProducer.getBackground(row, col);
          final CellBackground background;
          if (backgroundBox != null)
          {
            background = cellBackgroundProducer.getBackgroundForBox
                (logicalPage, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
          }
          else
          {
            background = cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
          }
          if (background == null)
          {
            if (row == 0 && col == 0)
            {
              // create a single cell, so that we dont run into nullpointer inside POI..
              getCellAt(col, row);
            }
            // An empty cell .. ignore
            continue;
          }

          // A empty cell with a defined background ..
          final Cell cell = getCellAt(col, row);
          final CellStyle style =
              getCellStyleProducer().createCellStyle(null, null, background);
          if (style != null)
          {
            cell.setCellStyle(style);
          }
          continue;
        }

        if (content.isCommited() == false)
        {
          throw new InvalidReportStateException("Uncommited content encountered");
        }

        final long contentOffset = contentProducer.getContentOffset(row, col);
        final TableRectangle rectangle = sheetLayout.getTableBounds
            (content.getX(), content.getY() + contentOffset,
                content.getWidth(), content.getHeight(), null);
        if (rectangle.isOrigin(col, row) == false)
        {
          // A spanned cell ..
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

                    final boolean incremental)
      throws ContentProcessingException
  {
    try
    {
      final SheetLayout sheetLayout = contentProducer.getSheetLayout();
      final int startRow = contentProducer.getFinishedRows();
      final int finishRow = contentProducer.getFilledRows();
      if (incremental && startRow == finishRow)
      {
        return;
      }

      DefaultHtmlContentGenerator contentGenerator = getContentGenerator();
      XmlWriter xmlWriter;

      if (documentContentItem == null)
      {
        this.cellBackgroundProducer = new CellBackgroundProducer
            (metaData.isFeatureSupported(AbstractTableOutputProcessor.TREAT_ELLIPSE_AS_RECTANGLE),
                metaData.isFeatureSupported(OutputProcessorFeature.UNALIGNED_PAGEBANDS));
        initialize(metaData.getConfiguration());

        documentContentItem = contentLocation.createItem(contentNameGenerator.generateName(null, "text/html"));

        this.writer = createWriterService(documentContentItem.getOutputStream());
        xmlWriter = writer.getXmlWriter();

        openSheet(logicalPage.getAttributes(), contentProducer.getSheetName(), metaData, sheetLayout, xmlWriter);
      }
      else
      {
        xmlWriter = writer.getXmlWriter();
      }

      final int colCount = sheetLayout.getColumnCount();
      final boolean emptyCellsUseCSS = getTagHelper().isEmptyCellsUseCSS();
      StyleBuilder styleBuilder = getStyleBuilder();
      DefaultStyleBuilderFactory styleBuilderFactory = getStyleBuilderFactory();

      if (textExtractor == null)
      {
        textExtractor = new HtmlTextExtractor(metaData, xmlWriter, contentGenerator, getTagHelper());
      }

      for (int row = startRow; row < finishRow; row++)
      {
        final int rowHeight = (int) StrictGeomUtility.toExternalValue(sheetLayout.getRowHeight(row));
        final HtmlRowBackgroundStruct struct = getCommonBackground(logicalPage, sheetLayout, row, contentProducer);
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "tr",
            getTagHelper().createRowAttributes(rowHeight, struct), XmlWriterSupport.OPEN);

        for (int col = 0; col < colCount; col++)
        {
          final RenderBox content = contentProducer.getContent(row, col);
          final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
          if (content == null)
          {
            final RenderBox backgroundBox = contentProducer.getBackground(row, col);
            final CellBackground background;
            if (backgroundBox != null)
            {
              background = cellBackgroundProducer.getBackgroundForBox
                  (logicalPage, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
            }
            else
            {
              background = cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
            }
            writeBackgroundCell(background, xmlWriter);
            continue;
          }

          if (content.isCommited() == false)
          {
            throw new InvalidReportStateException(
                "Uncommited content encountered: " + row + ", " + col + ' ' + content);
          }

          final long contentOffset = contentProducer.getContentOffset(row, col);

          final long colPos = sheetLayout.getXPosition(col);
          final long rowPos = sheetLayout.getYPosition(row);
          if (content.getX() != colPos || (content.getY() + contentOffset) != rowPos)
          {
            // A spanned cell ..
            if (content.isFinishedTable())
            {
              continue;
            }
          }

          final int colSpan = sheetLayout.getColSpan(col, content.getX() + content.getWidth());
          final int rowSpan = sheetLayout.getRowSpan(row, content.getY() + content.getHeight() + contentOffset);

          final CellBackground realBackground = cellBackgroundProducer.getBackgroundForBox
              (logicalPage, sheetLayout, col, row, colSpan, rowSpan, true, sectionType, content);

          final StyleBuilder cellStyle = styleBuilderFactory.createCellStyle(styleBuilder,
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

        writer = new PrintWriter(new OutputStreamWriter(out, encoding));
      }


      final SheetLayout sheetLayout = contentProducer.getSheetLayout();
      final int columnCount = contentProducer.getColumnCount();
      final int lastColumn = columnCount - 1;

      final int startRow = contentProducer.getFinishedRows();
      final int finishRow = contentProducer.getFilledRows();

      for (int row = startRow; row < finishRow; row++)
      {
        for (short col = 0; col < columnCount; col++)
        {
          final RenderBox content = contentProducer.getContent(row, col);
          if (content == null)
          {
            writer.print(quoter.getSeparator());
            continue;
          }

          if (content.isCommited() == false)
          {
            throw new InvalidReportStateException("Uncommited content encountered");
          }

          final long contentOffset = contentProducer.getContentOffset(row, col);
          final long colPos = sheetLayout.getXPosition(col);
          final long rowPos = sheetLayout.getYPosition(row);
          if (content.getX() != colPos || (content.getY() + contentOffset) != rowPos)
          {
            // A spanned cell ..
            writer.print(quoter.getSeparator());
            continue;
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

  }

  public void produceTemplate(final LogicalPageBox pageBox)
  {
    TableContentProducer contentProducer = TemplatingOutputProcessor.produceTableLayout(pageBox, sheetLayout, metaData);
    final SheetLayout sheetLayout = contentProducer.getSheetLayout();
    final int columnCount = contentProducer.getColumnCount();
    final int startRow = contentProducer.getFinishedRows();

    final int finishRow = contentProducer.getFilledRows();

    cellHeights = new long[finishRow - startRow];

    for (int row = startRow; row < finishRow; row++)
    {
      cellHeights[row - startRow] = sheetLayout.getRowHeight(row);

      for (short col = 0; col < columnCount; col++)
      {
        final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
        final RenderBox content = contentProducer.getContent(row, col);
        if (content == null)
        {
          final RenderBox backgroundBox = contentProducer.getBackground(row, col);
          final CellBackground background;
          if (backgroundBox != null)
          {
            background = cellBackgroundProducer.getBackgroundForBox
                (pageBox, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
          }
          else
          {
            background = cellBackgroundProducer.getBackgroundAt(pageBox, sheetLayout, col, row, true, sectionType);
          }
          if (background != null)
          {
            backgroundCells.add(new CellLayoutInfo(col, row, background));
          }
          continue;
        }

        if (content.isCommited() == false)
        {
          throw new InvalidReportStateException("Uncommited content encountered");
        }

        final long contentOffset = contentProducer.getContentOffset(row, col);
        final TableRectangle rect = sheetLayout.getTableBounds
            (content.getX(), content.getY() + contentOffset,
                content.getWidth(), content.getHeight(), null);
        if (rect.isOrigin(col, row) == false)
        {
          // A spanned cell ..
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

                         final ExpressionRuntime runtime, final boolean pagination)
  {
    OutputProcessorMetaData metaData = runtime.getProcessingContext().getOutputProcessorMetaData();
    if (pagination)
    {
      this.sharedSheetLayout = new SheetLayout(metaData);
      this.processor = new FastSheetLayoutProducer(sharedSheetLayout);
      this.processor.initialize(report, runtime, pagination);
    }
    else
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

  public void produceTemplate(final LogicalPageBox pageBox)
  {
    TableContentProducer contentProducer = TemplatingOutputProcessor.produceTableLayout(pageBox, sheetLayout, metaData);

    final SheetLayout sheetLayout = contentProducer.getSheetLayout();
    final int columnCount = contentProducer.getColumnCount();
    final int lastColumn = columnCount - 1;

    final int startRow = contentProducer.getFinishedRows();
    final int finishRow = contentProducer.getFilledRows();
    StringWriter swriter = new StringWriter();
    PrintWriter writer = new PrintWriter(swriter);

    for (int row = startRow; row < finishRow; row++)
    {
      for (short col = 0; col < columnCount; col++)
      {
        final RenderBox content = contentProducer.getContent(row, col);
        if (content == null)
        {
          writer.print(quoter.getSeparator());
          continue;
        }

        if (content.isCommited() == false)
        {
          throw new InvalidReportStateException("Uncommited content encountered");
        }

        final long contentOffset = contentProducer.getContentOffset(row, col);
        final TableRectangle rectangle = sheetLayout.getTableBounds
            (content.getX(), content.getY() + contentOffset,
                content.getWidth(), content.getHeight(), null);
        if (rectangle.isOrigin(col, row) == false)
        {
          // A spanned cell ..
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

                         final ExpressionRuntime runtime, final boolean pagination)
  {
    OutputProcessorMetaData metaData = runtime.getProcessingContext().getOutputProcessorMetaData();
    if (pagination)
    {
      this.sharedSheetLayout = new SheetLayout(metaData);
      this.processor = new FastSheetLayoutProducer(sharedSheetLayout);
      this.processor.initialize(report, runtime, pagination);
    }
    else
    {
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

  }

  public void produceTemplate(final LogicalPageBox pageBox)
  {
    TableContentProducer contentProducer = TemplatingOutputProcessor.produceTableLayout(pageBox, sheetLayout, metaData);
    final SheetLayout sheetLayout = contentProducer.getSheetLayout();
    final int columnCount = contentProducer.getColumnCount();
    final int startRow = contentProducer.getFinishedRows();

    final int finishRow = contentProducer.getFilledRows();

    gridLayout = new FastGridLayout();

    for (int row = startRow; row < finishRow; row++)
    {
      gridLayout.addRow(row - startRow, sheetLayout.getRowHeight(row));

      for (short col = 0; col < columnCount; col++)
      {
        final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
        final RenderBox content = contentProducer.getContent(row, col);
        if (content == null)
        {
          final RenderBox backgroundBox = contentProducer.getBackground(row, col);
          final CellBackground background;
          if (backgroundBox != null)
          {
            background = cellBackgroundProducer.getBackgroundForBox
                (pageBox, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
          }
          else
          {
            background = cellBackgroundProducer.getBackgroundAt(pageBox, sheetLayout, col, row, true, sectionType);
          }
          if (background != null)
          {
            gridLayout.addBackground(new CellLayoutInfo(col, row, background));
          }
          else
          {
            gridLayout.addBackground(new CellLayoutInfo(col, row, null));
          }
          continue;
        }

        if (content.isCommited() == false)
        {
          throw new InvalidReportStateException("Uncommited content encountered");
        }

        final long contentOffset = contentProducer.getContentOffset(row, col);
        final TableRectangle rect = sheetLayout.getTableBounds
            (content.getX(), content.getY() + contentOffset,
                content.getWidth(), content.getHeight(), null);
        if (rect.isOrigin(col, row) == false)
        {
          // A spanned cell ..
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.modules.output.table.base.SheetLayout

                         final boolean pagination)
  {
    OutputProcessorMetaData metaData = runtime.getProcessingContext().getOutputProcessorMetaData();
    if (pagination)
    {
      this.sharedSheetLayout = new SheetLayout(metaData);
      this.processor = new FastSheetLayoutProducer(sharedSheetLayout);
      this.processor.initialize(report, runtime, pagination);
    }
    else
    {
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.