Example usage for com.itextpdf.text.pdf PdfPCell addElement

List of usage examples for com.itextpdf.text.pdf PdfPCell addElement

Introduction

In this page you can find the example usage for com.itextpdf.text.pdf PdfPCell addElement.

Prototype

public void addElement(Element element) 

Source Link

Document

Adds an iText element to the cell.

Usage

From source file:com.netsteadfast.greenstep.bsc.command.KpiReportPdfCommand.java

License:Apache License

private void createDateRange(PdfPTable table, VisionVO vision, Context context, int maxRows) throws Exception {
    String frequency = (String) context.get("frequency");
    String startYearDate = StringUtils.defaultString((String) context.get("startYearDate")).trim();
    String endYearDate = StringUtils.defaultString((String) context.get("endYearDate")).trim();
    String startDate = StringUtils.defaultString((String) context.get("startDate")).trim();
    String endDate = StringUtils.defaultString((String) context.get("endDate")).trim();
    String date1 = startDate;//from   w  ww .j ava  2s . c om
    String date2 = endDate;
    if (BscMeasureDataFrequency.FREQUENCY_QUARTER.equals(frequency)
            || BscMeasureDataFrequency.FREQUENCY_HALF_OF_YEAR.equals(frequency)
            || BscMeasureDataFrequency.FREQUENCY_YEAR.equals(frequency)) {
        date1 = startYearDate + "/01/01";
        date2 = endYearDate + "/12/" + SimpleUtils.getMaxDayOfMonth(Integer.parseInt(endYearDate), 12);
    }
    Map<String, Object> headContentMap = new HashMap<String, Object>();
    this.fillHeadContent(context, headContentMap);
    String content = "Frequency: " + BscMeasureDataFrequency.getFrequencyMap(false).get(frequency)
            + " Date range: " + date1 + " ~ " + date2 + "\n"
            + StringUtils.defaultString((String) headContentMap.get("headContent"));

    PdfPCell cell = null;

    cell = new PdfPCell();
    cell.addElement(new Phrase(content, this.getFont(BscReportPropertyUtils.getFontColor(), false)));
    this.setCellBackgroundColor(cell, BscReportPropertyUtils.getBackgroundColor());
    cell.setColspan(maxRows);
    table.addCell(cell);

    for (PerspectiveVO perspective : vision.getPerspectives()) {
        for (ObjectiveVO objective : perspective.getObjectives()) {
            for (KpiVO kpi : objective.getKpis()) {
                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getName(), this.getFont(kpi.getFontColor(), false)));
                this.setCellBackgroundColor(cell, kpi.getBgColor());
                cell.setColspan(4);
                cell.setRowspan(2);
                table.addCell(cell);

                for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
                    cell = new PdfPCell();
                    cell.addElement(
                            new Phrase(dateScore.getDate(), this.getFont(dateScore.getFontColor(), false)));
                    this.setCellBackgroundColor(cell, dateScore.getBgColor());
                    table.addCell(cell);
                }
                for (DateRangeScoreVO dateScore : kpi.getDateRangeScores()) {
                    Image image = Image
                            .getInstance(BscReportSupportUtils.getByteIcon(kpi, dateScore.getScore()));
                    image.setWidthPercentage(20f);
                    cell = new PdfPCell();
                    cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateScore.getScore()),
                            this.getFont(dateScore.getFontColor(), false)));
                    cell.addElement(image);
                    this.setCellBackgroundColor(cell, dateScore.getBgColor());
                    table.addCell(cell);
                }

            }
        }
    }

}

From source file:com.netsteadfast.greenstep.bsc.command.KpiReportPdfCommand.java

License:Apache License

private void putCharts(PdfPTable table, Context context) throws Exception {
    String pieBase64Content = SimpleUtils.getPNGBase64Content((String) context.get("pieCanvasToData"));
    String barBase64Content = SimpleUtils.getPNGBase64Content((String) context.get("barCanvasToData"));
    BufferedImage pieImage = SimpleUtils.decodeToImage(pieBase64Content);
    BufferedImage barImage = SimpleUtils.decodeToImage(barBase64Content);
    ByteArrayOutputStream pieBos = new ByteArrayOutputStream();
    ImageIO.write(pieImage, "png", pieBos);
    pieBos.flush();/* ww  w.j av a  2 s . c  om*/
    ByteArrayOutputStream barBos = new ByteArrayOutputStream();
    ImageIO.write(barImage, "png", barBos);
    barBos.flush();

    PdfPCell cell = null;

    Image pieImgObj = Image.getInstance(pieBos.toByteArray());
    pieImgObj.setWidthPercentage(100f);
    cell = new PdfPCell();
    cell.setBorder(Rectangle.NO_BORDER);
    cell.addElement(pieImgObj);
    table.addCell(cell);

    Image barImgObj = Image.getInstance(barBos.toByteArray());
    barImgObj.setWidthPercentage(100f);
    cell = new PdfPCell();
    cell.setBorder(Rectangle.NO_BORDER);
    cell.addElement(barImgObj);
    table.addCell(cell);

}

From source file:com.netsteadfast.greenstep.bsc.command.KpiReportPdfCommand.java

License:Apache License

private void putSignature(PdfPTable table, Context context) throws Exception {
    String uploadOid = (String) context.get("uploadSignatureOid");
    if (StringUtils.isBlank(uploadOid)) {
        return;/*from  w  w  w .  j a  v a  2s .  com*/
    }
    byte[] imageBytes = UploadSupportUtils.getDataBytes(uploadOid);
    if (null == imageBytes) {
        return;
    }
    Image signatureImgObj = Image.getInstance(imageBytes);
    signatureImgObj.setWidthPercentage(40f);
    PdfPCell cell = new PdfPCell();
    cell.setBorder(Rectangle.NO_BORDER);
    cell.addElement(signatureImgObj);
    table.addCell(cell);
}

From source file:com.netsteadfast.greenstep.bsc.command.OrganizationReportPdfCommand.java

License:Apache License

private void createHead(PdfPTable table, VisionVO vision, Context context) throws Exception {
    String bgColor = "#F2F2F2";
    String fnColor = "#000000";
    PdfPCell cell = new PdfPCell();
    cell.addElement(new Phrase("Department Balance SourceCard", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(MAX_COLSPAN);//from  w  w w.j  ava 2s . c  om
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(vision.getTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(MAX_COLSPAN);
    table.addCell(cell);

    String dateType = (String) context.get("dateType");
    String year = (String) context.get("startYearDate");
    String orgId = (String) context.get("orgId");
    String departmentName = "";
    String dateTypeName = "Year";
    if ("1".equals(dateType)) {
        dateTypeName = "In the first half";
    }
    if ("2".equals(dateType)) {
        dateTypeName = "In the second half";
    }
    OrganizationVO organization = new OrganizationVO();
    organization.setOrgId(orgId);
    DefaultResult<OrganizationVO> result = this.organizationService.findByUK(organization);
    if (result.getValue() != null) {
        organization = result.getValue();
        departmentName = organization.getName();
    }

    cell = new PdfPCell();
    cell.addElement(new Phrase("Department", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(departmentName, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(4);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(year + " " + dateTypeName, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(BscReportPropertyUtils.getPerspectiveTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(BscReportPropertyUtils.getObjectiveTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(BscReportPropertyUtils.getKpiTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Weight", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Maximum\nTarget\nMinimum", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Score", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

}

From source file:com.netsteadfast.greenstep.bsc.command.OrganizationReportPdfCommand.java

License:Apache License

private void createBody(PdfPTable table, VisionVO vision) throws Exception {
    String bgColor = "#ffffff";
    String fnColor = "#000000";
    PdfPCell cell = null;
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        cell = new PdfPCell();
        cell.addElement(new Phrase(perspective.getName(), this.getFont(fnColor, false)));
        this.setCellBackgroundColor(cell, bgColor);
        cell.setRowspan(perspective.getRow());
        table.addCell(cell);/*from   ww w .  j  a  va  2 s .c  o  m*/

        for (ObjectiveVO objective : perspective.getObjectives()) {
            cell = new PdfPCell();
            cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, false)));
            this.setCellBackgroundColor(cell, bgColor);
            cell.setRowspan(objective.getRow());
            table.addCell(cell);

            for (KpiVO kpi : objective.getKpis()) {
                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, false)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setRowspan(1);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, false)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setRowspan(1);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.addElement(new Phrase(
                        "max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: "
                                + kpi.getMin() + "\n" + "unit: " + kpi.getUnit(),
                        this.getFont(fnColor, false)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setRowspan(1);
                table.addCell(cell);

                DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0);

                cell = new PdfPCell();
                cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateRangeScore.getScore()),
                        this.getFont(dateRangeScore.getFontColor(), false)));
                this.setCellBackgroundColor(cell, dateRangeScore.getBgColor());
                cell.setRowspan(1);
                table.addCell(cell);

            }
        }
    }

}

From source file:com.netsteadfast.greenstep.bsc.command.PersonalReportPdfCommand.java

License:Apache License

private void createHead(PdfPTable table, VisionVO vision, Context context) throws Exception {
    String bgColor = "#F2F2F2";
    String fnColor = "#000000";
    PdfPCell cell = new PdfPCell();
    cell.addElement(new Phrase("Personal Balance SourceCard", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(MAX_COLSPAN);/*from   ww w.  j a va  2 s. c om*/
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(vision.getTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(MAX_COLSPAN);
    table.addCell(cell);

    String dateType = (String) context.get("dateType");
    String year = (String) context.get("startYearDate");
    String empId = (String) context.get("empId");
    String account = (String) context.get("account");
    String fullName = "";
    String jobTitle = "";
    String departmentName = "";
    String dateTypeName = "Year";
    if ("1".equals(dateType)) {
        dateTypeName = "In the first half";
    }
    if ("2".equals(dateType)) {
        dateTypeName = "In the second half";
    }
    EmployeeVO employee = new EmployeeVO();
    employee.setEmpId(empId);
    employee.setAccount(account);
    DefaultResult<EmployeeVO> result = this.employeeService.findByUK(employee);
    if (result.getValue() != null) {
        fullName = result.getValue().getEmpId() + " - " + result.getValue().getFullName();
        jobTitle = result.getValue().getEmpId() + " - " + result.getValue().getFullName();
        List<String> appendIds = this.organizationService
                .findForAppendOrganizationOids(result.getValue().getEmpId());
        List<String> appendNames = this.organizationService.findForAppendNames(appendIds);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; appendNames != null && i < appendNames.size(); i++) {
            sb.append(appendNames.get(i)).append(Constants.ID_DELIMITER);
        }
        departmentName = sb.toString();
    }

    cell = new PdfPCell();
    cell.addElement(new Phrase("Job Title", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(jobTitle, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Department", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(departmentName, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("name: " + fullName, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Annual assessment: " + year, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(BscReportPropertyUtils.getObjectiveTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(2);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(BscReportPropertyUtils.getKpiTitle(), this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(2);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Maximum\nTarget\nMinimum", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(2);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Weight", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(2);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Formula", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(2);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Score", this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(1);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(dateTypeName, this.getFont(fnColor, true)));
    this.setCellBackgroundColor(cell, bgColor);
    cell.setColspan(1);
    cell.setRowspan(1);
    table.addCell(cell);

}

From source file:com.netsteadfast.greenstep.bsc.command.PersonalReportPdfCommand.java

License:Apache License

private void createBody(PdfPTable table, VisionVO vision) throws Exception {

    String bgColor = "#ffffff";
    String fnColor = "#000000";
    for (PerspectiveVO perspective : vision.getPerspectives()) {
        for (ObjectiveVO objective : perspective.getObjectives()) {
            int kx = 0;
            for (KpiVO kpi : objective.getKpis()) {
                PdfPCell cell = new PdfPCell();
                if (kx == 0) {
                    cell.addElement(new Phrase(objective.getName(), this.getFont(fnColor, true)));
                    this.setCellBackgroundColor(cell, bgColor);
                    cell.setColspan(1);//from  w  w  w  . ja  va2 s  .  c  o  m
                    cell.setRowspan(objective.getRow());
                    table.addCell(cell);
                }

                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getName(), this.getFont(fnColor, true)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setColspan(1);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.addElement(
                        new Phrase(
                                "max: " + kpi.getMax() + "\n" + "target: " + kpi.getTarget() + "\n" + "min: "
                                        + kpi.getMin() + "\n" + "unit: " + kpi.getUnit(),
                                this.getFont(fnColor, true)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setColspan(1);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getWeight() + "%", this.getFont(fnColor, true)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setColspan(1);
                table.addCell(cell);

                cell = new PdfPCell();
                cell.addElement(new Phrase(kpi.getFormula().getName(), this.getFont(fnColor, true)));
                this.setCellBackgroundColor(cell, bgColor);
                cell.setColspan(1);
                table.addCell(cell);

                DateRangeScoreVO dateRangeScore = kpi.getDateRangeScores().get(0); // ?

                cell = new PdfPCell();
                cell.addElement(new Phrase(BscReportSupportUtils.parse2(dateRangeScore.getScore()),
                        this.getFont(dateRangeScore.getFontColor(), true)));
                this.setCellBackgroundColor(cell, dateRangeScore.getBgColor());
                cell.setColspan(1);
                table.addCell(cell);

                kx++;
            }
        }
    }

}

From source file:com.netsteadfast.greenstep.bsc.command.PersonalReportPdfCommand.java

License:Apache License

private void createFoot(PdfPTable table, Context context) throws Exception {
    String bgColor = "#ffffff";
    String fnColor = "#000000";
    PdfPCell cell = new PdfPCell();
    cell.addElement(new Phrase("assess:", this.getFont(fnColor, true)));
    cell.setColspan(1);//w  ww .ja  va 2s  .c om
    cell.setRowspan(2);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    this.setCellBackgroundColor(cell, bgColor);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(
            new Phrase(BscReportPropertyUtils.getPersonalReportClassLevel(), this.getFont(fnColor, true)));
    cell.setColspan(3);
    cell.setRowspan(2);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    this.setCellBackgroundColor(cell, bgColor);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Total", this.getFont(fnColor, true)));
    cell.setColspan(1);
    cell.setRowspan(1);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    this.setCellBackgroundColor(cell, bgColor);
    table.addCell(cell);

    float total = 0.0f;
    if (context.get("total") != null && context.get("total") instanceof Float) {
        total = (Float) context.get("total");
    }

    cell = new PdfPCell();
    cell.addElement(new Phrase(BscReportSupportUtils.parse2(total), this.getFont(fnColor, true)));
    cell.setColspan(1);
    cell.setRowspan(1);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    this.setCellBackgroundColor(cell, bgColor);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase("Class", this.getFont(fnColor, true)));
    cell.setColspan(1);
    cell.setRowspan(1);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    this.setCellBackgroundColor(cell, bgColor);
    table.addCell(cell);

    cell = new PdfPCell();
    cell.addElement(new Phrase(" ", this.getFont(fnColor, true)));
    cell.setColspan(1);
    cell.setRowspan(1);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    this.setCellBackgroundColor(cell, bgColor);
    table.addCell(cell);
}

From source file:com.softwaremagico.tm.pdf.complete.characteristics.CharacteristicColumn.java

License:Open Source License

private PdfPCell createContent(CharacterPlayer characterPlayer, List<CharacteristicDefinition> content) {
    float[] widths = { 3f, 1f, 0.1f };
    PdfPTable table = new PdfPTable(widths);
    BaseElement.setTablePropierties(table);
    table.getDefaultCell().setBorder(0);

    for (CharacteristicDefinition characteristic : content) {
        Paragraph paragraph = new Paragraph();
        paragraph.add(new Paragraph(getTranslator().getTranslatedText(characteristic.getId()),
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)));
        paragraph.add(new Paragraph(" (",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)));
        if (characterPlayer == null) {
            paragraph.add(new Paragraph(GAP,
                    new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)));
        } else {//from  www .  j  ava 2 s. co  m
            paragraph.add(
                    new Paragraph(characterPlayer.getStartingValue(characteristic.getCharacteristicName()) + "",
                            new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme
                                    .getHandWrittingFontSize(FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE))));
        }
        paragraph.add(new Paragraph(")",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)));

        PdfPCell characteristicTitle = new PdfPCell(paragraph);
        characteristicTitle.setBorder(0);
        characteristicTitle.setMinimumHeight(ROW_WIDTH / content.size());
        table.addCell(characteristicTitle);

        // Rectangle
        if (characterPlayer == null) {
            table.addCell(createRectangle());
        } else {
            table.addCell(createRectangle(characterPlayer.getValue(characteristic.getCharacteristicName())
                    + getCharacteristicSpecialRepresentation(characterPlayer,
                            characteristic.getCharacteristicName())));
        }

        // Margin
        PdfPCell margin = new PdfPCell();
        margin.setBorder(0);
        table.addCell(margin);
    }

    PdfPCell cell = new PdfPCell();
    cell.addElement(table);
    BaseElement.setCellProperties(cell);

    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.elements.BaseElement.java

License:Open Source License

public static PdfPCell createSeparator() {
    float[] widths = { 1f };
    PdfPTable table = new PdfPTable(widths);
    table.setWidthPercentage(100);/*from  w  w  w.j a  v  a 2  s. c o  m*/
    table.addCell(createWhiteSeparator());
    table.addCell(createBlackSeparator());
    // table.addCell(createWhiteSeparator());

    PdfPCell cell = new PdfPCell();
    cell.addElement(table);
    setCellProperties(cell);

    return cell;
}