List of usage examples for com.itextpdf.text.pdf PdfPCell PdfPCell
public PdfPCell(PdfPCell cell)
PdfPCell
. From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java
protected void printKeyData(SessionContainerWO sessionContainerWO) { try {//from ww w . j a v a 2 s . c o m doc.add(new Paragraph(" ")); table = new PdfPTable(15); table.setWidthPercentage(100); // kernel-data cell = new PdfPCell(new Paragraph(getTran("Web.Occup", "medwan.common.kernel-data").toUpperCase(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.ITALIC))); cell.setColspan(15); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); // row 1 : last-periodical-examination Paragraph par = new Paragraph( getTran("Web.Occup", "medwan.common.last-periodical-examination").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); TransactionVO tran = sessionContainerWO.getLastTransaction(IConstants_PREFIX + "TRANSACTION_TYPE_MER"); ItemVO item; if (tran != null) { item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_MER_EXAMINATION_DATE"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); } } cell = new PdfPCell(par); cell.setColspan(5); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 1 : next-periodical-examination par = new Paragraph( getTran("Web.Occup", "medwan.common.next-periodical-examination").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); if (sessionContainerWO.getFlags().getLastExaminationReport() != null && sessionContainerWO.getFlags() .getLastExaminationReport().getNewExaminationDueDate() != null) { par.add(new Chunk( dateFormat.format(sessionContainerWO.getFlags().getLastExaminationReport() .getNewExaminationDueDate()), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); } cell = new PdfPCell(par); cell.setColspan(5); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 1 : next-driver-examination / Volgend onderzoek medische schifting par = new Paragraph(getTran("Web.Occup", "medwan.common.next-driver-examination").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); if (sessionContainerWO.getFlags().getLastDrivingCertificate() != null) { // CBMT only : only display newExaminationDueDate if patient has riskcode "070" (drivinglicense) boolean riskCode070Found = false; if (riskCode070Found) { String newExamDueDateMinus = ScreenHelper.checkString(sessionContainerWO.getFlags() .getLastDrivingCertificate().getNewExaminationDueDateMinus()); if (newExamDueDateMinus.length() > 0) { par.add(new Chunk(newExamDueDateMinus.replaceAll("-", "/"), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); } } } else { // no data available par.add(new Chunk(getTran("Web.Occup", "medwan.common.no-data"), FontFactory.getFont( FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); } cell = new PdfPCell(par); cell.setColspan(5); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 2 : Biometrie par = new Paragraph(getTran("Web.Occup", "medwan.common.biometry").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); tran = sessionContainerWO.getLastTransactionTypeBiometry(); if (tran != null) { // height item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_BIOMETRY_HEIGHT"); String sHeight = "", sWeight = ""; if (item != null) { sHeight = item.getValue(); par.add(new Chunk(getTran("Web.Occup", "medwan.common.length") + ": " + sHeight + " cm\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } // weight item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_BIOMETRY_WEIGHT"); if (item != null) { sWeight = item.getValue(); par.add(new Chunk(getTran("Web.Occup", "medwan.common.weight") + ": " + sWeight + " kg\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } // BMI if (sWeight.length() > 0 && sHeight.length() > 0) { try { DecimalFormat deci = new DecimalFormat("0.0"); Float bmi = new Float(Float.parseFloat(sWeight.replaceAll(",", ".")) * 10000 / (Float.parseFloat(sHeight.replaceAll(",", ".")) * Float.parseFloat(sHeight.replaceAll(",", ".")))); par.add(new Chunk("BMI: " + deci.format(bmi), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } catch (Exception e) { e.printStackTrace(); } } } cell = new PdfPCell(par); cell.setColspan(3); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 2 : Urineonderzoek par = new Paragraph("URINE\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); tran = sessionContainerWO.getLastTransactionTypeUrineExamination(); if (tran != null) { item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_ALBUMINE"); if (item != null) { par.add(new Chunk("Albumine: " + getTran("Web.Occup", item.getValue()) + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_GLUCOSE"); if (item != null) { par.add(new Chunk("Glucose: " + getTran("Web.Occup", item.getValue()) + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_URINE_BLOOD"); if (item != null) { par.add(new Chunk( getTran("Web.Occup", "medwan.common.blood") + ": " + getTran("Web.Occup", item.getValue()), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } } cell = new PdfPCell(par); cell.setColspan(3); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 2 : Audiometrie par = new Paragraph(getTran("Web.Occup", "medwan.common.audiometry").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); tran = sessionContainerWO.getLastTransactionTypeAudiometry(); if (tran != null) { par.add(new Chunk(getTran("Web.Occup", "medwan.common.mean-hearing-loss").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 6 * fontSizePercentage / 100.0), Font.ITALIC))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_AUDIOMETRY_RIGHT_LOSS"); if (item != null) { par.add(new Chunk( getTran("Web.Occup", "medwan.common.right") + ": -" + item.getValue() + " dB\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_AUDIOMETRY_LEFT_LOSS"); if (item != null) { par.add(new Chunk( getTran("Web.Occup", "medwan.common.left") + ": -" + item.getValue() + " dB\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } } cell = new PdfPCell(par); cell.setColspan(3); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 2 : Visus par = new Paragraph( getTran("Web.Occup", "medwan.common.vision").toUpperCase() + " - " + getTran("Web.Occup", IConstants_PREFIX + "item_type_opthalmology_screen_visiotest_vision_far") .toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); tran = sessionContainerWO.getLastTransactionTypeOphtalmology(); if (tran != null) { par.add(new Chunk(getTran("Web.Occup", "medwan.common.right-left-binocular").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 6 * fontSizePercentage / 100.0), Font.ITALIC))); par.add(new Chunk(getTran("Web.Occup", "medwan.common.without-correction") + ": ", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OD_WITHOUT_GLASSES"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OG_WITHOUT_GLASSES"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_BONI_WITHOUT_GLASSES"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("\n" + getTran("Web.Occup", "medwan.common.with-correction") + ": ", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OD_WITH_GLASSES"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_OG_WITH_GLASSES"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); item = tran.getItem(IConstants_PREFIX + "ITEM_TYPE_OPTHALMOLOGY_VISION_BONI_WITH_GLASSES"); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } } cell = new PdfPCell(par); cell.setColspan(3); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); // row 2 : Bloeddruk par = new Paragraph(getTran("Web.Occup", "medwan.common.blood-pressure").toUpperCase() + "\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.ITALIC)); tran = sessionContainerWO.getLastTransactionTypeGeneralClinicalExamination(); if (tran != null) { // right ItemVO item1 = tran.getItem( IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_SYSTOLIC_PRESSURE_RIGHT"); item = tran.getItem( IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_DIASTOLIC_PRESSURE_RIGHT"); if (item1 != null || item != null) { par.add(new Chunk(getTran("Web.Occup", "medwan.common.right") + ": ", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); if (item1 != null) { par.add(new Chunk(item1.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk(" mmHg\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } // left item = tran.getItem( IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_SYSTOLIC_PRESSURE_LEFT"); item1 = tran.getItem( IConstants_PREFIX + "ITEM_TYPE_CARDIAL_CLINICAL_EXAMINATION_DIASTOLIC_PRESSURE_LEFT"); if (item != null || item1 != null) { par.add(new Chunk(getTran("Web.Occup", "medwan.common.left") + ": ", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); if (item != null) { par.add(new Chunk(item.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk("/", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.NORMAL))); if (item1 != null) { par.add(new Chunk(item1.getValue(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } par.add(new Chunk(" mmHg\n", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); } } cell = new PdfPCell(par); cell.setColspan(3); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); table.addCell(cell); doc.add(table); } catch (Exception e) { e.printStackTrace(); } }
From source file:be.mxs.common.util.pdf.general.chuk.GeneralPDFCreator.java
protected void printAdminHeader(AdminPerson activePerson) { try {// w w w . j a va 2s . c o m doc.add(new Paragraph(" ")); table = new PdfPTable(4); table.setWidthPercentage(100); // title cell = new PdfPCell( new Paragraph(getTran("Web.Occup", "medwan.common.administrative-data").toUpperCase(), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.ITALIC))); cell.setColspan(4); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); table.addCell(cell); // firstname cell = new PdfPCell(new Paragraph(activePerson.firstname + " " + activePerson.lastname, FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(2); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); // dateOfBirth cell = new PdfPCell(new Paragraph("" + activePerson.dateOfBirth, FontFactory.getFont( FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(1); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); // gender cell = new PdfPCell(new Paragraph(activePerson.gender + "", FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(1); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); // address AdminPrivateContact contact = activePerson.getActivePrivate(); if (contact != null) { cell = new PdfPCell(new Paragraph( contact.district + " - " + ScreenHelper.getTran(null, "province", contact.province, sPrintLanguage), FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 8 * fontSizePercentage / 100.0), Font.NORMAL))); cell.setColspan(4); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(BaseColor.LIGHT_GRAY); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); table.addCell(cell); } doc.add(table); } catch (Exception e) { e.printStackTrace(); } }
From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java
private void addDisciplinaryRecordDetails(PdfPTable table, DisciplinaryRecord disRec) { if (disRec.followUp.length() > 0) { PdfPTable detailsTable = new PdfPTable(10); detailsTable.setWidthPercentage(100); // follow-up in grey and italic //detailsTable.addCell(createValueCell(disRec.followUp.replaceAll("\r\n"," "),10)); Font font = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.ITALIC); font.setColor(BaseColor.GRAY);/* w w w . j av a2 s . c o m*/ cell = new PdfPCell(new Paragraph(disRec.followUp.replaceAll("\r\n", " "), font)); cell.setColspan(10); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); detailsTable.addCell(cell); table.addCell(createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER, PdfPCell.BOX)); } }
From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java
private void addLeaveDetails(PdfPTable table, Leave leave) { if (leave.comment.length() > 0) { PdfPTable detailsTable = new PdfPTable(10); detailsTable.setWidthPercentage(100); // follow-up in grey and italic //detailsTable.addCell(createValueCell(leave.comment.replaceAll("\r\n"," "),10)); Font font = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.ITALIC); font.setColor(BaseColor.GRAY);/* w w w. j a v a2s .c o m*/ cell = new PdfPCell(new Paragraph(leave.comment.replaceAll("\r\n", " "), font)); cell.setColspan(10); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); detailsTable.addCell(cell); table.addCell(createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER, PdfPCell.BOX)); } }
From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java
private void addContractDetails(PdfPTable table, Contract contract) { PdfPTable detailsTable = new PdfPTable(10); detailsTable.setWidthPercentage(100); if (contract.getLegalReferenceCode(1).length() > 0 || contract.getLegalReferenceCode(2).length() > 0 || contract.getLegalReferenceCode(3).length() > 0 || contract.getLegalReferenceCode(4).length() > 0 || contract.getLegalReferenceCode(5).length() > 0) { //detailsTable.addCell(createSubtitleCell(getTran("web.hr","legalReferenceCodes"),10)); // one LRC for (int i = 0; i < 4; i++) { if (contract.getLegalReferenceCode(i + 1).length() > 0) { detailsTable// w w w. ja va 2s.c om .addCell(createValueCell(getTran("web.hr", "legalReferenceCode") + " " + (i + 1), 4)); detailsTable.addCell(createValueCell(contract.getLegalReferenceCode(i + 1), 6)); } } } if (detailsTable.size() > 0) { table.addCell(emptyCell(2)); cell = createCell(new PdfPCell(detailsTable), table.getNumberOfColumns() - 2, PdfPCell.ALIGN_CENTER, PdfPCell.BOX); cell.setPadding(2); table.addCell(cell); } }
From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java
private void addCareerDetails(PdfPTable table, Career career) { if (career.comment.length() > 0) { PdfPTable detailsTable = new PdfPTable(10); detailsTable.setWidthPercentage(100); // comment in grey and italic //detailsTable.addCell(createValueCell(career.comment.replaceAll("\r\n"," "),10)); Font font = FontFactory.getFont(FontFactory.HELVETICA, 7, Font.ITALIC); font.setColor(BaseColor.GRAY);/* ww w .ja v a 2 s. c o m*/ cell = new PdfPCell(new Paragraph(career.comment.replaceAll("\r\n", " "), font)); cell.setColspan(10); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); detailsTable.addCell(cell); table.addCell(createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER, PdfPCell.BOX)); } }
From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java
private void addSalaryDetails(PdfPTable table, Salary salary) { PdfPTable detailsTable = new PdfPTable(10); detailsTable.setWidthPercentage(100); //*** XML 1 - benefits (multi-add) ************************** if (salary.benefits.length() > 0) { detailsTable.addCell(createSubtitleCell(getTran("web.hr", "benefits"), 10)); // header detailsTable.addCell(createHeaderCell(getTran("web.hr", "beginDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "endDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "period"), 2)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "type"), 3)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "amount"), 3)); try {//from w w w.j a v a 2 s .co m // parse benefits from xml SAXReader reader = new SAXReader(false); org.dom4j.Document document = reader.read(new StringReader(salary.benefits)); org.dom4j.Element benefitsElem = document.getRootElement(); if (benefitsElem != null) { String sTmpBegin, sTmpEnd, sTmpPeriod, sTmpType, sTmpAmount; org.dom4j.Element benefitElem; Iterator benefitsIter = benefitsElem.elementIterator("Benefit"); while (benefitsIter.hasNext()) { benefitElem = (org.dom4j.Element) benefitsIter.next(); sTmpBegin = checkString(benefitElem.elementText("Begin")); sTmpEnd = checkString(benefitElem.elementText("End")); sTmpPeriod = checkString(benefitElem.elementText("Period")); sTmpType = checkString(benefitElem.elementText("Type")); sTmpAmount = checkString(benefitElem.elementText("Amount")); // one benefit detailsTable.addCell(createValueCell(sTmpBegin, 1)); detailsTable.addCell(createValueCell(sTmpEnd, 1)); detailsTable.addCell(createValueCell(getTran("hr.salary.period", sTmpPeriod), 2)); detailsTable.addCell(createValueCell(getTran("hr.salary.benefit.type", sTmpType), 3)); cell = createValueCell( sTmpAmount + " " + MedwanQuery.getInstance().getConfigParam("currency", ""), 3); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); detailsTable.addCell(cell); } } } catch (Exception e) { Debug.printStackTrace(e); } } //*** XML 2 - bonuses (multi-add) ************************** if (salary.bonuses.length() > 0) { table.addCell(createSubtitleCell(getTran("web.hr", "bonuses"), 10)); // header detailsTable.addCell(createHeaderCell(getTran("web.hr", "beginDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "endDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "period"), 2)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "type"), 2)); detailsTable.addCell(createHeaderCell(getTran("web", "percentage"), 2)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "amount"), 2)); try { // parse bonuses from xml SAXReader reader = new SAXReader(false); org.dom4j.Document document = reader.read(new StringReader(salary.bonuses)); org.dom4j.Element bonusesElem = document.getRootElement(); if (bonusesElem != null) { String sTmpBegin, sTmpEnd, sTmpPeriod, sTmpType, sTmpPercentage, sTmpAmount; org.dom4j.Element bonusElem; Iterator bonusesIter = bonusesElem.elementIterator("Bonus"); while (bonusesIter.hasNext()) { bonusElem = (org.dom4j.Element) bonusesIter.next(); sTmpBegin = checkString(bonusElem.elementText("Begin")); sTmpEnd = checkString(bonusElem.elementText("End")); sTmpPeriod = checkString(bonusElem.elementText("Period")); sTmpType = checkString(bonusElem.elementText("Type")); sTmpPercentage = checkString(bonusElem.elementText("Percentage")); sTmpAmount = checkString(bonusElem.elementText("Amount")); // one record detailsTable.addCell(createValueCell(sTmpBegin, 1)); detailsTable.addCell(createValueCell(sTmpEnd, 1)); detailsTable.addCell(createValueCell(sTmpPeriod, 2)); detailsTable.addCell(createValueCell(sTmpType, 2)); detailsTable.addCell(createValueCell(sTmpPercentage + "%", 2)); cell = createValueCell( sTmpAmount + " " + MedwanQuery.getInstance().getConfigParam("currency", ""), 2); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); detailsTable.addCell(cell); } } } catch (Exception e) { Debug.printStackTrace(e); } } //*** XML 3 - otherIncome (multi-add) *********************** if (salary.otherIncome.length() > 0) { table.addCell(createSubtitleCell(getTran("web.hr", "otherIncome"), 10)); // header detailsTable.addCell(createHeaderCell(getTran("web.hr", "beginDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "endDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "period"), 2)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "type"), 3)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "amount"), 3)); try { // parse otherIncome from xml SAXReader reader = new SAXReader(false); org.dom4j.Document document = reader.read(new StringReader(salary.otherIncome)); org.dom4j.Element benefitsElem = document.getRootElement(); if (benefitsElem != null) { String sTmpBegin, sTmpEnd, sTmpPeriod, sTmpType, sTmpAmount; org.dom4j.Element otherIncomeElem; Iterator otherIncomesIter = benefitsElem.elementIterator("OtherIncome"); while (otherIncomesIter.hasNext()) { otherIncomeElem = (org.dom4j.Element) otherIncomesIter.next(); sTmpBegin = checkString(otherIncomeElem.elementText("Begin")); sTmpEnd = checkString(otherIncomeElem.elementText("End")); sTmpPeriod = checkString(otherIncomeElem.elementText("Period")); sTmpType = checkString(otherIncomeElem.elementText("Type")); sTmpAmount = checkString(otherIncomeElem.elementText("Amount")); // one record detailsTable.addCell(createValueCell(sTmpBegin, 1)); detailsTable.addCell(createValueCell(sTmpEnd, 1)); detailsTable.addCell(createValueCell(sTmpPeriod, 2)); detailsTable.addCell(createValueCell(sTmpType, 3)); cell = createValueCell( sTmpAmount + " " + MedwanQuery.getInstance().getConfigParam("currency", ""), 3); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); detailsTable.addCell(cell); } } } catch (Exception e) { Debug.printStackTrace(e); } } //*** XML 4 - deductions (multi-add) ************************ if (salary.deductions.length() > 0) { detailsTable.addCell(createSubtitleCell(getTran("web.hr", "deductions"), 10)); // header detailsTable.addCell(createHeaderCell(getTran("web.hr", "beginDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "endDate"), 1)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "period"), 2)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "type"), 3)); detailsTable.addCell(createHeaderCell(getTran("web.hr", "amount"), 3)); try { // parse deductions from xml SAXReader reader = new SAXReader(false); org.dom4j.Document document = reader.read(new StringReader(salary.deductions)); org.dom4j.Element deductionsElem = document.getRootElement(); if (deductionsElem != null) { String sTmpBegin, sTmpEnd, sTmpPeriod, sTmpType, sTmpAmount; org.dom4j.Element deductionElem; Iterator deductionsIter = deductionsElem.elementIterator("Deduction"); while (deductionsIter.hasNext()) { deductionElem = (org.dom4j.Element) deductionsIter.next(); sTmpBegin = checkString(deductionElem.elementText("Begin")); sTmpEnd = checkString(deductionElem.elementText("End")); sTmpPeriod = checkString(deductionElem.elementText("Period")); sTmpType = checkString(deductionElem.elementText("Type")); sTmpAmount = checkString(deductionElem.elementText("Amount")); // one record detailsTable.addCell(createValueCell(sTmpBegin, 1)); detailsTable.addCell(createValueCell(sTmpEnd, 1)); detailsTable.addCell(createValueCell(sTmpPeriod, 2)); detailsTable.addCell(createValueCell(sTmpType, 3)); cell = createValueCell( sTmpAmount + " " + MedwanQuery.getInstance().getConfigParam("currency", ""), 3); cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT); detailsTable.addCell(cell); } } } catch (Exception e) { Debug.printStackTrace(e); } } if (detailsTable.size() > 0) { table.addCell(emptyCell(3)); cell = createCell(new PdfPCell(detailsTable), table.getNumberOfColumns() - 3, PdfPCell.ALIGN_CENTER, PdfPCell.BOX); cell.setPadding(2); table.addCell(cell); } }
From source file:be.mxs.common.util.pdf.general.dossierCreators.StaffDossierPDFCreator.java
private void addWorkscheduleDetails(PdfPTable table, Workschedule schedule) throws Exception { PdfPTable detailsTable = new PdfPTable(10); detailsTable.setWidthPercentage(100); if (schedule.type.equals("day")) displayDaySchedule(detailsTable, schedule); else if (schedule.type.equals("week")) displayWeekSchedule(detailsTable, schedule); else if (schedule.type.equals("month")) displayMonthSchedule(detailsTable, schedule); if (detailsTable.size() > 0) { cell = createCell(new PdfPCell(detailsTable), table.getNumberOfColumns(), PdfPCell.ALIGN_CENTER, PdfPCell.BOX);/* www . j a va2s. c om*/ cell.setPadding(2); table.addCell(cell); } }
From source file:be.mxs.common.util.pdf.general.oc.examinations.PDFDrivingLicenseDeclaration.java
protected void addContent() { try {//from www . j a va 2 s . co m if (transactionVO.getItems().size() >= minNumberOfItems) { contentTable = new PdfPTable(1); table = new PdfPTable(5); // CATEGORY (checkboxes) String categories = ""; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_B").equals("")) categories += "B, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_B_E").equals("")) categories += "B+E, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_C").equals("")) categories += "C, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_C_E").equals("")) categories += "C+E, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_C1").equals("")) categories += "C1, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_C1_E").equals("")) categories += "C1+E, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_D").equals("")) categories += "D, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_D_E").equals("")) categories += "D+E, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_D1").equals("")) categories += "D1, "; if (!getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_D1_E").equals("")) categories += "D1+E, "; // add categories row if (categories.length() > 0) { // remove last comma if (categories.indexOf(",") > -1) { categories = categories.substring(0, categories.lastIndexOf(",")); } addItemRow(table, getTran( "medwan.common.driving-license-declaration.candidate-questionnaire.actual-category-or-sub-category"), categories.toLowerCase()); } // delivery place itemValue = getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_DELIVERED_TO"); if (itemValue.length() > 0) { addItemRow(table, getTran(IConstants_PREFIX + "ITEM_TYPE_DLD_DELIVERED_TO"), itemValue); } // expiration date itemValue = getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_VALIDITY_DATE"); if (itemValue.length() > 0) { addItemRow(table, getTran(IConstants_PREFIX + "ITEM_TYPE_DLD_VALIDITY_DATE"), itemValue); } // questionnaire valide for category itemValue = getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_CANDIDATE_CATEGORY"); if (itemValue.length() > 0) { addItemRow(table, getTran(IConstants_PREFIX + "ITEM_TYPE_DLD_CANDIDATE_CATEGORY"), itemValue); } //*** in voorkomend geval : previous examination date & examinator name *** String prevExamDate = getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_EXAMINATION_DATE"); String examinatorName = getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_EXAMINATOR_NAME"); if (prevExamDate.length() > 0 || examinatorName.length() > 0) { // sub title cell = createHeaderCell(getTran( "medwan.common.driving-license-declaration.candidate-questionnaire.if-applicable"), 5); cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); table.addCell(cell); if (prevExamDate.length() > 0) { addItemRow(table, getTran(IConstants_PREFIX + "ITEM_TYPE_DLD_EXAMINATION_DATE"), prevExamDate); } if (examinatorName.length() > 0) { addItemRow(table, getTran(IConstants_PREFIX + "ITEM_TYPE_DLD_EXAMINATOR_NAME"), examinatorName); } } // add content to doc if (table.size() > 0) { contentTable .addCell(createCell(new PdfPCell(table), 1, PdfPCell.ALIGN_CENTER, PdfPCell.NO_BORDER)); tranTable.addCell(createContentCell(contentTable)); } // add transaction part 1 to doc addTransactionToDoc(); // add transaction part 2 to doc //*** QUESTIONNAIRE *** addQuestionnaire(); addTransactionToDoc(); //*** comment *** contentTable = new PdfPTable(1); table = new PdfPTable(5); itemValue = getItemValue(IConstants_PREFIX + "ITEM_TYPE_DLD_REMARK"); if (itemValue.length() > 0) { addItemRow(table, getTran("medwan.common.comment"), itemValue); // add content to doc if (table.size() > 0) { contentTable.addCell( createCell(new PdfPCell(table), 1, PdfPCell.ALIGN_CENTER, PdfPCell.NO_BORDER)); tranTable.addCell(createContentCell(contentTable)); addTransactionToDoc(); } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:be.mxs.common.util.pdf.general.oc.examinations.PDFDrivingLicenseDeclaration.java
private void addQuestionnaire() { if (isAtLeastOneQuestionAnswered()) { contentTable = new PdfPTable(1); table = new PdfPTable(5); PdfPTable questions = new PdfPTable(40); // header questions.addCell(createTitleCell( getTran("medwan.common.driving-license-declaration.candidate-questionnaire"), 40)); // questions String questionPrefix = "medwan.common.driving-license-declaration.candidate-questionnaire.question-"; for (int i = 1; i <= 20; i++) { questions = addQuestion(questions, i, getTran(questionPrefix + i), IConstants_PREFIX + "ITEM_TYPE_DLD_Q" + i); }// ww w . j a v a 2 s .c om // commitment String commPart1 = getTran( "medwan.common.driving-license-declaration.candidate-questionnaire.commitment") + " "; String commPart2 = getTran( "medwan.common.driving-license-declaration.candidate-questionnaire.commitment1"); cell = new PdfPCell(new Phrase(commPart1 + commPart2, FontFactory.getFont(FontFactory.HELVETICA, Math.round((double) 7 * fontSizePercentage / 100.0), Font.BOLD))); cell.setColspan(40); cell.setBorder(PdfPCell.BOX); cell.setBorderColor(innerBorderColor); cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); questions.addCell(cell); // add content to document if (questions.size() > 0) { contentTable .addCell(createCell(new PdfPCell(questions), 1, PdfPCell.ALIGN_CENTER, PdfPCell.NO_BORDER)); tranTable.addCell(createContentCell(contentTable)); } } }