//Add Process Report
private void addProcessDto() throws DocumentException {
PdfPTable headerTable = new PdfPTable(1);
headerTable.setWidthPercentage(100f);
PdfPCell headerCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.suvidesavancements", null, localtion), contentBoldFont));
headerCell.setBorder(Rectangle.NO_BORDER);
headerTable.addCell(headerCell);
headerTable.setSpacingAfter(0f);
addContent(headerTable);
headerTable = new PdfPTable(2);
headerTable.setWidthPercentage(40f);
headerTable.setHorizontalAlignment(Rectangle.ALIGN_LEFT);
headerTable.setSpacingAfter(15f);
float[] wf1 = {
5,10 };
headerCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.etatdavancement", null, localtion) + " : ", contentBoldFont));
headerCell.setBorder(Rectangle.NO_BORDER);
headerTable.addCell(headerCell);
headerCell = new PdfPCell(new Phrase(etatAvancement + " " + messageSource.getMessage("pdf.process.titlebox.percentavancementmarche", null, localtion), contentNormalFont));
headerCell.setBorder(Rectangle.NO_BORDER);
headerTable.addCell(headerCell);
headerTable.setSpacingAfter(0f);
headerTable.setWidths(wf1);
addContent(headerTable);
PdfPTable parent = new PdfPTable(3);
parent.setSpacingBefore(0f);
parent.setWidthPercentage(100f);
float[] wfParent = {
70,
5,
25
};
parent.setWidths(wfParent);
PdfPCell cellLeft,cellMiddle,cellRight;
/////////
//Add Group Header
PdfPCell[] groupHeaderCell = new PdfPCell[3];
groupHeaderCell[0] = new PdfPCell();
groupHeaderCell[0].setBorder(Rectangle.NO_BORDER);
groupHeaderCell[1] = new PdfPCell(new Phrase("ADVANCEMENT", contentBoldFont));
groupHeaderCell[1].setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
groupHeaderCell[2] = new PdfPCell(new Phrase("RETENUES", contentBoldFont));
groupHeaderCell[2].setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
float[] wfGroupHeader = {
25,
20,
20
};
for (PdfPCell pdfPCell : groupHeaderCell) {
pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
}
PdfPTable groupHeaderTable = new PdfPTable(3);
groupHeaderTable.setWidthPercentage(100f);
groupHeaderTable.setWidths(wfGroupHeader);
addCellsToTable(groupHeaderTable,groupHeaderCell);
cellLeft = new PdfPCell(groupHeaderTable);
cellLeft.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
cellRight = new PdfPCell(new Phrase("Commentaires / Informations : ", contentBoldFont));
cellRight.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellRight);
//Header
//create table header
PdfPCell[] processTableHeader = new PdfPCell[7];
processTableHeader[0] = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.number", null, localtion), contentBoldFont));
processTableHeader[1] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.libelle", null, localtion), contentBoldFont));
processTableHeader[2] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.date", null, localtion), contentBoldFont));
processTableHeader[3] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.cumule", null, localtion), contentBoldFont));
processTableHeader[4] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.mois", null, localtion), contentBoldFont));
processTableHeader[5] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.cumule", null, localtion), contentBoldFont));
processTableHeader[6] = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.mois", null, localtion), contentBoldFont));
for (PdfPCell pdfPCell : processTableHeader) {
pdfPCell.setBackgroundColor(new Color(Constants.RED,Constants.GREEN,Constants.BLUE));
pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
}
//End
PdfPTable processDtoTable = new PdfPTable(7);
processDtoTable.setWidthPercentage(100f);
addCellsToTable(processDtoTable, processTableHeader);
float[] wf = {
5, //No 3
10, //Libellé risque codification
10, //Origine de détection
10, //CR 3
10, // Niveau de risque 5
10,
10
};
processDtoTable.setWidthPercentage(70f);
processDtoTable.setWidths(wf);
processDtoTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
cellLeft = new PdfPCell(processDtoTable);
cellLeft.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
cellRight = new PdfPCell();
cellRight.setBorder(Rectangle.NO_BORDER);
cellRight.enableBorderSide(Rectangle.TOP);
cellRight.enableBorderSide(Rectangle.RIGHT);
cellRight.enableBorderSide(Rectangle.LEFT);
parent.addCell(cellRight);
processDtoTable.getDefaultCell().setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
String tmp;
processDtoTable = new PdfPTable(7);
if(processes !=null && processes.length() > 0){
String arr[] = processes.split(Constants.SEPRATE);
for(int i=0;i < arr.length;i++){
tmp = arr[i];
processDtoTable.addCell(new PdfPCell(new Phrase(tmp, contentNormalFont)));
}
processDtoTable.setWidthPercentage(70f);
processDtoTable.setWidths(wf);
processDtoTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
}
cellLeft = new PdfPCell(processDtoTable);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
PdfPTable commanttaire = addProcessCommantaire();
commanttaire.setWidthPercentage(70f);
cellRight = new PdfPCell(commanttaire);
cellRight.setBorder(Rectangle.NO_BORDER);
cellRight.enableBorderSide(Rectangle.RIGHT);
cellRight.enableBorderSide(Rectangle.LEFT);
parent.addCell(cellRight);
//Total Situation
processDtoTable = addtotalsituation(totalsituation);
processDtoTable.setWidthPercentage(70f);
processDtoTable.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
cellLeft = new PdfPCell(processDtoTable);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
cellRight = new PdfPCell();
cellRight.setBorder(Rectangle.NO_BORDER);
cellRight.enableBorderSide(Rectangle.RIGHT);
cellRight.enableBorderSide(Rectangle.LEFT);
parent.addCell(cellRight);
//Space
cellLeft = new PdfPCell();
cellLeft.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
cellRight = new PdfPCell();
cellRight.setBorder(Rectangle.NO_BORDER);
cellRight.enableBorderSide(Rectangle.RIGHT);
cellRight.enableBorderSide(Rectangle.LEFT);
parent.addCell(cellRight);
cellLeft = new PdfPCell();
cellLeft.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
cellRight = new PdfPCell();
cellRight.setBorder(Rectangle.NO_BORDER);
cellRight.enableBorderSide(Rectangle.RIGHT);
cellRight.enableBorderSide(Rectangle.LEFT);
parent.addCell(cellRight);
cellLeft = new PdfPCell();
cellLeft.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellMiddle);
cellRight = new PdfPCell();
cellRight.setBorder(Rectangle.NO_BORDER);
cellRight.enableBorderSide(Rectangle.RIGHT);
cellRight.enableBorderSide(Rectangle.LEFT);
parent.addCell(cellRight);
//End
cellLeft = new PdfPCell(new Phrase(messageSource.getMessage("pdf.process.titlebox.detaildesretenuesappliques", null,localtion),contentBoldFont));
cellLeft.setBorder(Rectangle.NO_BORDER);
parent.addCell(cellLeft);
cellMiddle = new PdfPCell();
cellMiddle.setBorder(Rectangle.NO_BORDER);