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.fighting.FightingManeuvers.java

License:Open Source License

public static PdfPTable getFightingManoeuvresTable(CharacterPlayer characterPlayer)
        throws InvalidXmlElementException {
    float[] widths = { 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);//from  w  ww. j a v a2  s  .c  om
    table.getDefaultCell().setPadding(PADDING);
    table.getDefaultCell().setBorder(0);

    table.addCell(BaseElement.createWhiteSeparator());
    table.addCell(BaseElement.createWhiteSeparator());

    table.addCell(BaseElement.createWhiteSeparator());
    table.addCell(BaseElement.createWhiteSeparator());

    PdfPCell fireArmsCell = new PdfPCell(new RangedManeuversTable(characterPlayer));
    table.addCell(fireArmsCell);

    PdfPCell fencingCell = new PdfPCell(new MeleeManeuversTable(characterPlayer));
    table.addCell(fencingCell);

    return table;
}

From source file:com.softwaremagico.tm.pdf.complete.fighting.WeaponsAndArmours.java

License:Open Source License

public static PdfPTable getWeaponsAndArmoursTable(CharacterPlayer characterPlayer)
        throws InvalidXmlElementException {
    float[] widths = { 4f, 1.1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from  www . j a v a 2 s.  c  om*/
    table.getDefaultCell().setPadding(PADDING);
    table.getDefaultCell().setBorder(0);

    PdfPTable leftTable = new PdfPTable(new float[] { 1f });
    setTablePropierties(leftTable);
    leftTable.getDefaultCell().setBorder(0);
    leftTable.getDefaultCell().setPadding(0);

    PdfPCell fireArmsCell = new PdfPCell(new WeaponsTable(characterPlayer));
    leftTable.addCell(fireArmsCell);

    PdfPTable stancesXpTable = new PdfPTable(new float[] { 4f, 1f });
    setTablePropierties(stancesXpTable);
    stancesXpTable.getDefaultCell().setBorder(0);
    stancesXpTable.getDefaultCell().setPadding(0);

    PdfPCell stancesCell = new PdfPCell(new StancesTable(characterPlayer));
    stancesXpTable.addCell(stancesCell);

    PdfPCell experienceCell = new PdfPCell(new ExperienceTable(characterPlayer));
    stancesXpTable.addCell(experienceCell);

    leftTable.addCell(stancesXpTable);

    PdfPCell leftCell = new PdfPCell(leftTable);
    leftCell.setRowspan(2);
    table.addCell(leftCell);

    PdfPCell armourCell = new PdfPCell(new ArmourTable(characterPlayer));
    table.addCell(armourCell);

    PdfPCell shieldCell = new PdfPCell(new ShieldTable(characterPlayer));
    table.addCell(shieldCell);

    return table;
}

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

License:Open Source License

protected PdfPCell createValue(String text, Font font, int alignment) {
    Phrase content = new Phrase(text, font);
    PdfPCell circleCell = new PdfPCell(content);
    // Not putting correctly the "o" at the center of the cell.
    // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment
    circleCell.setPaddingTop(-4f);// ww w. j a  v a2 s .  co  m
    circleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    circleCell.setVerticalAlignment(alignment);
    circleCell.setBorder(0);
    // Some position corrections.
    circleCell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / CIRCLES) + 1.3f);
    return circleCell;
}

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);//  w  ww .ja v  a  2s. c  om

    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);//ww w.j  av  a2  s .  c  o 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);// w  ww  .j av a 2 s .  c om
    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  w w  .ja  va  2s.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   ww w  .  j  a  v a 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.counters.CounterTable.java

License:Open Source License

protected PdfPCell createValue(String text, Font font, int alignment) {
    Phrase content = new Phrase(text, font);
    PdfPCell circleCell = new PdfPCell(content);
    // Not putting correctly the "o" at the center of the cell.
    // http://stackoverflow.com/questions/5554553/itext-pdftable-cell-vertical-alignment
    circleCell.setPaddingTop(paddingTop);
    circleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    circleCell.setVerticalAlignment(alignment);
    circleCell.setBorder(0);// ww w.j av  a 2 s  . com
    circleCell.setMinimumHeight(20);
    return circleCell;
}

From source file:com.softwaremagico.tm.pdf.small.counters.VitalityTable.java

License:Open Source License

public VitalityTable(CharacterPlayer characterPlayer) {
    super(characterPlayer);

    getDefaultCell().setBorder(0);//  ww w.j a v  a  2s.co  m

    Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_VITALITY_TITLE_FONT_SIZE);
    Phrase content = new Phrase(getTranslator().getTranslatedText("vitality"), font);
    PdfPCell titleCell = new PdfPCell(content);
    titleCell.setBorder(0);
    titleCell.setPaddingRight(0);
    titleCell.setPaddingTop(paddingTop);
    titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    addCell(titleCell);

    addedCircle = 0;

    for (int i = 0; i < getNumberOfCircles(); i++) {
        addCell(getCircle());
        addedCircle++;
    }

}