private void addAllFichestDto() throws DocumentException {
//Title
PdfPTable headerTable = new PdfPTable(1);
headerTable.setWidthPercentage(100f);
PdfPCell headerCell = new PdfPCell(new Phrase(messageSource.getMessage("pdf.allfichest.fichedesuividusoustraitant", null, localtion), contentBoldFont));
headerCell.setBorder(Rectangle.NO_BORDER);
headerCell.setHorizontalAlignment(PdfPTable.ALIGN_CENTER);
headerTable.addCell(headerCell);
addContent(headerTable);
//Information Generals
headerTable = new PdfPTable(1);
headerTable.setWidthPercentage(100f);
headerCell = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.generalInformation", null, localtion), contentBoldFont));
headerCell.setBorder(Rectangle.NO_BORDER);
headerCell.setHorizontalAlignment(PdfPTable.ALIGN_LEFT);
headerTable.addCell(headerCell);
addContent(headerTable);
// Information Details
String arrGeneraleInformation[]= generaleInformation.split(Constants.SEPRATE);
PdfPTable generaleInformationTable = new PdfPTable(6);
PdfPCell generaleInformationCell;
generaleInformationTable.setWidthPercentage(100f);
//String [] messages = {"Chantier : ","Lot : ","Conducteur de travaux : ","Société : ","Type de lot : ","Montant objectif:"};
String [] messages = {messageSource.getMessage("FicheST.chantier",null, localtion) + " : ",messageSource.getMessage("FicheST.lot", null, localtion) + " : ",
messageSource.getMessage("FicheST.foreman", null, localtion) + " : ",
messageSource.getMessage("pdf.synthese.societe", null, localtion) + " : ",messageSource.getMessage("FicheST.lotType", null, localtion) + " : ",
messageSource.getMessage("pdf.gestiondto.montantobjectif",null,localtion) + " : "};
for(int i=0;i<arrGeneraleInformation.length;i++){
switch (i) {
case 0:
generaleInformationCell = new PdfPCell(new Phrase(messages[0], contentBoldFont));
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.TOP);
generaleInformationCell.enableBorderSide(Rectangle.LEFT);
generaleInformationTable.addCell(generaleInformationCell);
break;
case 1:
generaleInformationCell = new PdfPCell(new Phrase(messages[1], contentBoldFont));
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.TOP);
generaleInformationTable.addCell(generaleInformationCell);
break;
case 2:
generaleInformationCell = new PdfPCell(new Phrase(messages[2], contentBoldFont));
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.TOP);
generaleInformationTable.addCell(generaleInformationCell);
break;
case 3:
generaleInformationCell = new PdfPCell(new Phrase(messages[3], contentBoldFont));
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.BOTTOM);
generaleInformationCell.enableBorderSide(Rectangle.LEFT);
generaleInformationTable.addCell(generaleInformationCell);
break;
case 4:
generaleInformationCell = new PdfPCell(new Phrase(messages[4], contentBoldFont));
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.BOTTOM);
generaleInformationTable.addCell(generaleInformationCell);
break;
case 5:
generaleInformationCell = new PdfPCell(new Phrase(messages[5], contentBoldFont));
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.BOTTOM);
generaleInformationTable.addCell(generaleInformationCell);
break;
}
generaleInformationCell = new PdfPCell(new Phrase(arrGeneraleInformation[i].equals("null") ? "" : arrGeneraleInformation[i], contentNormalFont));
if(i == 0 || i == 1 || i == 2){
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.TOP);
if(i == 2)
generaleInformationCell.enableBorderSide(Rectangle.RIGHT);
generaleInformationTable.addCell(generaleInformationCell);
}
if(i == 3 || i == 4 || i == 5){
generaleInformationCell.setBorder(Rectangle.NO_BORDER);
generaleInformationCell.enableBorderSide(Rectangle.BOTTOM);
if(i == 5)
generaleInformationCell.enableBorderSide(Rectangle.RIGHT);
generaleInformationTable.addCell(generaleInformationCell);
}
}
float[] wfGeneraleInformation = {
3,
6,
3,
6,
7,
6
};
generaleInformationTable.setWidths(wfGeneraleInformation);
addContent(generaleInformationTable);
lineBreak();
PdfPCell leftCell,spaceCell1,middleCell,spaceCell2,rightCell;
PdfPTable parent = new PdfPTable(5);
parent.setSpacingBefore(0f);
parent.setWidthPercentage(100f);
float[] wfParent = {
25,
5,
25,
5,
40
};
parent.setWidths(wfParent);
//Add Condition
leftCell = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.conditions", null, localtion),contentBoldFont));
leftCell.setBorder(Rectangle.NO_BORDER);
parent.addCell(leftCell);
spaceCell1 = new PdfPCell();
spaceCell1.setBorder(Rectangle.NO_BORDER);
parent.addCell(spaceCell1);
middleCell = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.prestations", null, localtion),contentBoldFont));
middleCell.setBorder(Rectangle.NO_BORDER);
parent.addCell(middleCell);
spaceCell2 = new PdfPCell();
spaceCell2.setBorder(Rectangle.NO_BORDER);
parent.addCell(spaceCell2);
rightCell = new PdfPCell(new Phrase(messageSource.getMessage("FicheST.informationComplementaries", null, localtion), contentBoldFont));
rightCell.setBorder(Rectangle.NO_BORDER);
parent.addCell(rightCell);
//Add content
PdfPTable conditionTable = addConditions();
leftCell = new PdfPCell(conditionTable);
parent.addCell(leftCell);
spaceCell1 = new PdfPCell();
spaceCell1.setBorder(Rectangle.NO_BORDER);
parent.addCell(spaceCell1);
PdfPTable prestations = addPrestations();
middleCell = new PdfPCell(prestations);
middleCell.setBorder(Rectangle.NO_BORDER);
parent.addCell(middleCell);
spaceCell2 = new PdfPCell();
spaceCell2.setBorder(Rectangle.NO_BORDER);
parent.addCell(spaceCell2);
PdfPTable caution = addCaution();
rightCell = new PdfPCell(caution);
parent.addCell(rightCell);
addContent(parent);
lineBreak();