Example usage for com.itextpdf.text Element ALIGN_MIDDLE

List of usage examples for com.itextpdf.text Element ALIGN_MIDDLE

Introduction

In this page you can find the example usage for com.itextpdf.text Element ALIGN_MIDDLE.

Prototype

int ALIGN_MIDDLE

To view the source code for com.itextpdf.text Element ALIGN_MIDDLE.

Click Source Link

Document

A possible value for vertical alignment.

Usage

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

License:Open Source License

public static void setTablePropierties(PdfPTable table) {
    table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.setWidthPercentage(100);//  w  ww .  j a va2 s.co  m
    table.setPaddingTop(0);
    table.setSpacingAfter(0);
    table.setSpacingBefore(0);
}

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

License:Open Source License

protected static PdfPCell createEmptyElementLine(int alignment, String text) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, alignment, BaseColor.WHITE, FadingSunsTheme.getLineFont(),
            FadingSunsTheme.TABLE_LINE_FONT_SIZE);
    cell.setMinimumHeight(10);/*from  w w  w.j av  a2s  .com*/
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

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

License:Open Source License

private static PdfPCell createBasicElementLine(String text, int fontSize, int horizontalAlignment) {
    PdfPCell cell = BaseElement.getCell(text, 0, 1, horizontalAlignment, BaseColor.WHITE,
            FadingSunsTheme.getHandwrittingFont(), fontSize);
    cell.setMinimumHeight(12);//w ww  .j a  v  a 2 s. c  o m
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

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();
    }//w w  w  .j av a 2s .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   w  ww.ja  v a  2 s.  c  o  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 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);/*from  w  w  w .j  a  v a2s.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 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  ww  .  j av  a2s .  co  m*/
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return cell;
}

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

License:Open Source License

private PdfPTable getArmourProperty(String text, boolean selected) {
    float[] widths = { 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    BaseElement.setTablePropierties(table);
    table.getDefaultCell().setBorder(0);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);

    if (!selected) {
        table.addCell(createRectangle());
    } else {/*from  ww w. j ava 2 s  . co  m*/
        table.addCell(createRectangle("X"));
    }
    table.addCell(createEmptyElementLine(text));

    return table;
}

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

License:Open Source License

private PdfPTable getShieldRange(CharacterPlayer characterPlayer) {
    float[] widths = { 1f, 1f, 1f, 1f, 1f };
    PdfPTable table = new PdfPTable(widths);
    BaseElement.setTablePropierties(table);
    table.getDefaultCell().setBorder(0);
    table.getDefaultCell().setPadding(0);
    table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);

    table.addCell(createEmptyElementLine("("));
    if (characterPlayer == null || characterPlayer.getShield() == null) {
        table.addCell(createRectangle());
    } else {/*  w ww .ja  va2 s. c  o m*/
        table.addCell(createRectangle(characterPlayer.getShield().getImpact()));
    }
    table.addCell(createEmptyElementLine("/"));
    if (characterPlayer == null || characterPlayer.getShield() == null) {
        table.addCell(createRectangle());
    } else {
        table.addCell(createRectangle(characterPlayer.getShield().getForce()));
    }
    table.addCell(createEmptyElementLine(")"));

    return table;
}

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  .  j av 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;
}