Package org.pentaho.reporting.engine.classic.core.modules.output.table.base

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


        final RenderBox content = contentProducer.getContent(row, col);
        final int sectionType = contentProducer.getSectionType(row, col);

        if (content == null)
        {
          final CellBackground background = cellBackgroundProducer.getBackgroundAt
              (logicalPage, sheetLayout, col, row, true, sectionType);
          if (background == null)
          {
            xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "empty-cell", XmlWriter.CLOSE);
            continue;
          }

          // A empty cell with a defined background ..
          xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "empty-cell", createCellAttributes(background), XmlWriter.CLOSE);
          continue;
        }

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

        final TableRectangle rectangle = sheetLayout.getTableBounds
            (content.getX(), content.getY(), content.getWidth(), content.getHeight(), null);
        if (rectangle.isOrigin(col, row) == false)
        {
          // A spanned cell ..
          xmlWriter.writeTag(LAYOUT_OUTPUT_NAMESPACE, "spanned-cell", XmlWriter.CLOSE);
          continue;
        }

        final CellBackground realBackground = cellBackgroundProducer.getBackgroundAt
            (logicalPage, sheetLayout, rectangle.getX1(), rectangle.getY1(),
                rectangle.getColumnSpan(), rectangle.getRowSpan(), true, sectionType);

        final AttributeList attributeList;
        if (realBackground != null)
View Full Code Here


        if (content == null)
        {
          final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
          final RenderBox backgroundBox = contentProducer.getBackground(row, col);
          final CellBackground background;
          if (backgroundBox != null)
          {
            background = cellBackgroundProducer.getBackgroundForBox
                (logicalPageBox, sheetLayout, col, row, 1, 1, true, sectionType, backgroundBox);
          }
          else
          {
            background = cellBackgroundProducer.getBackgroundAt(logicalPageBox, sheetLayout, col, row, true, sectionType);
          }
          if (background == null)
          {
            xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "empty-cell", XmlWriter.CLOSE);
            continue;
          }

          // A empty cell with a defined background ..
          xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "empty-cell", createCellAttributes(background),
              XmlWriter.OPEN);

          writeAttributes(background.getAttributes(), background.getElementType());
          xmlWriter.writeCloseTag();
          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 ..
          xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "spanned-cell", XmlWriter.CLOSE);
          continue;
        }

        final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
        final CellBackground realBackground = cellBackgroundProducer.getBackgroundForBox
            (logicalPageBox, sheetLayout, rectangle.getX1(), rectangle.getY1(), rectangle.getColumnSpan(),
                rectangle.getRowSpan(), false, sectionType, content);

        final AttributeList attributeList;
        if (realBackground != null)
View Full Code Here

          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);
View Full Code Here

        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 ..
          continue;
        }

        final CellBackground fastBackground = cellBackgroundProducer.getBackgroundForBox
            (logicalPage, sheetLayout, rectangle.getX1(), rectangle.getY1(),
                rectangle.getColumnSpan(), rectangle.getRowSpan(), false, sectionType, content);
        // export the cell and all content ..

        final Cell cell = getCellAt(col, row);
View Full Code Here

    for (int spannedRow = 0; spannedRow < rowSpan; spannedRow += 1)
    {
      for (int spannedCol = 0; spannedCol < columnSpan; spannedCol += 1)
      {
        final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
        final CellBackground bg = cellBackgroundProducer.getBackgroundForBox
            (logicalPage, sheetLayout, rectX + spannedCol, rectY + spannedRow, 1, 1, false, sectionType, content);
        final Cell regionCell = getCellAt((col + spannedCol), row + spannedRow);
        final CellStyle spannedStyle =
            getCellStyleProducer().createCellStyle(content.getInstanceId(), content.getStyleSheet(), bg);
        if (spannedStyle != null)
View Full Code Here

    final int columnCount = sheetLayout.getColumnCount();
    for (int col = 0; col < columnCount; col += 1)
    {
      final CellMarker.SectionType sectionType = tableContentProducer.getSectionType(row, col);
      final RenderBox content = tableContentProducer.getContent(row, col);
      final CellBackground backgroundAt;
      if (content == null)
      {
        final RenderBox background = tableContentProducer.getBackground(row, col);
        if (background != null)
        {
          backgroundAt = cellBackgroundProducer.getBackgroundForBox
              (logicalPageBox, sheetLayout, col, row, 1, 1, false, sectionType, background);
        }
        else
        {
          backgroundAt = cellBackgroundProducer.getBackgroundAt(logicalPageBox, sheetLayout, col, row, false, sectionType);
        }
      }
      else
      {
        final long contentOffset = tableContentProducer.getContentOffset(row, col);
        final int colSpan = sheetLayout.getColSpan(col, content.getX() + content.getWidth());
        final int rowSpan = sheetLayout.getRowSpan(row, content.getY() + content.getHeight() + contentOffset);
        backgroundAt = cellBackgroundProducer.getBackgroundForBox
            (logicalPageBox, sheetLayout, col, row, colSpan, rowSpan, false, sectionType, content);
      }
      if (backgroundAt == null)
      {
        HtmlRowBackgroundStruct struct = new HtmlRowBackgroundStruct();
        struct.fail();
        return struct;
      }

      boolean fail = false;
      if (col == 0)
      {
        color = backgroundAt.getBackgroundColor();
        topEdge = backgroundAt.getTop();
        bottomEdge = backgroundAt.getBottom();
      }
      else
      {
        if (ObjectUtilities.equal(color, backgroundAt.getBackgroundColor()) == false)
        {
          fail = true;
        }
        if (ObjectUtilities.equal(topEdge, backgroundAt.getTop()) == false)
        {
          fail = true;
        }
        if (ObjectUtilities.equal(bottomEdge, backgroundAt.getBottom()) == false)
        {
          fail = true;
        }
      }

      if (BorderCorner.EMPTY.equals(backgroundAt.getBottomLeft()) == false)
      {
        fail = true;
      }
      if (BorderCorner.EMPTY.equals(backgroundAt.getBottomRight()) == false)
      {
        fail = true;
      }
      if (BorderCorner.EMPTY.equals(backgroundAt.getTopLeft()) == false)
      {
        fail = true;
      }
      if (BorderCorner.EMPTY.equals(backgroundAt.getTopRight()) == false)
      {
        fail = true;
      }
      if (fail)
      {
View Full Code Here

          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,
              content.getStyleSheet(), content.getBoxDefinition(), realBackground, null, null);
          final AttributeList cellAttributes = getTagHelper().createCellAttributes
              (colSpan, rowSpan, content.getAttributes(), content.getStyleSheet(), realBackground, cellStyle);
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.OPEN);

          final Object rawContent = content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
              AttributeNames.Html.EXTRA_RAW_CONTENT);
          if (rawContent != null)
          {
            xmlWriter.writeText(String.valueOf(rawContent));
          }

          if (realBackground != null)
          {
            final String[] anchors = realBackground.getAnchors();
            for (int i = 0; i < anchors.length; i++)
            {
              final String anchor = anchors[i];
              xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor, XmlWriterSupport.CLOSE);
            }
View Full Code Here

      {
        for (col = 0; col < getColumnCount(); col++)
        {
          final ResultCell resultCell = getResultCell(row, col);
          final CellMarker.SectionType sectionType = tableContentProducer.getSectionType(row, col);
          final CellBackground backgroundAt =
              cellBackgroundProducer.getBackgroundAt(logicalPageBox, sheetLayout, col, row, true, sectionType);
          if (resultCell == null)
          {
            assertEmptyBackground(backgroundAt);
          }
View Full Code Here

        {
          final RenderBox content = contentProducer.getContent(row, col);
          final CellMarker.SectionType sectionType = contentProducer.getSectionType(row, col);
          if (content == null)
          {
            final CellBackground bg =
                cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
            if (bg == null)
            {
              writer.writeTag(null, "empty-cell", XmlWriter.CLOSE);
            }
            else
            {
              final AttributeList attList = computeCellAttributes(bg);
              writer.writeTag(null, "cell", attList, XmlWriter.CLOSE);
            }
            continue;
          }

          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.writeTag(null, "covered-cell", XmlWriter.CLOSE);
            continue;
          }

          final CellBackground bg =
              cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
          final AttributeList attList = computeCellAttributes(bg);
          writer.writeTag(null, "cell", attList, XmlWriter.CLOSE);
        }
        writer.writeCloseTag();
View Full Code Here

        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 ..
          continue;
        }

        final CellBackground bg = cellBackgroundProducer.getBackgroundForBox(pageBox, sheetLayout,
            rect.getX1(), rect.getY1(), rect.getColumnSpan(), rect.getRowSpan(), false, sectionType, content);
        layout.put(content.getInstanceId(), new CellLayoutInfo(rect, bg));
        content.setFinishedTable(true);
      }
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.modules.output.table.base.CellBackground

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.