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

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

Introduction

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

Prototype

public void setMinimumHeight(float minimumHeight) 

Source Link

Document

Set a minimum height for the cell.

Usage

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

License:Open Source License

public ShieldTable(CharacterPlayer characterPlayer) {
    super(WIDTHS);
    getDefaultCell().setBorder(0);/*ww w  . j  a v  a 2s  . co  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.info.CharacterBasicsTableFactory.java

License:Open Source License

protected static PdfPCell createField(CharacterPlayer characterPlayer, String tag, int fontSize) {
    float[] widths = { 0.7f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from   w  w w  .  java  2  s  .  c  o  m*/

    table.addCell(getCell(getTranslatedTag(tag), Element.ALIGN_RIGHT, fontSize));
    if (characterPlayer == null) {
        table.addCell(getCell(LINE, Element.ALIGN_LEFT, fontSize));
    } else {
        if (tag.equals("name")) {
            table.addCell(getHandwrittingCell(characterPlayer.getNameRepresentation(), Element.ALIGN_LEFT,
                    fontSize - 1));
        } else if (tag.equals("race")) {
            if (characterPlayer.getRace() != null) {
                table.addCell(getHandwrittingCell(characterPlayer.getRace().getName(), Element.ALIGN_LEFT,
                        fontSize - 1));
            } else {
                table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1));
            }
        } else if (tag.equals("faction")) {
            if (characterPlayer.getFaction() != null) {
                table.addCell(getHandwrittingCell(characterPlayer.getFaction().getName(), Element.ALIGN_LEFT,
                        fontSize - 1));
            } else {
                table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1));
            }
        } else if (tag.equals("rank")) {
            try {
                if (characterPlayer.getRank() != null) {
                    table.addCell(
                            getHandwrittingCell(characterPlayer.getRank(), Element.ALIGN_LEFT, fontSize - 1));
                } else {
                    table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1));
                }
            } catch (InvalidXmlElementException e) {
                PdfExporterLog.errorMessage(CharacterBasicsTableFactory.class.getName(), e);
            }
        } else if (tag.equals("planet")) {
            if (characterPlayer.getInfo().getPlanet() != null) {
                table.addCell(getHandwrittingCell(characterPlayer.getInfo().getPlanet().getName(),
                        Element.ALIGN_LEFT, fontSize - 1));
            } else {
                table.addCell(getHandwrittingCell("", Element.ALIGN_LEFT, fontSize - 1));
            }
        } else if (tag.equals("gender")) {
            table.addCell(getHandwrittingCell(characterPlayer.getInfo().getTranslatedParameter(tag),
                    Element.ALIGN_LEFT, fontSize - 1));
        } else {
            table.addCell(getHandwrittingCell(characterPlayer.getInfo().getTranslatedParameter(tag),
                    Element.ALIGN_LEFT, fontSize - 1));
        }
    }

    PdfPCell cell = new PdfPCell();
    cell.addElement(table);
    setCellProperties(cell);
    cell.setMinimumHeight(20);

    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.others.AnnotationsTable.java

License:Open Source License

protected static PdfPCell createSubtitleLine(String text) {
    PdfPCell cell = BaseElement.getCell(text, 1, 1, Element.ALIGN_LEFT, BaseColor.WHITE,
            FadingSunsTheme.getTitleFont(), FadingSunsTheme.ANNOTATIONS_SUBTITLE_FONT_SIZE);
    cell.setMinimumHeight(CELL_HEIGHT);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    return cell;/*from   ww  w  .  j a va 2  s.c  o m*/
}

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);/*from  w  w w  .  j  a  va2  s .  c o  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.occultism.OccultismTable.java

License:Open Source License

@Override
protected PdfPCell createLateralVerticalTitle(String title, int rowspan) {
    PdfPCell titleCell = super.createLateralVerticalTitle(title, rowspan);
    titleCell.setMinimumHeight(ROW_WIDTH);
    return titleCell;
}

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

License:Open Source License

protected static PdfPCell createTitle(String text, int fontSize) {
    PdfPCell cell = createCompactTitle(text, fontSize);
    cell.setMinimumHeight(MainSkillsTableFactory.HEIGHT / (ROWS / TITLE_ROWSPAN) + 1);
    return cell;//from w w  w  . ja  v  a2s.  com
}

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

License:Open Source License

protected static PdfPCell createSkillElement(CharacterPlayer characterPlayer, AvailableSkill skill,
        int fontSize, int maxColumnWidth) {
    PdfPCell cell = getCell(createSkillSufix(characterPlayer, skill, fontSize, maxColumnWidth), 0, 1,
            Element.ALIGN_LEFT, BaseColor.WHITE);
    cell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / ROWS));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;/*  w w w. j ava2  s.c  om*/
}

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

License:Open Source License

protected static PdfPCell createSkillElement(SkillDefinition skill, int fontSize, int maxColumnWidth) {
    PdfPCell cell = getCell(createSkillSufix(skill, fontSize, maxColumnWidth), 0, 1, Element.ALIGN_LEFT,
            BaseColor.WHITE);/*  ww  w.  java2  s  .c  o m*/
    cell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / ROWS));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

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

License:Open Source License

protected static PdfPCell createSkillLine(String text, int fontSize) {
    PdfPCell cell = getCell(text, 0, 1, Element.ALIGN_LEFT, BaseColor.WHITE, FadingSunsTheme.getLineFont(),
            fontSize);/*  w  w w.j  ava 2s. c o  m*/
    cell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / ROWS));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

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

License:Open Source License

protected static PdfPCell createSkillValue(Integer value, boolean special, boolean modified, int fontSize) {
    if (value == null) {
        return createSkillLine(SKILL_VALUE_GAP, fontSize);
    }/*from   w  w w  .  jav  a  2  s  .c  o  m*/
    PdfPCell cell = getCell(value + (special ? "*" : "") + (modified && value > 0 ? "!" : ""), 0, 1,
            Element.ALIGN_CENTER, BaseColor.WHITE, FadingSunsTheme.getHandwrittingFont(),
            FadingSunsTheme.getHandWrittingFontSize(fontSize));
    cell.setMinimumHeight((MainSkillsTableFactory.HEIGHT / ROWS));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}