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.small.occultism.OccultismTable.java

License:Open Source License

public OccultismTable(CharacterPlayer characterPlayer, String language) throws InvalidXmlElementException {
    super(WIDTHS);
    getDefaultCell().setBorder(0);/*  w  w w  . java2  s.c  om*/

    addCell(createTitle(getTranslator().getTranslatedText("occultism"),
            FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_TITLE_FONT_SIZE));

    for (OccultismType occultismType : OccultismTypeFactory.getInstance().getElements(language)) {
        addCell(createSubtitleLine(occultismType.getName(),
                FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_LEFT));

        if (characterPlayer != null) {
            addCell(createValueLine("" + characterPlayer.getPsiqueLevel(occultismType),
                    FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE));
        } else {
            addCell(createValueLine(" ", FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE));
        }

        addCell(createSubtitleLine("/", FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE));
        if (characterPlayer != null) {
            addCell(createValueLine("" + characterPlayer.getDarkSideLevel(occultismType),
                    FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE));
        } else {
            addCell(createValueLine(" ", FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE));
        }

        addCell(createSubtitleLine(occultismType.getDarkSideName(),
                FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_RIGHT));

    }

    addCell(createSubtitleLine(getTranslator().getTranslatedText("occultismTablePower"),
            FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, 4, Element.ALIGN_LEFT));
    addCell(createSubtitleLine(getTranslator().getTranslatedText("weaponGoal"),
            FadingSunsTheme.CHARACTER_SMALL_TABLE_LINE_FONT_SIZE, Element.ALIGN_RIGHT));

    int added = 0;
    if (characterPlayer != null) {
        for (Entry<String, List<String>> occultismPathEntry : characterPlayer.getSelectedPowers().entrySet()) {
            OccultismPath occultismPath = OccultismPathFactory.getInstance()
                    .getElement(occultismPathEntry.getKey(), characterPlayer.getLanguage());
            for (String occultismPowerName : occultismPathEntry.getValue()) {
                OccultismPower occultismPower = occultismPath.getOccultismPowers().get(occultismPowerName);
                if (occultismPower.isEnabled()) {
                    PdfPCell cell = createFirstElementLine(occultismPower.getName(), POWER_COLUMN_WIDTH,
                            FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_LINE_FONT_SIZE);
                    cell.setColspan(WIDTHS.length - 1);
                    addCell(cell);
                    addCell(createElementLine(occultismPower.getRoll(), ROLL_COLUMN_WIDTH,
                            FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_LINE_FONT_SIZE));
                    added++;
                }
                if (added >= ROWS) {
                    break;
                }
            }
        }
    }

    if (characterPlayer == null) {
        for (int i = added; i < ROWS; i++) {
            PdfPCell cell = createEmptyElementLine(GAP, POWER_COLUMN_WIDTH);
            cell.setColspan(WIDTHS.length - 1);
            addCell(cell);
            addCell(createEmptyElementLine(GAP, ROLL_COLUMN_WIDTH));
        }
    } else {
        for (int i = added; i < ROWS; i++) {
            for (int j = 0; j < WIDTHS.length; j++) {
                addCell(createEmptyElementLine(FadingSunsTheme.CHARACTER_SMALL_OCCULTISM_LINE_FONT_SIZE));
            }
        }
    }
}

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  ww.j  a v a  2  s  . com
    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 insertCell(PdfPTable table, String text, Integer colSpan) {

     if (text == null) {
         text = "";
     }// w w w  .j av a2s . co 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);//w w w.j a  v  a 2 s  .  c o m
     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 = "";
     }//ww  w  .  j av  a  2s .  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.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 insertHeaderCell(PdfPTable table, String text, Integer colSpan) {

     if (text == null) {
         text = "";
     }//from  w w w  .ja va  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.RequerimentAlterLicenseFederalPDF.java

private void createFooter(PdfPTable table) {
    this.insertHeaderCell(table, "Portaria 1.274/03", 4);

    Paragraph artigo = new Paragraph("Art. 6", FONT_HEADER);
    Paragraph text1 = new Paragraph(
            "A pessoa jurdica possuidora de Certificado de Registro Cadastral dever", FONT_PARAGRAPH);
    Paragraph text2 = new Paragraph(" comunicar ao DPF, no prazo de trinta dias, todo e qualquer "
            + "fato que justifique a atualizao de seu cadastro", FONT_HEADER);
    Paragraph text3 = new Paragraph(
            ", mediante preenchimento de formulrio prprio (Anexo VI). " + SEPARATOR_DOUBLE, FONT_PARAGRAPH);

    Paragraph text4 = new Paragraph("Pargrafo nico", FONT_HEADER);
    Paragraph text5 = new Paragraph("O pedido de atualizao do registro cadastral dever ser",
            FONT_PARAGRAPH);/*from   w  ww.  j a  va 2 s .c o  m*/
    Paragraph text6 = new Paragraph(
            "formalizado no prazo mximo de noventa dias, a partir da data do comunicado", FONT_HEADER);
    Paragraph text7 = new Paragraph(" a que se refere o caput, por meio de requerimento (Anexo IV).",
            FONT_PARAGRAPH);

    Paragraph paragraphFull = new Paragraph();
    paragraphFull.add(artigo);
    paragraphFull.add(text1);
    paragraphFull.add(text2);
    paragraphFull.add(text3);
    paragraphFull.add(text4);
    paragraphFull.add(text5);
    paragraphFull.add(text6);
    paragraphFull.add(text7);

    PdfPCell cell = new PdfPCell(paragraphFull);
    cell.setColspan(4);

    table.addCell(cell);

}

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

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

    if (text == null) {
        text = "";
    }//from   w w w.jav  a 2  s .com

    // 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.RequerimentAlterLicenseFederalPDF.java

private void insertCellProtocol(PdfPTable table, LicensePFEntity license) {

    PdfPTable tableProtocol = new PdfPTable(1);
    tableProtocol.setWidthPercentage(100f);

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

    Paragraph protocolPhrase = new Paragraph("ETIQUETA PROTOCOLO" + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE
            + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR_DOUBLE + SEPARATOR, FONT_PROTOCOL);
    protocolPhrase.setAlignment(Element.ALIGN_LEFT);

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

    Paragraph obsStringPhrase = new Paragraph(
            "Protocolar este Anexo somente quando no conjugado com a alterao efetiva ou a renovao da licena.",
            FONT_PARAGRAPH);// w  ww .  j  av  a  2  s  .  com

    Paragraph fullPhrase = new Paragraph();
    fullPhrase.add(officialPhrase);
    fullPhrase.add(protocolPhrase);
    fullPhrase.add(obsPhrase);
    fullPhrase.add(obsStringPhrase);

    PdfPCell cell = new PdfPCell(fullPhrase);

    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setPadding(5f);

    tableProtocol.addCell(cell);

    PdfPCell cellProtocol = new PdfPCell(tableProtocol);
    cellProtocol.setColspan(2);

    table.addCell(cellProtocol);
    table.addCell(this.createCellEtiqueta(license));
}

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

private PdfPCell createCellEtiqueta(LicensePFEntity license) {
    PdfPTable tableProtocol = new PdfPTable(3);
    tableProtocol.setWidthPercentage(100f);

    this.insertCell(tableProtocol, "LOCAL E DATA" + SEPARATOR_DOUBLE + license.getCompany().getState() + ", "
            + DateUtils.format(Calendar.getInstance()), 3);

    this.insertCell(tableProtocol,
            "REPRESENTANTE LEGAL" + SEPARATOR_DOUBLE + license.getCompany().getUserResponsable().getName(), 3);

    this.insertCell(tableProtocol, "IDENTIDADE (N - RGO - UF)" + SEPARATOR_DOUBLE
            + license.getCompany().getUserResponsable().getRg(), 2);
    this.insertCell(tableProtocol,
            "CPF" + SEPARATOR_DOUBLE + license.getCompany().getUserResponsable().getCpf(), 1);

    this.insertCell(tableProtocol,
            "DDD" + SEPARATOR_DOUBLE + license.getCompany().getUserResponsable().getPhoneDDD(), 1);
    this.insertCell(tableProtocol,
            "TELEFONE" + SEPARATOR_DOUBLE + license.getCompany().getUserResponsable().getPhoneNumber(), 1);
    this.insertCell(tableProtocol,
            "FAX" + SEPARATOR_DOUBLE + license.getCompany().getUserResponsable().getNumFax(), 1);

    this.insertCell(tableProtocol, "ASSINATURA" + SEPARATOR_DOUBLE + "________________________________________",
            3);/*from  ww  w  .  ja v  a 2 s.  com*/

    PdfPCell cell = new PdfPCell(tableProtocol);
    cell.setColspan(4);

    return cell;
}