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.small.counters.WyrdTable.java

License:Open Source License

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

    getDefaultCell().setBorder(0);//from  ww w . j a va 2 s. c  om

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

    addedCircle = 0;

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

}

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

License:Open Source License

public ArmourTable(CharacterPlayer characterPlayer) {
    super(new float[] { 2.2f, 3 });
    getDefaultCell().setBorder(0);// w ww. j  a v a  2 s  .  c o  m

    // Armor
    Font font = new Font(FadingSunsTheme.getTitleFont(), FadingSunsTheme.CHARACTER_SMALL_ARMOR_TITLE_FONT_SIZE);
    Phrase content = new Phrase(getTranslator().getTranslatedText("armor"), font);
    PdfPCell titleCell = new PdfPCell(content);
    titleCell.setBorder(0);
    addCell(titleCell);

    PdfPCell nameCell;
    if (characterPlayer == null) {
        nameCell = CustomPdfTable.createEmptyElementLine(GAP, NAME_COLUMN_WIDTH);
    } else if (characterPlayer.getArmour() == null) {
        nameCell = createElementLine("", NAME_COLUMN_WIDTH);
    } else {
        nameCell = createElementLine(characterPlayer.getArmour().getName() + "("
                + characterPlayer.getArmour().getProtection() + "d)", NAME_COLUMN_WIDTH,
                FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE - 1);
    }
    nameCell.setBorder(0);
    nameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(nameCell);

    // Shield
    addCell(getShieldRange(characterPlayer));

    Paragraph paragraph = new Paragraph();
    paragraph.add(new Paragraph(getTranslator().getTranslatedText("shieldHits") + ": ",
            new Font(FadingSunsTheme.getLineFont(), FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE)));
    if (characterPlayer != null && characterPlayer.getShield() != null) {
        paragraph.add(new Paragraph(characterPlayer.getShield().getHits() + "-",
                new Font(FadingSunsTheme.getHandwrittingFont(),
                        FadingSunsTheme.getHandWrittingFontSize(FadingSunsTheme.ARMOUR_CONTENT_FONT_SIZE))));
    }
    PdfPCell shieldCell = new PdfPCell(paragraph);
    shieldCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    shieldCell.setBorder(0);
    addCell(shieldCell);
}

From source file:com.softwaremagico.tm.pdf.small.SmallCharacterSheet.java

License:Open Source License

protected PdfPTable createCharacterContent(CharacterPlayer characterPlayer) throws Exception {
    float[] widths = { 2.2f, 1f };
    PdfPTable mainTable = new PdfPTable(widths);
    BaseElement.setTablePropierties(mainTable);
    mainTable.getDefaultCell().setPadding(0);

    PdfPTable infoTable = CharacterBasicsReducedTableFactory.getCharacterBasicsTable(characterPlayer);
    PdfPCell infoCell = new PdfPCell(infoTable);
    infoCell.setBorderWidthTop(0);//from w  w  w .  j a v  a2  s .  co  m
    infoCell.setBorderWidthLeft(0);
    infoCell.setBorderWidthBottom(1);
    mainTable.addCell(infoCell);

    PdfPTable learnedSkillsTable = LearnedSkillsTable.getSkillsTable(characterPlayer, getLanguage());
    PdfPCell learnedSkillsCell = new PdfPCell(learnedSkillsTable);
    learnedSkillsCell.setColspan(2);
    learnedSkillsCell.setRowspan(3);
    learnedSkillsCell.setBorderWidthTop(0);
    learnedSkillsCell.setBorderWidthRight(0);
    mainTable.addCell(learnedSkillsCell);

    PdfPTable basicTable = new PdfPTable(new float[] { 5f, 4f });
    BaseElement.setTablePropierties(basicTable);
    basicTable.getDefaultCell().setBorder(0);

    PdfPTable characteristicsTable = CharacteristicsTableFactory.getCharacteristicsBasicsTable(characterPlayer);
    PdfPCell characteristicCell = new PdfPCell(characteristicsTable);
    characteristicCell.setBorderWidthLeft(0);
    basicTable.addCell(characteristicCell);

    PdfPTable naturalSkillsTable = NaturalSkillsTable.getSkillsTable(characterPlayer, getLanguage());
    PdfPCell naturalSkillsCell = new PdfPCell(naturalSkillsTable);
    naturalSkillsCell.setBorderWidthRight(0);
    basicTable.addCell(naturalSkillsCell);

    PdfPCell basicComposedCell = new PdfPCell(basicTable);
    basicComposedCell.setBorder(0);
    mainTable.addCell(basicComposedCell);

    PdfPTable composedTable = new PdfPTable(new float[] { 5f, 2f });

    PdfPTable blessingsTable = new BlessingTable(characterPlayer);
    PdfPCell blessingsCell = new PdfPCell(blessingsTable);
    blessingsCell.setBorderWidthLeft(0);
    blessingsCell.setBorderWidthBottom(1);
    composedTable.addCell(blessingsCell);

    PdfPTable beneficesTable = new BeneficesTable(characterPlayer);
    PdfPCell beneficesCell = new PdfPCell(beneficesTable);
    beneficesCell.setBorderWidthBottom(1);
    composedTable.addCell(beneficesCell);

    PdfPCell composedCell = new PdfPCell(composedTable);
    composedCell.setRowspan(2);
    composedCell.setBorder(0);
    mainTable.addCell(composedCell);

    PdfPTable armourTable = new ArmourTable(characterPlayer);
    PdfPCell armourCell = new PdfPCell(armourTable);
    armourCell.setBorderWidthRight(0);
    armourCell.setBorderWidthBottom(1);
    mainTable.addCell(armourCell);

    PdfPTable fightTable = new PdfPTable(new float[] { 3f, 5f, 1f });

    if (characterPlayer != null
            && (characterPlayer.getSelectedPowers().isEmpty() && !characterPlayer.getCybernetics().isEmpty())) {
        PdfPTable cyberneticsTable = new CyberneticsTable(characterPlayer);
        PdfPCell cyberneticsCell = new PdfPCell(cyberneticsTable);
        cyberneticsCell.setBorderWidthLeft(0);
        fightTable.addCell(cyberneticsCell);
    } else {
        PdfPTable occultismTable = new OccultismTable(characterPlayer, getLanguage());
        PdfPCell occultismCell = new PdfPCell(occultismTable);
        occultismCell.setBorderWidthLeft(0);
        fightTable.addCell(occultismCell);
    }

    PdfPTable weaponsTable = new WeaponsTable(characterPlayer);
    fightTable.addCell(weaponsTable);

    PdfPCell victoryPointsCell = new PdfPCell(new VerticalVictoryPointsTable());
    victoryPointsCell.setPadding(0);
    victoryPointsCell.setRowspan(3);
    fightTable.addCell(victoryPointsCell);

    PdfPTable vitalityTable = new VitalityTable(characterPlayer);
    PdfPCell vitalityCell = new PdfPCell(vitalityTable);
    vitalityCell.setColspan(2);
    vitalityCell.setBorderWidth(1);
    fightTable.addCell(vitalityCell);

    PdfPTable wyrdTable = new WyrdTable(characterPlayer);
    PdfPCell wyrdCell = new PdfPCell(wyrdTable);
    wyrdCell.setBorderWidth(1);
    wyrdCell.setColspan(2);
    fightTable.addCell(wyrdCell);

    PdfPCell fightCell = new PdfPCell(fightTable);
    fightCell.setBorder(0);
    fightCell.setColspan(2);

    mainTable.addCell(fightCell);
    return mainTable;
}

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void createTable(Document doc, EnableRequerimentTypeFederalEnum type,
         EnableRequerimentSubjectFederalEnum subject, LicensePFEntity license, UserEntity user)
         throws DocumentException {

     // create PDF table with the given widths
     PdfPTable table = new PdfPTable(4);
     // set table width a percentage of the page width
     table.setWidthPercentage(100f);//from  w  ww  .j  av a 2 s.co m

     // Alterao Cadastral
     this.createAlteracaoCadastral(table, type, subject);

     // Dados da Empresa
     this.createCompany(table, license);

     // Dados do Representante
     this.createRepresentant(table, user);

     // Deferimento
     this.createDeferiment(table, license.getCompany());

     // Uso Oficial
     this.insertCellProtocol(table, license);

     // Table pai
     PdfPTable tableFather = new PdfPTable(1);
     tableFather.setWidthPercentage(100f);
     PdfPCell cellFather = new PdfPCell(table);
     cellFather.setBorderWidth(2);
     tableFather.addCell(cellFather);

     doc.add(this.createHeader());
     doc.add(tableFather);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertCell(PdfPTable table, String text, Integer colSpan) {

     if (text == null) {
         text = "";
     }/*w w  w . j  a v  a 2s.  c  o m*/

     // create a new cell with the specified Text and Font
     PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_PARAGRAPH));
     // set the cell alignment
     // in case there is no text and you wan to create an empty row
     if (text.trim().equalsIgnoreCase("")) {
         cell.setMinimumHeight(10f);
     }

     cell.setHorizontalAlignment(Element.ALIGN_LEFT);
     cell.setColspan(colSpan);
     cell.setPadding(5f);

     // add the call to the table
     table.addCell(cell);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertCellProtocol(PdfPTable table, LicensePFEntity license) {

     this.insertHeaderCell(table, "6- CONTROLE DE RECEBIMENTO DO PROCESSO", 4);

     Paragraph officialPhrase = new Paragraph("USO OFICIAL" + SEPARATOR, FONT_PARAGRAPH);
     officialPhrase.setAlignment(Element.ALIGN_LEFT);

     Paragraph protocolPhrase = new Paragraph("ETIQUETA PROTOCOLO" + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE,
             FONT_PROTOCOL);/*from  w w w  .ja  va  2  s .c  om*/
     protocolPhrase.setAlignment(Element.ALIGN_LEFT);

     Paragraph obsPhrase = new Paragraph(SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE
             + SEPARATOR_DOUBLE + "Observao Importante!" + SEPARATOR, FONT_HEADER);

     Paragraph obsStringPhrase = new Paragraph("- Etiqueta com data e assinatura." + SEPARATOR
             + "- Renovao: verificar a data de vencimento da licena." + SEPARATOR
             + "- Alterao Cadastral: apresentar o Anexo VI." + SEPARATOR_DOUBLE, FONT_PARAGRAPH);

     Paragraph phraseProtocol = new Paragraph();
     phraseProtocol.add(officialPhrase);
     phraseProtocol.add(protocolPhrase);

     Paragraph phraseObs = new Paragraph();
     phraseObs.add(obsPhrase);
     phraseObs.add(obsStringPhrase);

     PdfPCell cellProtocol = new PdfPCell(phraseProtocol);
     cellProtocol.setColspan(2);
     cellProtocol.disableBorderSide(Rectangle.RIGHT);

     PdfPCell cellObs = new PdfPCell(phraseObs);
     cellObs.setColspan(2);
     cellObs.disableBorderSide(Rectangle.LEFT);

     table.addCell(cellProtocol);
     table.addCell(cellObs);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertCellAlteracao(PdfPTable table, String text) {

     if (text == null) {
         text = "";
     }/*from w  w w .j  a va 2  s.co m*/

     // create a new cell with the specified Text and Font
     PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
     // set the cell alignment
     // in case there is no text and you wan to create an empty row
     if (text.trim().equalsIgnoreCase("")) {
         cell.setMinimumHeight(10f);
     }

     cell.setHorizontalAlignment(Element.ALIGN_CENTER);
     cell.setColspan(2);
     cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
     cell.setBorderWidth(2);
     cell.setPadding(3f);

     // add the call to the table
     table.addCell(cell);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertCellAlteracaoOption(PdfPTable table, String number, String text, Boolean selected) {

     String fullText = "";
     if (selected) {
         fullText += number + " |X|" + " " + text;
     } else {// w  w w.  j a va 2  s.  c o  m
         fullText += number + " |  |" + " " + text;
     }

     if (StringUtils.isBlank(number) && StringUtils.isBlank(text)) {
         fullText = "";
     }

     // create a new cell with the specified Text and Font
     PdfPCell cell = new PdfPCell(new Phrase(fullText.trim(), FONT_PARAGRAPH));
     // set the cell alignment
     // in case there is no text and you wan to create an empty row
     if (fullText.trim().equalsIgnoreCase("")) {
         cell.setMinimumHeight(10f);
     }

     cell.setHorizontalAlignment(Element.ALIGN_LEFT);
     cell.setBorder(Rectangle.RIGHT);
     cell.setPaddingTop(10f);
     cell.setPaddingBottom(10f);
     cell.setPaddingLeft(10f);
     cell.setPaddingRight(10f);

     // add the call to the table
     table.addCell(cell);
 }

From source file:com.solidmaps.webapp.report.EnableCompanyRequerimentFederalPDF.java

private void insertHeaderCell(PdfPTable table, String text, Integer colSpan) {

     if (text == null) {
         text = "";
     }/*from   ww  w .ja  v  a  2  s  . c  o  m*/

     // create a new cell with the specified Text and Font
     PdfPCell cell = new PdfPCell(new Phrase(text.trim(), FONT_HEADER));
     // set the cell alignment
     // in case there is no text and you wan to create an empty row
     if (text.trim().equalsIgnoreCase("")) {
         cell.setMinimumHeight(10f);
     }

     cell.setVerticalAlignment(Element.ALIGN_CENTER);
     cell.setHorizontalAlignment(Element.ALIGN_CENTER);
     cell.setColspan(colSpan);
     cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
     cell.setBorderWidth(2);
     cell.setPadding(3f);

     // add the call to the table
     table.addCell(cell);
 }

From source file:com.solidmaps.webapp.report.LicenseCivilIncludeProductPDF.java

License:Open Source License

private void insertCell(PdfPTable table, String text, int align, Font font, boolean border) {

    if (text == null) {
        text = "";
    }//from   w w w  .  j  a  va2s  . com

    // create a new cell with the specified Text and Font
    PdfPCell cell = new PdfPCell(new Phrase(text.trim(), font));
    // set the cell alignment
    cell.setHorizontalAlignment(align);
    // in case there is no text and you wan to create an empty row
    if (text.trim().equalsIgnoreCase("")) {
        cell.setMinimumHeight(10f);
    }

    if (!border) {
        cell.setBorder(Rectangle.NO_BORDER);
    }

    // add the call to the table
    table.addCell(cell);
}