Example usage for com.itextpdf.text.pdf PdfPTable addCell

List of usage examples for com.itextpdf.text.pdf PdfPTable addCell

Introduction

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

Prototype

public void addCell(final Phrase phrase) 

Source Link

Document

Adds a cell element.

Usage

From source file:com.softwaremagico.tm.pdf.complete.skills.CompleteSkillsTable.java

License:Open Source License

private static PdfPCell getThirdColumnTable(CharacterPlayer characterPlayer, String language,
        Stack<PdfPCell> learnedSkillsRows) throws InvalidXmlElementException {
    float[] widths = { 4f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from  w w w.  j a  v  a 2s .c  o  m*/
    PdfPCell cell = new PdfPCell();
    setCellProperties(cell);

    for (int i = 0; i < ROWS - OCCULTISM_ROWS; i++) {
        // Two columns: skill and value.
        table.addCell(learnedSkillsRows.pop());
        table.addCell(learnedSkillsRows.pop());
    }

    // Add Occultism table
    PdfPTable occultismTable = new OccultismTable(characterPlayer, language);
    PdfPCell occulstimCell = new PdfPCell();
    // setCellProperties(occulstimCell);
    // occulstimCell.setRowspan(widths.length);
    occulstimCell.setRowspan(OCCULTISM_ROWS);
    occulstimCell.setColspan(2);
    occulstimCell.addElement(occultismTable);
    occulstimCell.setVerticalAlignment(Element.ALIGN_BOTTOM);
    occulstimCell.setPadding(0);
    table.addCell(occulstimCell);

    cell.addElement(table);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.skills.MainSkillsTableFactory.java

License:Open Source License

public static PdfPTable getSkillsTable(CharacterPlayer characterPlayer, String language)
        throws InvalidXmlElementException {
    float[] widths = { 1f, 12f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);//from w  ww .ja  va2 s .c o m

    PdfPCell separator = createSeparator();
    separator.setPadding(PADDING);
    table.addCell(separator);
    table.addCell(separator);
    table.addCell(separator);

    PdfPCell vitalityCell = new PdfPCell(new VitalityTable(characterPlayer));
    vitalityCell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT);
    vitalityCell.setPadding(0);
    table.addCell(vitalityCell);

    PdfPCell skillsCell = new PdfPCell(CompleteSkillsTable.getSkillsTable(characterPlayer, language));
    skillsCell.setBorder(0);
    skillsCell.setPadding(0);
    skillsCell.setPaddingRight(FadingSunsTheme.DEFAULT_MARGIN);
    skillsCell.setPaddingLeft(FadingSunsTheme.DEFAULT_MARGIN);
    table.addCell(skillsCell);

    PdfPCell wyrdCell = new PdfPCell(new WyrdTable(characterPlayer));
    wyrdCell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT | Rectangle.TOP | Rectangle.LEFT);
    wyrdCell.setPadding(0);
    table.addCell(wyrdCell);
    return table;
}

From source file:com.softwaremagico.tm.pdf.complete.skills.occultism.OccultismTable.java

License:Open Source License

private PdfPCell createContent(CharacterPlayer characterPlayer, String language)
        throws InvalidXmlElementException {
    float[] widths = { 3f, 1f, 1f, 3f };
    PdfPTable table = new PdfPTable(widths);
    BaseElement.setTablePropierties(table);
    table.getDefaultCell().setBorder(0);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);

    for (OccultismType occulstimType : OccultismTypeFactory.getInstance().getElements(language)) {
        PdfPCell psiqueTitleCell = new PdfPCell(new Phrase(occulstimType.getName(),
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)));
        psiqueTitleCell.setBorder(0);/*  w  ww.  j a va  2 s . co  m*/
        // psiTitleCell.setMinimumHeight(30);
        psiqueTitleCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(psiqueTitleCell);

        if (characterPlayer == null) {
            table.addCell(createRectangle());
            table.addCell(createRectangle());
        } else {
            table.addCell(createRectangle(characterPlayer.getPsiqueLevel(occulstimType)));
            table.addCell(createRectangle(characterPlayer.getDarkSideLevel(occulstimType)));
        }

        PdfPCell darkSideTitleCell = new PdfPCell(new Phrase(occulstimType.getDarkSideName(),
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.CHARACTERISTICS_LINE_FONT_SIZE)));
        darkSideTitleCell.setBorder(0);
        darkSideTitleCell.setHorizontalAlignment(Element.ALIGN_LEFT);
        table.addCell(darkSideTitleCell);

    }

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

    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.traits.MainPerksTableFactory.java

License:Open Source License

public static PdfPTable getPerksTable(CharacterPlayer characterPlayer) {
    float[] widths = { 4f, 0.1f, 4f, 0.1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);//from  w w w . j a va2  s .  c o m
    table.getDefaultCell().setPadding(PADDING);

    PdfPCell whiteSeparator = createWhiteSeparator();
    whiteSeparator.setColspan(widths.length);
    table.addCell(whiteSeparator);

    PdfPCell blackSeparator = createBlackSeparator();
    whiteSeparator.setColspan(1);
    table.addCell(blackSeparator);
    table.addCell(whiteSeparator);
    table.addCell(blackSeparator);
    table.addCell(whiteSeparator);

    PdfPCell victoryPointsCell = new PdfPCell(new VictoryPointsTable());
    victoryPointsCell.setPadding(0);
    victoryPointsCell.setRowspan(2);
    table.addCell(victoryPointsCell);

    PdfPCell blessingCell = new PdfPCell(new BlessingTable(characterPlayer));
    blessingCell.setPadding(0);
    blessingCell.setBorder(0);
    table.addCell(blessingCell);

    table.addCell(whiteSeparator);

    PdfPCell perksCell = new PdfPCell(new BeneficesTable(characterPlayer));
    perksCell.setPadding(0);
    perksCell.setBorder(0);
    table.addCell(perksCell);

    table.addCell(whiteSeparator);

    return table;
}

From source file:com.softwaremagico.tm.pdf.small.characteristics.CharacteristicsColumn.java

License:Open Source License

private PdfPCell createContent(CharacterPlayer characterPlayer, List<CharacteristicDefinition> content) {
    float[] widths = { 4f, 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.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE)));
        paragraph.add(new Paragraph(" (", new Font(FadingSunsTheme.getLineFont(),
                FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE)));
        if (characterPlayer == null) {
            paragraph.add(new Paragraph(GAP, new Font(FadingSunsTheme.getLineFont(),
                    FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE)));
        } else {/*from w  ww  .j  a  va2 s. c om*/
            paragraph.add(
                    new Paragraph(characterPlayer.getStartingValue(characteristic.getCharacteristicName()) + "",
                            new Font(FadingSunsTheme.getHandwrittingFont(),
                                    FadingSunsTheme.getHandWrittingFontSize(
                                            FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE))));
        }
        paragraph.add(new Paragraph(")", new Font(FadingSunsTheme.getLineFont(),
                FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_LINE_FONT_SIZE)));

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

        // Rectangle
        if (characterPlayer == null) {
            table.addCell(createCharacteristicLine(SKILL_VALUE_GAP));
        } else {
            table.addCell(getHandwrittingCell(getCharacteristicValueRepresentation(characterPlayer,
                    characteristic.getCharacteristicName()), Element.ALIGN_LEFT));
        }
    }

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

    return cell;
}

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

License:Open Source License

public static PdfPTable getCharacteristicsBasicsTable(CharacterPlayer characterPlayer) {
    float[] widths = { 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from   w  ww. j a va 2 s  .  c  o m*/
    table.getDefaultCell().setBorder(0);

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

    for (CharacteristicType type : CharacteristicType.values()) {
        table.addCell(new CharacteristicsColumn(characterPlayer, type,
                CharacteristicsDefinitionFactory.getInstance().getAll(type, Translator.getLanguage())));
    }

    return table;
}

From source file:com.softwaremagico.tm.pdf.small.fighting.ArmourTable.java

License:Open Source License

private PdfPTable getShieldRange(CharacterPlayer characterPlayer) {
    float[] widths = { 1f, 3f, 1f, 3f, 1f };
    PdfPTable table = new PdfPTable(widths);
    BaseElement.setTablePropierties(table);
    table.getDefaultCell().setBorder(0);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);

    table.addCell(createEmptyElementLine("("));
    if (characterPlayer == null || characterPlayer.getShield() == null) {
        table.addCell(createEmptyElementLine(" ", ARMOUR_VALUE_COLUMN_WIDTH));
    } else {/*  ww w . jav a2 s  .co  m*/
        table.addCell(
                createElementLine(characterPlayer.getShield().getImpact() + "", ARMOUR_VALUE_COLUMN_WIDTH));
    }
    table.addCell(createEmptyElementLine("/"));
    if (characterPlayer == null || characterPlayer.getShield() == null) {
        table.addCell(createEmptyElementLine(" ", ARMOUR_VALUE_COLUMN_WIDTH));
    } else {
        table.addCell(
                createElementLine(characterPlayer.getShield().getForce() + "", ARMOUR_VALUE_COLUMN_WIDTH));
    }
    table.addCell(createEmptyElementLine(")"));

    return table;
}

From source file:com.softwaremagico.tm.pdf.small.info.CharacterBasicsReducedTableFactory.java

License:Open Source License

public static PdfPTable getCharacterBasicsTable(CharacterPlayer characterPlayer) {
    float[] widths = { 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from  w ww  . j  a  v a2s.  c  o m*/
    table.addCell(getFirstColumnTable(characterPlayer));
    table.addCell(getSecondColumnTable(characterPlayer));
    return table;
}

From source file:com.softwaremagico.tm.pdf.small.info.CharacterBasicsReducedTableFactory.java

License:Open Source License

private static PdfPCell getFirstColumnTable(CharacterPlayer characterPlayer) {
    float[] widths = { 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);//from  w w  w  .j a v a  2 s . com

    table.addCell(createField(characterPlayer, "name", FadingSunsTheme.CHARACTER_SMALL_BASICS_FONT_SIZE));
    table.addCell(createField(characterPlayer, "gender", FadingSunsTheme.CHARACTER_SMALL_BASICS_FONT_SIZE));
    table.addCell(createField(characterPlayer, "age", FadingSunsTheme.CHARACTER_SMALL_BASICS_FONT_SIZE));

    PdfPCell cell = new PdfPCell();
    setCellProperties(cell);

    cell.addElement(table);

    return cell;
}

From source file:com.softwaremagico.tm.pdf.small.info.CharacterBasicsReducedTableFactory.java

License:Open Source License

private static PdfPCell getSecondColumnTable(CharacterPlayer characterPlayer) {
    float[] widths = { 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from w ww. j  ava2 s  . c  o  m*/

    table.addCell(createField(characterPlayer, "race", FadingSunsTheme.CHARACTER_SMALL_BASICS_FONT_SIZE));
    table.addCell(createField(characterPlayer, "faction", FadingSunsTheme.CHARACTER_SMALL_BASICS_FONT_SIZE));
    table.addCell(createField(characterPlayer, "rank", FadingSunsTheme.CHARACTER_SMALL_BASICS_FONT_SIZE));

    PdfPCell cell = new PdfPCell();
    setCellProperties(cell);

    cell.addElement(table);

    return cell;
}