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

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

Introduction

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

Prototype

public PdfPCell(PdfPCell cell) 

Source Link

Document

Constructs a deep copy of a PdfPCell.

Usage

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

License:Open Source License

public static PdfPTable getCharacteristicsBasicsTable(CharacterPlayer characterPlayer) {
    float[] widths = { 1f, 1f, 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from   www. j  a v a2  s .c om*/

    PdfPCell separator = createSeparator();
    separator.setColspan(widths.length);
    table.addCell(separator);

    Phrase content = new Phrase(getTranslator().getTranslatedText("characteristics").toUpperCase(),
            new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.TITLE_FONT_SIZE));
    PdfPCell titleCell = new PdfPCell(content);
    setCellProperties(titleCell);
    titleCell.setColspan(widths.length);
    titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    titleCell.setFixedHeight(30);
    table.addCell(titleCell);
    table.getDefaultCell().setPadding(0);

    for (CharacteristicType type : CharacteristicType.values()) {
        try {
            table.addCell(new CharacteristicColumn(characterPlayer, type,
                    CharacteristicsDefinitionFactory.getInstance().getAll(type, Translator.getLanguage())));
        } catch (NullPointerException npe) {
            PdfExporterLog.errorMessage(CharacteristicsTableFactory.class.getName(), npe);
        }
    }

    return table;
}

From source file:com.softwaremagico.tm.pdf.complete.CharacterSheet.java

License:Open Source License

private PdfPTable createRearTable() throws InvalidXmlElementException {
    PdfPTable mainTable = new PdfPTable(REAR_TABLE_WIDTHS);
    mainTable.getDefaultCell().setBorder(0);
    mainTable.setWidthPercentage(100);/*from w  ww.j a  v a2 s .c  om*/

    mainTable.addCell(new DescriptionTable(characterPlayer));
    PdfPCell cell = new PdfPCell(new AnnotationsTable());
    cell.setBorderWidth(0);
    cell.setColspan(2);
    mainTable.addCell(cell);

    PdfPCell blackSeparator = BaseElement.createBigSeparator(90);
    mainTable.addCell(blackSeparator);

    PdfPCell separatorCell = new PdfPCell(BaseElement.createWhiteSeparator());
    separatorCell.setColspan(2);
    mainTable.addCell(separatorCell);

    mainTable.addCell(new PropertiesTable(characterPlayer));

    PdfPCell psiCell = new PdfPCell(new OccultismsPowerTable(characterPlayer, PSI_ROWS));
    psiCell.setColspan(2);
    mainTable.addCell(psiCell);

    mainTable.addCell(BaseElement.createBigSeparator(90));

    mainTable.addCell(separatorCell);

    PdfPTable othersTable = new OthersTable();
    mainTable.addCell(othersTable);

    PdfPCell cyberneticsCell = new PdfPCell(new CyberneticsTable(characterPlayer));
    cyberneticsCell.setColspan(2);
    mainTable.addCell(cyberneticsCell);

    return mainTable;
}

From source file:com.softwaremagico.tm.pdf.complete.CharacterSheet.java

License:Open Source License

private PdfPTable createRearTablePsiExtended() throws InvalidXmlElementException {
    PdfPTable mainTable = new PdfPTable(REAR_TABLE_WIDTHS);
    mainTable.getDefaultCell().setBorder(0);
    mainTable.setWidthPercentage(100);// w ww. j a  v a 2 s .  co m

    mainTable.addCell(new DescriptionTable(characterPlayer));
    PdfPCell cell = new PdfPCell(new AnnotationsTable());
    cell.setBorderWidth(0);
    cell.setColspan(2);
    mainTable.addCell(cell);

    PdfPCell blackSeparator = BaseElement.createBigSeparator(90);
    mainTable.addCell(blackSeparator);

    PdfPCell separatorCell = new PdfPCell(BaseElement.createWhiteSeparator());
    separatorCell.setColspan(2);
    mainTable.addCell(separatorCell);

    mainTable.addCell(new PropertiesTable(characterPlayer));

    PdfPCell psiCell = new PdfPCell(new OccultismsPowerTable(characterPlayer, PSI_EXTENDED_ROWS));
    psiCell.setColspan(2);
    psiCell.setRowspan(3);
    mainTable.addCell(psiCell);

    mainTable.addCell(BaseElement.createBigSeparator(90));

    PdfPTable othersTable = new OthersTable();
    mainTable.addCell(othersTable);

    return mainTable;
}

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

License:Open Source License

public static PdfPCell getCell(String text, int border, int colspan, int align, BaseColor color, BaseFont font,
        float fontSize) {
    if (text == null) {
        text = "";
    }//  w  w  w . j ava  2s. c  o m
    Phrase content = new Phrase(text, new Font(font, fontSize));
    PdfPCell cell = new PdfPCell(content);
    cell.setColspan(colspan);
    cell.setBorderWidth(border);
    cell.setHorizontalAlignment(align);
    cell.setBackgroundColor(color);

    return cell;
}

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

License:Open Source License

public static PdfPCell getCell(Paragraph paragraph, int border, int colspan, int align, BaseColor color) {
    PdfPCell cell = new PdfPCell(paragraph);
    cell.setColspan(colspan);//  ww w  . j a  v  a 2 s  .  co m
    cell.setBorderWidth(border);
    cell.setHorizontalAlignment(align);
    cell.setBackgroundColor(color);

    return cell;
}

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

License:Open Source License

protected PdfPCell getCell(String text, int border, int colspan, int align, BaseColor color, String font,
        int fontSize, int fontType) {
    if (text == null) {
        text = "";
    }//ww w .  j a v  a  2  s  . co  m
    Paragraph p = new Paragraph(text, FontFactory.getFont(font, fontSize, fontType));
    PdfPCell cell = new PdfPCell(p);
    cell.setColspan(colspan);
    cell.setBorderWidth(border);
    cell.setHorizontalAlignment(align);
    cell.setBackgroundColor(color);

    return cell;
}

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

License:Open Source License

protected PdfPCell createCompactTitle(String title, int fontSize) {
    Font font = new Font(FadingSunsTheme.getTitleFont(), fontSize);
    Phrase content = new Phrase(title, font);
    PdfPCell titleCell = new PdfPCell(content);
    titleCell.setColspan(getColumnWidths().length);
    titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    titleCell.setBorder(0);// ww w.  j av  a 2 s.c  om
    return titleCell;
}

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

License:Open Source License

protected PdfPCell createRectangle(String value) {
    if (value == null) {
        return createRectangle();
    }//  ww w. j  a v  a  2s  . c  o m
    PdfPCell box = new PdfPCell(new Paragraph(value,
            new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.HANDWRITTING_DEFAULT_FONT_SIZE)));
    box.setVerticalAlignment(Element.ALIGN_MIDDLE);
    box.setHorizontalAlignment(Element.ALIGN_CENTER);
    box.setMinimumHeight(15);
    box.setBorder(0);
    box.setCellEvent(
            new CellCompleteBoxEvent(new Border[] { Border.TOP, Border.BOTTOM, Border.LEFT, Border.RIGHT }));
    return box;
}

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

License:Open Source License

protected PdfPCell getCell(Paragraph paragraph, int border, int colspan, int align) {
    PdfPCell cell = new PdfPCell(paragraph);
    cell.setColspan(colspan);/*from w  w w .  ja  v a  2s  .c  o  m*/
    cell.setBorderWidth(border);
    cell.setHorizontalAlignment(align);

    return cell;
}

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

License:Open Source License

protected PdfPCell createLateralVerticalTitle(String title, int rowspan) {
    Font font = new Font(FadingSunsTheme.getTitleFont(), getTitleFontSize());
    font.setColor(BaseColor.WHITE);/*from   w  w  w.j a va  2s.  c o  m*/
    Phrase content = new Phrase(title, font);
    PdfPCell titleCell = new PdfPCell(content);
    titleCell.setPadding(0);
    titleCell.setRowspan(rowspan);
    titleCell.setRotation(90);
    titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    // titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    titleCell.setBackgroundColor(BaseColor.BLACK);
    return titleCell;
}