Example usage for com.lowagie.text.pdf PdfPCell setBackgroundColor

List of usage examples for com.lowagie.text.pdf PdfPCell setBackgroundColor

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPCell setBackgroundColor.

Prototype


public void setBackgroundColor(Color backgroundColor) 

Source Link

Document

Sets the backgroundcolor of the rectangle.

Usage

From source file:org.mapfish.print.config.layout.CellConfig.java

License:Open Source License

protected void apply(PdfPCell cell, RenderingContext context, PJsonObject params) {
    if (paddingLeft != null)
        cell.setPaddingLeft(paddingLeft.floatValue());
    if (paddingRight != null)
        cell.setPaddingRight(paddingRight.floatValue());
    if (paddingTop != null)
        cell.setPaddingTop(paddingTop.floatValue());
    if (paddingBottom != null)
        cell.setPaddingBottom(paddingBottom.floatValue());

    if (borderWidthLeft != null)
        cell.setBorderWidthLeft(borderWidthLeft.floatValue());
    if (borderWidthRight != null)
        cell.setBorderWidthRight(borderWidthRight.floatValue());
    if (borderWidthTop != null)
        cell.setBorderWidthTop(borderWidthTop.floatValue());
    if (borderWidthBottom != null)
        cell.setBorderWidthBottom(borderWidthBottom.floatValue());

    if (getBorderColorLeftVal(context, params) != null)
        cell.setBorderColorLeft(getBorderColorLeftVal(context, params));
    if (getBorderColorRightVal(context, params) != null)
        cell.setBorderColorRight(getBorderColorRightVal(context, params));
    if (getBorderColorTopVal(context, params) != null)
        cell.setBorderColorTop(getBorderColorTopVal(context, params));
    if (getBorderColorBottomVal(context, params) != null)
        cell.setBorderColorBottom(getBorderColorBottomVal(context, params));

    if (getBackgroundColorVal(context, params) != null)
        cell.setBackgroundColor(getBackgroundColorVal(context, params));

    if (align != null)
        cell.setHorizontalAlignment(align.getCode());
    if (vertAlign != null)
        cell.setVerticalAlignment(vertAlign.getCode());

}

From source file:org.mapfish.print.config.layout.LegendsBlock.java

License:Open Source License

private PdfPCell createLine(RenderingContext context, double indent, PJsonObject node, Font pdfFont,
        PJsonObject params) throws DocumentException {
    final String name = node.getString("name");
    final String icon = node.optString("icon");
    final PJsonArray icons = node.optJSONArray("icons");

    final Paragraph result = new Paragraph();
    result.setFont(pdfFont);/*from   w ww .  ja  v  a  2  s . c  o m*/
    if (icon != null) {
        result.add(PDFUtils.createImageChunk(context, maxIconWidth, maxIconHeight, URI.create(icon), 0.0f));
        result.add(" ");
    }
    if (icons != null) {
        for (int i = 0; i < icons.size(); ++i) {
            String iconItem = icons.getString(i);
            try {
                result.add(PDFUtils.createImageChunk(context, maxIconWidth, maxIconHeight, URI.create(iconItem),
                        0.0f));
                result.add(" ");
            } catch (InvalidValueException e) {
                LOGGER.warn("Failed to create image chunk: " + e.getMessage());
            }
        }
    }
    result.add(name);

    final PdfPCell cell = new PdfPCell(result);
    cell.setBorder(PdfPCell.NO_BORDER);
    cell.setPadding(0f);
    cell.setPaddingLeft((float) indent);

    if (getBackgroundColorVal(context, params) != null) {
        cell.setBackgroundColor(getBackgroundColorVal(context, params));
    }

    return cell;
}

From source file:org.opentestsystem.delivery.testreg.rest.view.PDFReportView.java

License:Open Source License

private PdfPTable createHeaders(final String[] headerColumns, final PdfPTable table)
        throws BadElementException {
    PdfPCell cell;
    for (final String header : headerColumns) {
        cell = new PdfPCell(new Paragraph(header, HEADER_FONT));
        cell.setBackgroundColor(Color.GRAY);
        table.addCell(cell);//from   w  ww .  j  a  v a 2 s  .  c  o  m
    }
    return table;
}

From source file:org.opentestsystem.delivery.testreg.rest.view.PDFReportView.java

License:Open Source License

private PdfPTable createSummaryHeaders(final String[] headerColumns, final HierarchyLevel level,
        final PdfPTable table) throws BadElementException {
    PdfPCell cell;
    int columnIndex = 0;
    Map<String, String> crosswalkMap = null;
    if (level != HierarchyLevel.CLIENT) {
        crosswalkMap = this.entityCrosswalkService.getFormatType(FormatType.valueOf(level.name()));
    }/*from w  w  w  .j  a va 2  s.  c om*/
    for (String header : headerColumns) {
        columnIndex++;
        if (level != null && level == HierarchyLevel.CLIENT) {
            if (columnIndex == 4 || columnIndex == 5 || columnIndex == 6) {
                continue;
            }
        } else {
            if (columnIndex == 7 || columnIndex == 8) {
                if (crosswalkMap.get(header) != null) {
                    header = crosswalkMap.get(header);
                }
            }

        }
        cell = new PdfPCell(new Paragraph(header, HEADER_FONT));
        cell.setBackgroundColor(Color.GRAY);
        table.addCell(cell);

    }
    return table;
}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

License:Open Source License

private void addSummaryOfNeedsHeader(PdfPTable summaryOfNeedsTable,
        List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList, int loopNo) {

    PdfPCell headerCell = new PdfPCell();
    headerCell.setPhrase(new Phrase("Summary of Needs" + (loopNo > 1 ? " (Contd.)" : ""),
            new Font(Font.HELVETICA, 20, Font.BOLD)));

    headerCell.setColspan(currentBeanList.size() * 3);
    headerCell.setVerticalAlignment(Element.ALIGN_TOP);
    headerCell.setBorder(0);/* w w w . j av  a  2s.com*/
    headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    summaryOfNeedsTable.addCell(headerCell);

    Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE);
    //row1
    PdfPCell c2 = null;

    c2 = new PdfPCell();
    c2.setBorder(0);
    summaryOfNeedsTable.addCell(c2);
    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

    //row2
    c2 = new PdfPCell();
    c2.setBorder(0);
    summaryOfNeedsTable.addCell(c2);

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

License:Open Source License

private void addSummaryOfNeedsDomainHeader(PdfPTable summaryOfNeedsTable,
        List<OcanNeedRatingOverTimeNeedBreakdownBean> currentBeanList, int loopNo) {

    Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE);
    //row1/*from w  w w .ja  v  a2 s .  c o  m*/
    PdfPCell c2 = null;

    c2 = new PdfPCell();
    c2.setBorder(0);
    summaryOfNeedsTable.addCell(c2);

    if (loopNo > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
    }

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(0).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(0).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(1).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(1).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setColspan(2);
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase(currentBeanList.get(2).getOcanName() + "\n"
                + dateFormatter.format(currentBeanList.get(2).getOcanDate()), f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

    //row2
    c2 = new PdfPCell();
    c2.setBackgroundColor(Color.BLUE);
    c2.setPhrase(new Phrase("Domains", f));
    c2.setHorizontalAlignment(Element.ALIGN_CENTER);
    summaryOfNeedsTable.addCell(c2);

    if (loopNo > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
    }

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Consumer", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLUE);
        c2.setPhrase(new Phrase("Staff", f));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

License:Open Source License

private void addSummaryOfNeedsRow(PdfPTable summaryOfNeedsTable, String needType, String needTypeKey,
        List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList) {
    //row3/*from   www . ja  va 2  s  . co m*/
    PdfPCell c2 = new PdfPCell();
    c2.setBackgroundColor(Color.BLUE);
    c2.setPhrase(new Phrase(needType, new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
    summaryOfNeedsTable.addCell(c2);

    if (currentBeanList.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(0).getConsumerNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(0).getStaffNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 1) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(1).getConsumerNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(1).getStaffNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
    }
    if (currentBeanList.size() > 2) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(2).getConsumerNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(String.valueOf(currentBeanList.get(2).getStaffNeedMap().get(needTypeKey)),
                new Font(Font.HELVETICA, 14, Font.BOLD)));
        c2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        summaryOfNeedsTable.addCell(c2);
    }

}

From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java

License:Open Source License

private void addSummaryOfNeedsDomainRow(PdfPTable summaryOfNeedsTable, int rowNum, List<String> domains,
        List<OcanNeedRatingOverTimeNeedBreakdownBean> ocans,
        OcanNeedRatingOverTimeNeedBreakdownBean lastBreakDownBean) {

    PdfPCell c2 = new PdfPCell();
    c2.setBackgroundColor(Color.BLUE);
    c2.setPhrase(new Phrase(domains.get(rowNum), new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
    summaryOfNeedsTable.addCell(c2);//from  w  w  w.  j a v  a2  s.c om

    if (lastBreakDownBean != null) {
        boolean checkmark = false;
        if (!ocans.get(0).getNeeds().get(rowNum).getConsumerNeed()
                .equals(lastBreakDownBean.getNeeds().get(rowNum).getConsumerNeed())) {
            checkmark = true;
        }
        if (!ocans.get(0).getNeeds().get(rowNum).getStaffNeed()
                .equals(lastBreakDownBean.getNeeds().get(rowNum).getStaffNeed())) {
            checkmark = true;
        }
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        if (checkmark) {
            c2.setPhrase(new Phrase("X", new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
        }
        summaryOfNeedsTable.addCell(c2);
    }

    if (ocans.size() > 0) {
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(ocans.get(0).getNeeds().get(rowNum).getConsumerNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(0).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(0).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(ocans.get(0).getNeeds().get(rowNum).getStaffNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(0).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(0).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (ocans.size() > 1) {
        boolean checkmark = false;
        if (!ocans.get(1).getNeeds().get(rowNum).getConsumerNeed()
                .equals((ocans.get(0).getNeeds().get(rowNum).getConsumerNeed()))) {
            checkmark = true;
        }
        if (!ocans.get(1).getNeeds().get(rowNum).getStaffNeed()
                .equals((ocans.get(0).getNeeds().get(rowNum).getStaffNeed()))) {
            checkmark = true;
        }
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        if (checkmark) {
            c2.setPhrase(new Phrase("X", new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
        }
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(ocans.get(1).getNeeds().get(rowNum).getConsumerNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(1).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(1).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(ocans.get(1).getNeeds().get(rowNum).getStaffNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(1).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(1).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }
    if (ocans.size() > 2) {
        boolean checkmark = false;
        if (!ocans.get(2).getNeeds().get(rowNum).getConsumerNeed()
                .equals((ocans.get(1).getNeeds().get(rowNum).getConsumerNeed()))) {
            checkmark = true;
        }
        if (!ocans.get(2).getNeeds().get(rowNum).getStaffNeed()
                .equals((ocans.get(1).getNeeds().get(rowNum).getStaffNeed()))) {
            checkmark = true;
        }
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.BLACK);
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        if (checkmark) {
            c2.setPhrase(new Phrase("X", new Font(Font.HELVETICA, 14, Font.BOLD, Color.WHITE)));
        }
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.GREEN);
        c2.setPhrase(new Phrase(ocans.get(2).getNeeds().get(rowNum).getConsumerNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(2).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(2).getNeeds().get(rowNum).getConsumerNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
        c2 = new PdfPCell();
        c2.setBackgroundColor(Color.LIGHT_GRAY);
        c2.setPhrase(new Phrase(ocans.get(2).getNeeds().get(rowNum).getStaffNeed(),
                new Font(Font.HELVETICA, 14,
                        (ocans.get(2).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Font.BOLD
                                : Font.NORMAL),
                        (ocans.get(2).getNeeds().get(rowNum).getStaffNeed().equals("Unmet Need") ? Color.RED
                                : Color.BLACK))));
        c2.setHorizontalAlignment(Element.ALIGN_CENTER);
        summaryOfNeedsTable.addCell(c2);
    }

}

From source file:org.oscarehr.web.reports.ocan.SummaryOfActionsAndCommentsReportGenerator.java

License:Open Source License

private void createOcanEntry(PdfPTable table, SummaryOfActionsAndCommentsOCANBean ocanBean) {
    Font f = new Font(Font.HELVETICA, 12, Font.BOLD, Color.BLACK);
    //header/* www  .j  a va  2 s.  c  o m*/
    PdfPCell c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setHorizontalAlignment(Element.ALIGN_CENTER);
    c1.setPhrase(new Phrase("Rating", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(2);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase(ocanBean.getOcanName() + " - " + dateFormatter.format(ocanBean.getOcanDate()), f));
    table.addCell(c1);

    //actions
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setBorderWidthBottom(0);
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Actions", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(ocanBean.getActions(), normalText));
    table.addCell(c1);

    //By Whom
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setBorderWidthBottom(0);
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("By Whom", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(ocanBean.getByWhom(), normalText));
    table.addCell(c1);

    //review date
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setBorderWidthBottom(0);
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Review Date", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(ocanBean.getReviewDate(), normalText));
    table.addCell(c1);

    //consumer
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase(convertNeedToWord(ocanBean.getConsumerNeedRating()), boldText));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Consumer Comments", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(includeComments ? ocanBean.getConsumerComments() : "", normalText));
    table.addCell(c1);

    //staff
    c1 = new PdfPCell();
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase(convertNeedToWord(ocanBean.getStaffNeedRating()), boldText));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setBackgroundColor(Color.LIGHT_GRAY);
    c1.setPhrase(new Phrase("Staff Comments", f));
    table.addCell(c1);
    c1 = new PdfPCell();
    c1.setColspan(1);
    c1.setPhrase(new Phrase(includeComments ? ocanBean.getStaffComments() : "", normalText));
    table.addCell(c1);
}

From source file:org.oscarehr.web.reports.ocan.SummaryOfActionsAndCommentsReportGenerator.java

License:Open Source License

private void createDomainHeader(PdfPTable table, String name) {
    Font f = new Font(Font.HELVETICA, 14, Font.BOLD, Color.BLACK);
    PdfPCell emptyCell = new PdfPCell();
    emptyCell.setBorder(0);//  w w  w. ja  va2  s .c o m
    table.addCell(emptyCell);

    PdfPCell headerCell = new PdfPCell();
    headerCell.setColspan(2);
    headerCell.setPhrase(new Phrase(name, f));
    headerCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    headerCell.setBackgroundColor(Color.LIGHT_GRAY);
    table.addCell(headerCell);
}