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

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

Introduction

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

Prototype

public void setColspan(int colspan) 

Source Link

Document

Setter for property colspan.

Usage

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);
    cell.setBorderWidth(border);/*from w w  w . ja  v  a2s .  c o  m*/
    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 = "";
    }/* www.  ja v a  2 s. c  o  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);/*from w  w w.j  av  a2s.c om*/
    return titleCell;
}

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);
    cell.setBorderWidth(border);//from  w ww .j av a 2  s. c  o m
    cell.setHorizontalAlignment(align);

    return cell;
}

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

License:Open Source License

public ArmourTable(CharacterPlayer characterPlayer) throws InvalidXmlElementException {
    super(WIDTHS);
    getDefaultCell().setBorder(0);//from  w ww .  j a v a  2 s.com

    addCell(createLateralVerticalTitle(getTranslator().getTranslatedText("armor"), ROWS + 1));

    PdfPCell nameCell;
    if (characterPlayer == null || characterPlayer.getArmour() == null) {
        nameCell = createEmptyElementLine(GAP);
    } else {
        nameCell = createElementLine(characterPlayer.getArmour().getName(), NAME_COLUMN_WIDTH,
                FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE);
    }
    nameCell.setColspan(WIDTHS.length);
    nameCell.setMinimumHeight(20);
    addCell(nameCell);
    PdfPCell protectionCell;
    if (characterPlayer == null || characterPlayer.getArmour() == null) {
        protectionCell = createEmptyElementLine(getTranslator().getTranslatedText("armorRating") + ": ____ "
                + getTranslator().getTranslatedText("diceAbbreviature"));
    } else {
        Paragraph paragraph = new Paragraph();
        paragraph.add(new Paragraph(getTranslator().getTranslatedText("armorRating") + ": ",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));

        paragraph.add(new Paragraph(characterPlayer.getArmour().getProtection() + " ",
                new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)));

        paragraph.add(new Paragraph(getTranslator().getTranslatedText("diceAbbreviature"),
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));

        protectionCell = createEmptyElementLine("");

        protectionCell.setPhrase(paragraph);
    }
    protectionCell.setColspan(WIDTHS.length);
    addCell(protectionCell);

    PdfPCell malusCell;
    if (characterPlayer == null || characterPlayer.getArmour() == null) {
        malusCell = createEmptyElementLine(getTranslator().getTranslatedText("strengthAbbreviature") + ":__  "
                + getTranslator().getTranslatedText("dexterityAbbreviature") + ":__  "
                + getTranslator().getTranslatedText("enduranceAbbreviature") + ":__ "
                + getTranslator().getTranslatedText("iniciativeAbbreviature") + ":__");
    } else {
        Paragraph paragraph = new Paragraph();
        paragraph.add(new Paragraph(getTranslator().getTranslatedText("strengthAbbreviature") + ":",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));
        paragraph.add(new Paragraph(
                characterPlayer.getArmour().getStandardPenalizations().getStrengthModification() + " ",
                new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)));

        paragraph.add(new Paragraph(" " + getTranslator().getTranslatedText("dexterityAbbreviature") + ":",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));
        paragraph.add(new Paragraph(
                characterPlayer.getArmour().getStandardPenalizations().getDexterityModification() + " ",
                new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)));

        paragraph.add(new Paragraph(" " + getTranslator().getTranslatedText("enduranceAbbreviature") + ":",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));
        paragraph.add(new Paragraph(
                characterPlayer.getArmour().getStandardPenalizations().getEnduranceModification() + " ",
                new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)));

        paragraph.add(new Paragraph(" " + getTranslator().getTranslatedText("iniciativeAbbreviature") + ":",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));
        paragraph.add(new Paragraph(
                characterPlayer.getArmour().getStandardPenalizations().getEnduranceModification() + " ",
                new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)));

        malusCell = createEmptyElementLine("");

        malusCell.setPhrase(paragraph);
    }
    malusCell.setColspan(WIDTHS.length);
    addCell(malusCell);

    if (characterPlayer == null || characterPlayer.getArmour() == null) {
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorHardAbbreviature"), false));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorFireAbbreviature"), false));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorLaserAbbreviature"), false));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorPlasmAbbreviature"), false));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorShockAbbreviature"), false));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorImpactAbbreviature"), false));
    } else {
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorHardAbbreviature"),
                characterPlayer.getArmour().getDamageTypes().contains(
                        DamageTypeFactory.getInstance().getElement("hard", characterPlayer.getLanguage()))));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorFireAbbreviature"),
                characterPlayer.getArmour().getDamageTypes().contains(
                        DamageTypeFactory.getInstance().getElement("fire", characterPlayer.getLanguage()))));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorLaserAbbreviature"),
                characterPlayer.getArmour().getDamageTypes().contains(
                        DamageTypeFactory.getInstance().getElement("laser", characterPlayer.getLanguage()))));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorPlasmAbbreviature"),
                characterPlayer.getArmour().getDamageTypes().contains(
                        DamageTypeFactory.getInstance().getElement("plasma", characterPlayer.getLanguage()))));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorShockAbbreviature"),
                characterPlayer.getArmour().getDamageTypes().contains(
                        DamageTypeFactory.getInstance().getElement("shock", characterPlayer.getLanguage()))));
        addCell(getArmourProperty(getTranslator().getTranslatedText("armorImpactAbbreviature"),
                characterPlayer.getArmour().getDamageTypes().contains(
                        DamageTypeFactory.getInstance().getElement("impact", characterPlayer.getLanguage()))));
    }

}

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

License:Open Source License

public ShieldTable(CharacterPlayer characterPlayer) {
    super(WIDTHS);
    getDefaultCell().setBorder(0);//  w  ww .ja  v a2 s  . c o  m

    addCell(createLateralVerticalTitle(getTranslator().getTranslatedText("shield"), ROWS + 1));

    PdfPCell nameCell;
    if (characterPlayer == null || characterPlayer.getShield() == null) {
        nameCell = createEmptyElementLine(GAP, NAME_COLUMN_WIDTH);
    } else {
        nameCell = createElementLine(characterPlayer.getShield().getName(), NAME_COLUMN_WIDTH,
                FadingSunsTheme.SHIELD_CONTENT_FONT_SIZE);
    }
    nameCell.setColspan(WIDTHS.length);
    nameCell.setMinimumHeight(20);
    addCell(nameCell);

    addCell(getShieldRange(characterPlayer));
    if (characterPlayer == null || characterPlayer.getShield() == null) {
        addCell(createEmptyElementLine(getTranslator().getTranslatedText("shieldHits") + ": " + GAP,
                HITS_COLUMN_WIDTH));
    } else {
        Paragraph paragraph = new Paragraph();
        paragraph.add(new Paragraph(getTranslator().getTranslatedText("shieldHits") + ": ",
                new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE)));

        paragraph.add(new Paragraph(characterPlayer.getShield().getHits() + " ",
                new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.SHIELD_CONTENT_FONT_SIZE)));

        PdfPCell protectionCell = createEmptyElementLine("");
        protectionCell.setPhrase(paragraph);

        addCell(protectionCell);
    }
    addCell(createEmptyElementLine("___________________"));
    addCell(createEmptyElementLine("___________________"));
}

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

public CharacteristicsColumn(CharacterPlayer characterPlayer, CharacteristicType characteristicType,
        List<CharacteristicDefinition> content) {
    super(widths);
    PdfPCell title = createCompactTitle(
            getTranslator().getTranslatedText(characteristicType.getTranslationTag()),
            FadingSunsTheme.CHARACTER_SMALL_CHARACTERISTICS_TITLE_FONT_SIZE);
    title.setColspan(widths.length);
    addCell(title);/*from   w  ww  .  j a  v  a 2s  .com*/
    addCell(createContent(characterPlayer, content));
}

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  www  .  j ava  2 s  . co  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;
}