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

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

Introduction

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

Prototype

public void setVerticalAlignment(int verticalAlignment) 

Source Link

Document

Sets the vertical alignment for the cell.

Usage

From source file:com.softwaremagico.tm.pdf.complete.elements.CustomPdfTable.java

License:Open Source License

protected PdfPCell createRectangle(String value) {
    if (value == null) {
        return createRectangle();
    }/*from   ww  w.  ja  va 2 s. c  om*/
    PdfPCell box = new PdfPCell(new Paragraph(value,
            new Font(FadingSunsTheme.getHandwrittingFont(), FadingSunsTheme.HANDWRITTING_DEFAULT_FONT_SIZE)));
    box.setVerticalAlignment(Element.ALIGN_MIDDLE);
    box.setHorizontalAlignment(Element.ALIGN_CENTER);
    box.setMinimumHeight(15);
    box.setBorder(0);
    box.setCellEvent(
            new CellCompleteBoxEvent(new Border[] { Border.TOP, Border.BOTTOM, Border.LEFT, Border.RIGHT }));
    return box;
}

From source file:com.softwaremagico.tm.pdf.complete.elements.LateralHeaderPdfPTable.java

License:Open Source License

protected static PdfPCell createTableSubtitleElement(String text, int height) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, BaseColor.WHITE,
            FadingSunsTheme.getSubtitleFont(), FadingSunsTheme.TABLE_LINE_FONT_SIZE);
    cell.setMinimumHeight(height);/*from   ww w  . j  a  va  2 s. com*/
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.elements.VerticalTable.java

License:Open Source License

protected static PdfPCell createSubtitleLine(String text, int fontSize, int colspan, int alignment) {
    PdfPCell cell = BaseElement.getCell(text, 0, colspan, alignment, BaseColor.WHITE,
            FadingSunsTheme.getSubtitleFont(), fontSize);
    cell.setMinimumHeight(10);//w  w  w .  j  a  v  a  2 s.co m
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

From source file:com.softwaremagico.tm.pdf.complete.elements.VerticalTable.java

License:Open Source License

protected static PdfPCell createValueLine(String text, int fontSize) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, Element.ALIGN_CENTER, BaseColor.WHITE,
            FadingSunsTheme.getHandwrittingFont(), fontSize);
    cell.setMinimumHeight(10);//from w w w.jav a  2s  .c  o m
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

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

License:Open Source License

protected ExperienceTable(CharacterPlayer characterPlayer) {
    super(WIDTHS);

    addCell(createLateralVerticalTitle(getTranslator().getTranslatedText("experience"), 1));
    if (characterPlayer != null) {
        PdfPCell cell = createElementLine("" + characterPlayer.getRemainginExperience() + "-", 50,
                FadingSunsTheme.EXPERIENCE_VALUE_FONT_SIZE);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        addCell(cell);/*from   w  ww .  ja  va  2s  .  co m*/
    } else {
        addCell(createEmptyElementLine(""));
    }

}

From source file:com.softwaremagico.tm.pdf.complete.info.CharacterBasicsTableFactory.java

License:Open Source License

protected static PdfPCell getHandwrittingCell(String text, int align, int fontSize) {
    if (text != null && text.length() > MAX_VALUE_LENGTH) {
        text = text.substring(0, MAX_VALUE_LENGTH + 1);
    }// w ww . ja  v a 2  s .c o  m
    PdfPCell cell = getCell(text, 0, 1, align, BaseColor.WHITE, FadingSunsTheme.getHandwrittingFont(),
            FadingSunsTheme.getHandWrittingFontSize(fontSize));
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    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);/*from  w ww . j  a  va 2  s. c o  m*/
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    return cell;
}

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

License:Open Source License

private static PdfPCell getFirstColumnTable(CharacterPlayer characterPlayer, String language,
        Stack<PdfPCell> learnedSkillsRows) throws InvalidXmlElementException {
    float[] widths = { 4f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*  w  w w .j a  va  2 s.c o  m*/

    table.addCell(createTitle(getTranslator().getTranslatedText("naturalSkills"),
            FadingSunsTheme.SKILLS_TITLE_FONT_SIZE));

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

    table.addCell(createTitle(getTranslator().getTranslatedText("learnedSkills"),
            FadingSunsTheme.SKILLS_TITLE_FONT_SIZE));
    int totalRows = Math.min(getTotalLearnedSkillsToShow(language), ROWS - (2 * TITLE_ROWSPAN)
            - SkillsDefinitionsFactory.getInstance().getNaturalSkills(language).size());

    for (int i = 0; i < totalRows; i++) {
        // Two columns: skill and value.
        table.addCell(learnedSkillsRows.pop());
        table.addCell(learnedSkillsRows.pop());
    }

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

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

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

License:Open Source License

private static PdfPCell getSecondColumnTable(CharacterPlayer characterPlayer, String language,
        Stack<PdfPCell> learnedSkillsRows) throws InvalidXmlElementException {
    float[] widths = { 4f, 1f };
    PdfPTable table = new PdfPTable(widths);
    setTablePropierties(table);/*from  www .  jav a2 s  . co  m*/
    PdfPCell cell = new PdfPCell();
    setCellProperties(cell);

    for (int i = 0; i < ROWS; i++) {
        // Two columns: skill and value.
        table.addCell(learnedSkillsRows.pop());
        table.addCell(learnedSkillsRows.pop());
    }

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

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 w ww . java2s  .  com
    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;
}