Examples of CellBackground


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

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

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

      {
        writer.writeTag(null, "row", XmlWriter.OPEN);
        for (int col = 0; col < cols; col++)
        {
          final int sectionType = tableContentProducer.getSectionType(row, col);
          final CellBackground bg =
              cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, true, sectionType);
          if (bg == null)
          {
            writer.writeTag(null, "empty-cell", XmlWriter.CLOSE);
            continue;
          }

          if (bg.isOrigin() == false)
          {
            // A spanned cell ..
            writer.writeTag(null, "covered-cell", XmlWriter.CLOSE);
            continue;
          }

          final AttributeList attList = new AttributeList();
          final ReportAttributeMap attrs = bg.getAttributes();
          final Object nameAttr = attrs.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME);
          if (nameAttr instanceof String)
          {
            attList.setAttribute(null, "content-idref",
                (String) nameAttr);
          }

          final String[] anchors = bg.getAnchors();
          if (anchors != null)
          {
            final StringBuffer anchor = new StringBuffer(100);
            for (int i = 0; i < anchors.length; i++)
            {
              if (i != 0)
              {
                anchor.append(", ");
              }
              anchor.append(anchors[i]);

            }
            attList.setAttribute(null, "anchor", anchor.toString());
          }
          if (bg.getBackgroundColor() != null)
          {
            attList.setAttribute(null, "background-color", ColorValueConverter.colorToString(bg.getBackgroundColor()));
          }

//          if (bg.getVerticalAlignment() != null)
//          {
//            attList.setAttribute(null, "vertical-alignment", String.valueOf(bg.getVerticalAlignment()));
//          }
//
          final BorderEdge top = bg.getTop();
          if (top != null)
          {
            attList.setAttribute(null, "border-top-color",
                ColorValueConverter.colorToString(top.getColor()));
            attList.setAttribute(null, "border-top-width",
                String.valueOf(StrictGeomUtility.toExternalValue(top.getWidth())));
            attList.setAttribute(null, "border-top-style",
                String.valueOf(top.getBorderStyle()));
          }

          final BorderEdge left = bg.getLeft();
          if (left != null)
          {
            attList.setAttribute(null, "border-left-color",
                ColorValueConverter.colorToString(left.getColor()));
            attList.setAttribute(null, "border-left-width",
                String.valueOf(StrictGeomUtility.toExternalValue(left.getWidth())));
            attList.setAttribute(null, "border-left-style",
                String.valueOf(left.getBorderStyle()));
          }

          final BorderEdge bottom = bg.getBottom();
          if (bottom != null)
          {
            attList.setAttribute(null, "border-bottom-color",
                ColorValueConverter.colorToString(bottom.getColor()));
            attList.setAttribute(null, "border-bottom-width",
                String.valueOf(StrictGeomUtility.toExternalValue(bottom.getWidth())));
            attList.setAttribute(null, "border-bottom-style",
                String.valueOf(bottom.getBorderStyle()));
          }

          final BorderEdge right = bg.getRight();
          if (right != null)
          {
            attList.setAttribute(null, "border-right-color",
                ColorValueConverter.colorToString(right.getColor()));
            attList.setAttribute(null, "border-right-width",
                String.valueOf(StrictGeomUtility.toExternalValue(right.getWidth())));
            attList.setAttribute(null, "border-right-style",
                String.valueOf(right.getBorderStyle()));
          }

          final BorderCorner topLeft = bg.getTopLeft();
          if (topLeft != null)
          {
            attList.setAttribute(null, "border-top-left-x",
                String.valueOf(StrictGeomUtility.toExternalValue(topLeft.getWidth())));
            attList.setAttribute(null, "border-top-left-y",
                String.valueOf(StrictGeomUtility.toExternalValue(topLeft.getHeight())));
          }


          final BorderCorner topRight = bg.getTopRight();
          if (topRight != null)
          {
            attList.setAttribute(null, "border-top-right-x",
                String.valueOf(StrictGeomUtility.toExternalValue(topRight.getWidth())));
            attList.setAttribute(null, "border-top-right-y",
                String.valueOf(StrictGeomUtility.toExternalValue(topRight.getHeight())));
          }


          final BorderCorner bottomLeft = bg.getBottomLeft();
          if (bottomLeft != null)
          {
            attList.setAttribute(null, "border-bottom-left-x",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomLeft.getWidth())));
            attList.setAttribute(null, "border-bottom-left-y",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomLeft.getHeight())));
          }


          final BorderCorner bottomRight = bg.getBottomRight();
          if (bottomRight != null)
          {
            attList.setAttribute(null, "border-bottom-right-x",
                String.valueOf(StrictGeomUtility.toExternalValue(bottomRight.getWidth())));
            attList.setAttribute(null, "border-bottom-right-y",
View Full Code Here

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

    BorderEdge bg = BorderEdge.EMPTY;
    final int columnCount = sheetLayout.getColumnCount();
    for (int col = 0; col < columnCount; col += 1)
    {
      final int sectionType = tableContentProducer.getSectionType(row, col);
      final CellBackground backgroundAt =
          cellBackgroundProducer.getBackgroundAt(logicalPageBox, sheetLayout, col, row, false, sectionType);
      if (backgroundAt == null)
      {
        return BorderEdge.EMPTY;
      }
      if (col == 0)
      {
        bg = backgroundAt.getTop();
      }
      else if (ObjectUtilities.equal(bg, backgroundAt.getTop()) == false)
      {
        return BorderEdge.EMPTY;
      }
    }
    return bg;
View Full Code Here

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

    final int columnCount = sheetLayout.getColumnCount();
    for (int col = 0; col < columnCount; col += 1)
    {
      final int sectionType = tableContentProducer.getSectionType(row, col);

      final CellBackground backgroundAt = cellBackgroundProducer.getBackgroundAt
          (logicalPageBox, sheetLayout, col, row, false, sectionType);
      if (backgroundAt == null)
      {
        return BorderEdge.EMPTY;
      }
      if (col == 0)
      {
        bg = backgroundAt.getBottom();
      }
      else if (ObjectUtilities.equal(bg, backgroundAt.getBottom()) == false)
      {
        return BorderEdge.EMPTY;
      }
    }
    return bg;
View Full Code Here

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

    Color bg = null;
    final int columnCount = sheetLayout.getColumnCount();
    for (int col = 0; col < columnCount; col += 1)
    {
      final int sectionType = tableContentProducer.getSectionType(row, col);
      final CellBackground backgroundAt =
          cellBackgroundProducer.getBackgroundAt(logicalPageBox, sheetLayout, col, row, false, sectionType);
      if (backgroundAt == null)
      {
        return null;
      }

      if (col == 0)
      {
        bg = backgroundAt.getBackgroundColor();
      }
      else
      {
        if (ObjectUtilities.equal(bg, backgroundAt.getBackgroundColor()) == false)
        {
          return null;
        }
      }
    }
View Full Code Here

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)
            {
              if (emptyCellsUseCSS)
              {
                xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", XmlWriterSupport.CLOSE);
              }
              else
              {
                final AttributeList attrs = new AttributeList();
                attrs.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "style", "font-size: 1pt");
                xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", attrs, XmlWriterSupport.OPEN);
                xmlWriter.writeText("&nbsp;");
                xmlWriter.writeCloseTag();
              }
              continue;
            }

            // Background cannot be null at this point ..
            final String[] anchor = background.getAnchors();
            if (anchor.length == 0 && emptyCellsUseCSS)
            {
              final AttributeList cellAttributes = createCellAttributes(1, 1, null, background, null, null);
              xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.CLOSE);
            }
            else
            {
              final AttributeList cellAttributes =
                  createCellAttributes(1, 1, null, background, HtmlPrinter.EMPTY_CELL_ATTRNAMES,
                      HtmlPrinter.EMPTY_CELL_ATTRVALS);
              xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.OPEN);
              for (int i = 0; i < anchor.length; i++)
              {
                xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor[i], XmlWriterSupport.CLOSE);
              }
              xmlWriter.writeText("&nbsp;");
              xmlWriter.writeCloseTag();

            }
            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.isFinished())
            {
              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.getBackgroundAt
              (logicalPage, sheetLayout, col, row, colSpan, rowSpan, true, sectionType);


          final AttributeList cellAttributes = createCellAttributes(colSpan, rowSpan, content, realBackground, null,
              null);
          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

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

      {
        final RenderBox content = contentProducer.getContent(row, col);
        if (content == null)
        {
          final int sectionType = contentProducer.getSectionType(row, col);
          final CellBackground background =
              cellBackgroundProducer.getBackgroundAt(logicalPage, sheetLayout, col, row, 1, 1, false, 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 = cellStyleProducer.createCellStyle(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 int sectionType = contentProducer.getSectionType(row, col);
        final CellBackground realBackground = cellBackgroundProducer.getBackgroundAt
            (logicalPage, sheetLayout,
                rectangle.getX1(), rectangle.getY1(), rectangle.getColumnSpan(), rectangle.getRowSpan(), false, sectionType);

        // export the cell and all content ..
View Full Code Here

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

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

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

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

        if (content == null)
        {
          final int sectionType = contentProducer.getSectionType(row, col);
          final CellBackground 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 TableRectangle rectangle = sheetLayout.getTableBounds
            (content.getX(), content.getY(), 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 int sectionType = contentProducer.getSectionType(row, col);
        final CellBackground realBackground = cellBackgroundProducer.getBackgroundAt
            (logicalPageBox, sheetLayout, rectangle.getX1(), rectangle.getY1(), rectangle.getColumnSpan(),
                rectangle.getRowSpan(), false, sectionType);

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

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, false, sectionType);
            if (background == null)
            {
              // An empty cell .. ignore
              final RtfCell cell = new RtfCell();
              cell.setBorderWidth(0);
              table.addCell(cell, row, col);
              continue;
            }

            // A empty cell with a defined background ..
            final RtfCell cell = new RtfCell();
            cell.setBorderWidth(0);
            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.getBackgroundAt
              (logicalPage, sheetLayout, col, row, colSpan, rowSpan, false, sectionType);

          final Cell cell = new Cell();
          cell.setRowspan(rowSpan);
          cell.setColspan(colSpan);
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.