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

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

Introduction

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

Prototype

public PdfPTable(final PdfPTable table) 

Source Link

Document

Constructs a copy of a PdfPTable.

Usage

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 . ja v a2 s .  c om

    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;
}

From source file:com.softwaremagico.tm.pdf.small.skills.LearnedSkillsTable.java

License:Open Source License

public static PdfPTable getSkillsTable(CharacterPlayer characterPlayer, String language)
        throws InvalidXmlElementException {
    float[] widths = { 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from   w w w . j a  v a  2  s.c o  m*/
    table.getDefaultCell().setBorder(0);
    table.addCell(getSkillsColumnTable(characterPlayer, language));
    return table;
}

From source file:com.softwaremagico.tm.pdf.small.skills.LearnedSkillsTable.java

License:Open Source License

private static PdfPCell getSkillsColumnTable(CharacterPlayer characterPlayer, String language)
        throws InvalidXmlElementException {
    float[] widths = { 4f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*w ww  . j a v  a2 s  . co m*/
    table.getDefaultCell().setBorder(0);

    table.addCell(createCompactTitle(getTranslator().getTranslatedText("learnedSkills"),
            FadingSunsTheme.CHARACTER_SMALL_SKILLS_TITLE_FONT_SIZE));

    int added = 0;
    if (characterPlayer != null) {
        for (AvailableSkill skill : characterPlayer.getLearnedSkills()) {
            if (characterPlayer.getSkillTotalRanks(skill) > 0) {
                table.addCell(createSkillElement(characterPlayer, skill,
                        FadingSunsTheme.CHARACTER_SMALL_SKILLS_LINE_FONT_SIZE, MAX_SKILL_COLUMN_WIDTH));
                table.addCell(createSkillValue(characterPlayer.getSkillTotalRanks(skill),
                        characterPlayer.isSkillSpecial(skill)
                                || characterPlayer.hasSkillTemporalModificator(skill),
                        characterPlayer.hasSkillModificator(skill),
                        FadingSunsTheme.CHARACTER_SMALL_SKILLS_LINE_FONT_SIZE));
                added++;
            }
        }
    }

    if (characterPlayer == null) {
        for (int i = added; i < ROWS; i++) {
            table.addCell(CustomPdfTable.createEmptyElementLine(GAP, MAX_SKILL_COLUMN_WIDTH));
            table.addCell(CustomPdfTable.createEmptyElementLine(GAP, MAX_SKILL_RANK_WIDTH));
        }
    } else {
        for (int i = added; i < ROWS; i++) {
            table.addCell(CustomPdfTable.createEmptyElementLine(" ", MAX_SKILL_COLUMN_WIDTH));
            table.addCell(CustomPdfTable.createEmptyElementLine(" ", MAX_SKILL_RANK_WIDTH));
        }
    }

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

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

From source file:com.softwaremagico.tm.pdf.small.skills.NaturalSkillsTable.java

License:Open Source License

private static PdfPCell getSkillsColumnTable(CharacterPlayer characterPlayer, String language)
        throws InvalidXmlElementException {
    float[] widths = { 4f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);//from w w  w  .  java  2  s . c o m
    table.getDefaultCell().setBorder(0);

    table.addCell(createCompactTitle(getTranslator().getTranslatedText("naturalSkills"),
            FadingSunsTheme.CHARACTER_SMALL_SKILLS_TITLE_FONT_SIZE));

    if (characterPlayer == null) {
        for (AvailableSkill skill : AvailableSkillsFactory.getInstance().getNaturalSkills(language)) {
            table.addCell(createSkillElement(null, skill, FadingSunsTheme.CHARACTER_SMALL_SKILLS_LINE_FONT_SIZE,
                    MAX_SKILL_COLUMN_WIDTH));
            table.addCell(
                    createSkillLine(SKILL_VALUE_GAP, FadingSunsTheme.CHARACTER_SMALL_SKILLS_LINE_FONT_SIZE));
        }
    } else {
        for (AvailableSkill skill : characterPlayer.getNaturalSkills()) {
            table.addCell(createSkillElement(characterPlayer, skill,
                    FadingSunsTheme.CHARACTER_SMALL_SKILLS_LINE_FONT_SIZE, MAX_SKILL_COLUMN_WIDTH));
            table.addCell(createSkillValue(characterPlayer.getSkillTotalRanks(skill),
                    characterPlayer.isSkillSpecial(skill) || characterPlayer.hasSkillTemporalModificator(skill),
                    characterPlayer.hasSkillModificator(skill),
                    FadingSunsTheme.CHARACTER_SMALL_SKILLS_LINE_FONT_SIZE));
        }
    }

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

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

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);// w ww. j  a  va  2  s. c o 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.softwaremagico.tm.pdf.small.SmallPartySheet.java

License:Open Source License

private void initializeTableContent() {
    float[] widths = { 1f, 1f };
    mainTable = new PdfPTable(widths);
    BaseElement.setTablePropierties(mainTable);
    mainTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
    mainTable.getDefaultCell().setBorderWidth(2);
    mainTable.getDefaultCell().setPadding(0);
}

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  a2s  . c  o 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.LicenseCivilIncludeProductPDF.java

License:Open Source License

private void generateProducts(Document doc, List<LicensePCProductEntity> listProducts)
        throws DocumentException {

    DecimalFormat dc = new DecimalFormat("########0.00");

    // specify column widths
    float[] columnWidths = { 2f, 2f, 2f };
    // create PDF table with the given widths
    PdfPTable table = new PdfPTable(columnWidths);
    // set table width a percentage of the page width
    table.setWidthPercentage(100f);//  w w w  . j  av  a2 s .c  o  m

    // insert column headings
    insertCell(table, "Nome da Substncia de Controle", Element.ALIGN_CENTER, FONT_PARAGRAPH);
    insertCell(table, "Volume mximo de estoque", Element.ALIGN_CENTER, FONT_PARAGRAPH);
    insertCell(table, "Unidade de medida", Element.ALIGN_CENTER, FONT_PARAGRAPH);

    table.setHeaderRows(1);

    for (LicensePCProductEntity product : listProducts) {

        // Cria a tabela com os Produtos
        insertCell(table, product.getProduct().getName(), Element.ALIGN_LEFT, FONT_PARAGRAPH);
        insertCell(table, dc.format(product.getQtdProduct()), Element.ALIGN_LEFT, FONT_PARAGRAPH);
        insertCell(table, product.getTypeQtdProduct(), Element.ALIGN_LEFT, FONT_PARAGRAPH);
    }

    doc.add(Chunk.NEXTPAGE);
    doc.add(table);
}

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

License:Open Source License

private void createSignature(Document doc) throws DocumentException {

    Calendar currDate = Calendar.getInstance();

    StringBuilder sbSignature = new StringBuilder().append(company.getCity()).append(", ")
            .append(DateUtils.getDay(currDate.getTime())).append(" de ")
            .append(DateUtils.getMonthName(currDate)).append(" de ")
            .append(DateUtils.getYear(currDate.getTime()));

    StringBuilder sbUser = new StringBuilder().append("P.P_________________________________________________ \n")
            .append("Nome: ").append(company.getUserResponsable().getName()).append("\n")
            .append("RG: " + company.getUserResponsable().getRg());

    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100f);/*  w  ww  .j  a v  a  2  s  .  c  o  m*/
    table.setHeaderRows(0);
    table.getDefaultCell().setBorder(PdfPCell.NO_BORDER);

    insertCell(table, sbSignature.toString(), Element.ALIGN_LEFT, fontHeaderTable, false);
    insertCell(table, sbUser.toString(), Element.ALIGN_LEFT, fontHeaderTable, false);

    doc.add(Chunk.NEWLINE);
    doc.add(table);
}

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

License:Open Source License

private void createParagraph(Document doc) throws DocumentException {

    float[] columnWidths = { 2f, 2f };
    PdfPTable table = new PdfPTable(columnWidths);
    table.setWidthPercentage(100f);/*w ww.j ava2  s  . co  m*/

    StringBuilder sbHeader = new StringBuilder()
            .append("SECRETARIA DE ESTADO DOS NEGCIOS DA SEGURANA PBLICA \n")
            .append("POL?CIA CIVIL DO ESTADO DE ").append(company.getState()).append("\n")
            .append("DEPARTAMENTO DE IDENTIFICAO E REGISTROS DIVERSOS \n")
            .append("DIVISO DE PRODUTOS CONTROLADOS \n");

    StringBuilder sbHeaderMonth = new StringBuilder().append("MAPA TRIMESTRAL DEMONSTRATIVO DO ESTOQUE \n")
            .append("DE COMPRAS, VENDAS E CONSUMO \n").append("REFERENTE AO ")
            .append(mapProduct.getNumTrimester()).append(" TRIMESTRE DO ANO DE ").append(mapProduct.getYear())
            .append(".");

    StringBuilder sbCompany = new StringBuilder().append("Empresa: ").append(company.getName().toUpperCase())
            .append(" estabelecida  ").append(company.getStreet().toUpperCase()).append(" Cidade: ")
            .append(company.getCity()).append(", Estado: ").append(company.getState()).append(", CEP: ")
            .append(company.getCep()).append(", Fone: (").append(company.getUserResponsable().getPhoneDDD())
            .append(") ").append(company.getUserResponsable().getPhoneNumber()).append(", Fax: (")
            .append(company.getUserResponsable().getPhoneDDD()).append(") ")
            .append(company.getUserResponsable().getNumFax());

    // insert column headings
    insertCell(table, sbHeader.toString(), Element.ALIGN_LEFT, fontParagraph);
    insertCell(table, sbHeaderMonth.toString(), Element.ALIGN_LEFT, fontText);

    Paragraph paragraphText = new Paragraph(sbCompany.toString());
    paragraphText.setFont(fontHeaderTable);

    doc.add(Chunk.NEWLINE);
    doc.add(table);
    doc.add(Chunk.NEWLINE);
    doc.add(paragraphText);
    doc.add(Chunk.NEWLINE);
}