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

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

Introduction

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

Prototype

public int getFooterRows() 

Source Link

Document

Gets the number of rows in the footer.

Usage

From source file:com.vectorprint.report.itext.style.stylers.AdvancedImpl.java

License:Open Source License

/**
 * An advanced styler may be added as event to a table by {@link StyleHelper#style(java.lang.Object, java.lang.Object, java.util.Collection) }
 * when the element styled is a table and the {@link EVENTMODE} is ALL or TABLE. This enables drawing near a table.
 * Calls {@link #draw(com.itextpdf.text.Rectangle, java.lang.String) } with the rectangle of the table and null as genericTag.
 *
 * @see EVENTMODE#TABLE/*  w  w w.j av a 2 s  .c  om*/
 * @param table
 * @param widths
 * @param heights
 * @param headerRows
 * @param rowStart
 * @param canvases
 */
@Override
public final void tableLayout(PdfPTable table, float[][] widths, float[] heights, int headerRows, int rowStart,
        PdfContentByte[] canvases) {
    final int footer = widths.length - table.getFooterRows();
    final int header = table.getHeaderRows();
    int columns = widths[header].length - 1;
    float w = widths[header][columns];
    try {
        tableForeground = isBg() ? canvases[PdfPTable.BASECANVAS] : canvases[PdfPTable.TEXTCANVAS];
        draw(new Rectangle(widths[header][0], heights[footer - 1], w, heights[header]), null);
        tableForeground = null;
    } catch (VectorPrintException ex) {
        throw new VectorPrintRuntimeException(ex);
    }
}

From source file:com.vectorprint.report.itext.style.ZebraStripes.java

License:Open Source License

@Override
public void tableLayout(final PdfPTable table, final float[][] widths, final float[] heights,
        final int headerRows, final int rowStart, final PdfContentByte[] canvases) {
    rowsDealtWith += widths.length;/*from ww  w .j  av  a 2 s  .  com*/

    final int footer = widths.length - table.getFooterRows();
    final int header = table.getHeaderRows();
    int columns = widths[header].length - 1;
    float w = widths[header][columns];
    int i = 0;
    boolean up = true;

    setCurrentBackGround(oddColor);

    for (int row = header; row < footer; row++) {
        if (row >= footer - getEndRowsToSkip()) {
            continue;
        }

        paintRow(row, new Rectangle(widths[row][0], heights[row + 1], w, heights[row]), canvases,
                row == footer - 1, header == row);

        if (row < footer - 1 - getEndRowsToSkip()) {
            if (up) {
                i++;

                if (i == alternate) {
                    setCurrentBackGround(evenColor);
                    up = false;
                }
            } else {
                i--;

                if (i == 0) {
                    setCurrentBackGround(oddColor);
                    up = true;
                }
            }
        }
    }
}