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

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

Introduction

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

Prototype

public void setVerticalAlignment(int verticalAlignment) 

Source Link

Document

Sets the vertical alignment for the cell.

Usage

From source file:biblivre3.administration.reports.RequestsByDateReport.java

License:Open Source License

private PdfPTable createTable(List<String[]> dataList) {
    PdfPTable table = new PdfPTable(7);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    table.setWidthPercentage(100f);/*ww w.  jav  a  2s  .  c o m*/
    createHeader(table);
    PdfPCell cell;
    String lastQuotationId = "0";
    String requester = null;
    String title = null;
    String quantity = null;
    String unit_value = null;
    String total_value = null;
    for (String[] data : dataList) {
        if (!data[0].equals(lastQuotationId)) {
            if (!lastQuotationId.equals("0")) {
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(requester)));
                cell.setColspan(2);
                cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(title)));
                cell.setColspan(2);
                cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(quantity)));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(unit_value)));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(total_value)));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
                table.addCell(cell);
            }

            requester = "";
            title = "";
            quantity = "";
            unit_value = "";
            total_value = "";
        }

        lastQuotationId = data[0];
        requester = data[1] + "\n";
        title += data[2] + "\n";
        quantity += data[3] + "\n";
        unit_value += data[4] + "\n";
        total_value = (data[5] == null ? "-" : data[5]) + "\n";
    }

    if (!lastQuotationId.equals("0")) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(requester)));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(title)));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(quantity)));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(unit_value)));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(total_value)));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_TOP);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.RequestsByDateReport.java

License:Open Source License

private void createHeader(PdfPTable table) {
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_PETITIONER"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);//from   w  ww .ja  v a  2  s  . c o  m
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TITLE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_AMOUNT"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_UNIT_VALUE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_PAID_VALUE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
}

From source file:biblivre3.administration.reports.ReservationReport.java

License:Open Source License

@Override
protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception {
    ReservationReportDto dto = (ReservationReportDto) reportData;
    Paragraph p1 = new Paragraph(this.getText("REPORTS_RESERVATION_TITLE"));
    p1.setAlignment(Paragraph.ALIGN_CENTER);
    document.add(p1);// w w w. j  ava 2s. co m
    document.add(new Phrase("\n\n"));
    boolean hasBiblioData = dto.getBiblioReservations() != null && !dto.getBiblioReservations().isEmpty();
    boolean hasHoldingData = dto.getHoldingReservations() != null && !dto.getHoldingReservations().isEmpty();
    if (hasBiblioData) {
        PdfPTable biblioTable = new PdfPTable(7);
        biblioTable.setWidthPercentage(100f);
        PdfPCell cell = new PdfPCell(
                new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_BIBLIO"))));
        cell.setBackgroundColor(headerBgColor);
        cell.setBorderWidth(headerBorderWidth);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setColspan(7);
        biblioTable.addCell(cell);
        createHeader(biblioTable);
        createBody(biblioTable, dto.getBiblioReservations());
        document.add(biblioTable);
        document.add(new Phrase("\n"));
    }
    if (hasHoldingData) {
        PdfPTable holdingTable = new PdfPTable(7);
        holdingTable.setWidthPercentage(100f);
        PdfPCell cell = new PdfPCell(
                new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_HOLDING"))));
        cell.setBackgroundColor(headerBgColor);
        cell.setBorderWidth(headerBorderWidth);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        cell.setColspan(7);
        holdingTable.addCell(cell);
        createHeader(holdingTable);
        createBody(holdingTable, dto.getHoldingReservations());
        document.add(holdingTable);
    }
    if (!hasBiblioData && !hasHoldingData) {
        PdfPTable noDataTable = new PdfPTable(1);
        noDataTable.setWidthPercentage(100f);
        String message = this.getText("REPORTS_NO_DATA") + " - " + dateFormat.format(new Date());
        PdfPCell cell = new PdfPCell(new Paragraph(this.getHeaderChunk(message)));
        cell.setBackgroundColor(headerBgColor);
        cell.setBorderWidth(headerBorderWidth);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        noDataTable.addCell(cell);
        document.add(noDataTable);
    }
}

From source file:biblivre3.administration.reports.ReservationReport.java

License:Open Source License

private void createHeader(PdfPTable table) {
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ENROL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);//www.  ja  va 2s  . c om
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NAME"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TITLE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_AUTHOR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_RESERVATION_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
}

From source file:biblivre3.administration.reports.ReservationReport.java

License:Open Source License

private void createBody(PdfPTable table, List<String[]> dataList) {
    if (dataList == null || dataList.isEmpty()) {
        return;/*from w  w  w  . j  av a2s  .c  o  m*/
    }
    for (String[] data : dataList) {
        PdfPCell cell;
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[2])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[3])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[4])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
}

From source file:biblivre3.administration.reports.SearchesByDateReport.java

License:Open Source License

private PdfPTable createTable(SearchesByDateReportDto dto) {
    PdfPTable table = new PdfPTable(2);
    table.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
    //Table header
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);// w  w  w. j  a v  a2s .c o m
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TOTAL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    //Table body
    if (dto.getData() == null || dto.getData().isEmpty())
        return table;
    for (String[] data : dto.getData()) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[1])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(data[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.SummaryReport.java

License:Open Source License

@Override
protected void generateReportBody(Document document, BaseReportDto reportData) throws Exception {
    SummaryReportDto dto = (SummaryReportDto) reportData;
    Paragraph p1 = new Paragraph(this.getText("REPORTS_SUMMARY_TITLE"));
    p1.setAlignment(Paragraph.ALIGN_CENTER);
    document.add(p1);//w  ww. j av a 2s .c om
    document.add(new Phrase("\n"));
    PdfPTable table = new PdfPTable(10);
    table.setWidthPercentage(100f);
    createHeader(table);
    Collections.sort(dto.getData(), this);
    PdfPCell cell;
    for (String[] data : dto.getData()) {
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[6])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[0])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[1])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[2])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[3])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[4])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[5])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getSmallFontChunk(data[7])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    document.add(table);
}

From source file:biblivre3.administration.reports.SummaryReport.java

License:Open Source License

private void createHeader(PdfPTable table) {
    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_DEWEY"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);// w ww  .  j  a  v  a  2s . co m
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_TITLE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_AUTHOR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_ISBN"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_EDITOR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_YEAR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_EDITION"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getBoldChunk(this.getText("REPORTS_HOLDINGS_TOTAL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
}

From source file:biblivre3.administration.reports.UserReport.java

License:Open Source License

private PdfPTable createLendingsTable(List<String[]> lendings) {
    PdfPTable table = new PdfPTable(5);
    table.setWidthPercentage(100f);/*from  w w  w .  java 2s . c  o m*/

    PdfPCell cell;
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_TITLE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_AUTHOR"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setColspan(2);
    cell.setBorderWidth(headerBorderWidth);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    for (String[] lending : lendings) {
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[0])));
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[1])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
        cell = new PdfPCell(new Paragraph(this.getNormalChunk(lending[2])));
        cell.setColspan(2);
        cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
        cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
        table.addCell(cell);
    }
    return table;
}

From source file:biblivre3.administration.reports.UserReport.java

License:Open Source License

private PdfPTable createUserDataTable(UserDTO user) {
    PdfPTable table = new PdfPTable(4);
    table.setWidthPercentage(100f);//from   w w w  .j  av  a2  s.  co  m
    PdfPCell cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NAME"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getName())));
    cell.setColspan(3);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ENROL"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(String.valueOf(user.getUserid()))));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_SIGNUP_DATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    Date signupDate = user.getSignup_date();
    cell = new PdfPCell(
            new Paragraph(this.getNormalChunk(signupDate != null ? dateFormat.format(signupDate) : "")));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_SOCIAL_NUMBER"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getSocial_id_number())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ID"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getDlicense() + " " + user.getTypeId())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_BIRTHDATE"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getBirthday())));
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_OBS"))));
    cell.setBackgroundColor(headerBgColor);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);
    cell = new PdfPCell(new Paragraph(this.getNormalChunk(user.getObs())));
    cell.setColspan(4);
    cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
    cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
    table.addCell(cell);

    return table;
}