List of usage examples for com.lowagie.text Element ALIGN_RIGHT
int ALIGN_RIGHT
To view the source code for com.lowagie.text Element ALIGN_RIGHT.
Click Source Link
From source file:org.drools.verifier.doc.DroolsDocsComponentFactory.java
License:Apache License
public static HeaderFooter createFooter(String packageName) { HeaderFooter footer = new HeaderFooter(new Phrase(packageName + "-", HEADER_FOOTER_TEXT), true); footer.setBorder(1);// w w w . j a v a 2s . c o m footer.setAlignment(Element.ALIGN_RIGHT); return footer; }
From source file:org.drools.verifier.doc.DroolsDocsComponentFactory.java
License:Apache License
public void onEndPage(PdfWriter writer, Document document) { try {//from w w w. j a v a 2 s . c om Image image = Image.getInstance(DroolsDocsBuilder.class.getResource("guvnor-webapp.png")); // TODO this image never existed image.setAlignment(Image.RIGHT); image.scaleAbsolute(100, 30); Rectangle page = document.getPageSize(); PdfPTable head = new PdfPTable(2); PdfPCell cell1 = new PdfPCell(image); cell1.setHorizontalAlignment(Element.ALIGN_LEFT); cell1.setBorder(0); head.addCell(cell1); PdfPCell cell2 = new PdfPCell(new Phrase(currentDate, DroolsDocsComponentFactory.HEADER_FOOTER_TEXT)); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); cell2.setBorder(0); head.addCell(cell2); head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin()); head.writeSelectedRows(0, -1, document.leftMargin(), page.getHeight() - document.topMargin() + head.getTotalHeight(), writer.getDirectContent()); } catch (Exception e) { throw new ExceptionConverter(e); } }
From source file:org.egov.infra.web.displaytag.export.EGovPdfView.java
License:Open Source License
/** * Generates all the row cells.//from www .j a va 2 s.c o m * @throws JspException for errors during value retrieving from the table model * @throws BadElementException errors while generating content */ protected void generateRows() throws JspException, BadElementException { // get the correct iterator (full or partial list according to the exportFull field) final RowIterator rowIterator = this.model.getRowIterator(this.exportFull); // iterator on rows while (rowIterator.hasNext()) { final Row row = rowIterator.next(); // iterator on columns final ColumnIterator columnIterator = row.getColumnIterator(this.model.getHeaderCellList()); while (columnIterator.hasNext()) { final Column column = columnIterator.nextColumn(); // Get the value to be displayed for the column final Object value = column.getValue(this.decorated); final Cell cell = getCell(ObjectUtils.toString(value)); if (value instanceof BigDecimal) { cell.setHorizontalAlignment(Element.ALIGN_RIGHT); } this.tablePDF.addCell(cell); } } }
From source file:org.egov.works.utils.AbstractPDFGenerator.java
License:Open Source License
protected Paragraph rightPara(final Object value) { return makePara(value, Element.ALIGN_RIGHT); }
From source file:org.egov.works.utils.AbstractPDFGenerator.java
License:Open Source License
protected Paragraph rightPara(final float size, final Object value) { final Font font = new Font(); font.setSize(size);/*from w ww .ja v a 2s. co m*/ final Paragraph header = new Paragraph(value == null ? "" : value.toString(), font); header.setAlignment(Element.ALIGN_RIGHT); return header; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createContractorBillHeader(final String title, final int i) { final PdfPTable contractorBillHeaderTable = new PdfPTable(3); contractorBillHeaderTable.getDefaultCell().setBorderWidth(0); if (i == 0) { contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); contractorBillHeaderTable.getDefaultCell().setColspan(4); contractorBillHeaderTable.addCell(title); } else if (i == 1) { contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); final Phrase headerTextPara = new Phrase(title, new Font(Font.UNDEFINED, LARGE_FONT, Font.BOLD)); contractorBillHeaderTable.getDefaultCell().setColspan(3); contractorBillHeaderTable.addCell(headerTextPara); } else if (i == 2) { contractorBillHeaderTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); contractorBillHeaderTable.getDefaultCell().setColspan(4); contractorBillHeaderTable.addCell(title + " " + deptName); }//from www. j a va 2 s. co m return contractorBillHeaderTable; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createDeductionTypeDataTable() { final PdfPTable createcreateDeductionTypeDataTable = new PdfPTable(11); createcreateDeductionTypeDataTable.getDefaultCell().setBorderWidth(1); // statutory//from w w w . jav a 2s. co m if (!sortedStatutorySortedList.isEmpty()) for (final StatutoryDeductionsForBill egBillPayeedetail : sortedStatutorySortedList) { // get tot amt for dedcution for all bill for workorder till bill date final BigDecimal totStatutoryAmt = getTotStatoryAmountForDeduction(egBillPayeedetail); final String resultTotStatuAmt = getIntDecimalParts(totStatutoryAmt); final String[] resultTotStatuAry = resultTotStatuAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); final String resultAmt = getIntDecimalParts( egBillPayeedetail.getEgBillPayeeDtls().getCreditAmount()); final String[] resultAry = resultAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7); createcreateDeductionTypeDataTable .addCell(egBillPayeedetail.getEgBillPayeeDtls().getRecovery().getType()); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1); createcreateDeductionTypeDataTable.addCell(resultTotStatuAry[0]);// Rs. amt all bill for workorder till billdate createcreateDeductionTypeDataTable.addCell(resultTotStatuAry[1]);// Pa, amt all bill for workorder till billdate createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction specific to bill createcreateDeductionTypeDataTable.addCell(resultAry[1]);// pa. amt for this deduction specific to bill } final String type = "advanceAjustment"; if ("advanceAjustment".equalsIgnoreCase(type)) { final BigDecimal totAmt = getTotAmountForAdvanceAdjustment(); final String resultTotAmt = getIntDecimalParts(totAmt); final String[] resultTotAry = resultTotAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); final String resultAmt = getIntDecimalParts(advanceAdjustment); final String[] resultAry = resultAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7); createcreateDeductionTypeDataTable.addCell("Advance adjustment "); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1); createcreateDeductionTypeDataTable.addCell(resultTotAry[0]); createcreateDeductionTypeDataTable.addCell(resultTotAry[1]); createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction specific to bill createcreateDeductionTypeDataTable.addCell(resultAry[1]);// pa. amt for this deduction specific to bill } // standard deduction if (!sortedStandardDeductionList.isEmpty()) for (final DeductionTypeForBill deductionTypeForBill : sortedStandardDeductionList) { final BigDecimal totStandardAmt = getTotStandardAmountForDeduction(deductionTypeForBill); final String resultTotStandardAmt = getIntDecimalParts(totStandardAmt); final String[] resultTotStandardAry = resultTotStandardAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); final String resultAmt = getIntDecimalParts(deductionTypeForBill.getCreditamount()); final String[] resultAry = resultAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7); createcreateDeductionTypeDataTable.addCell(deductionTypeForBill.getDeductionType()); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1); createcreateDeductionTypeDataTable.addCell(resultTotStandardAry[0]);// Rs. amt all bill for workorder till // billdate createcreateDeductionTypeDataTable.addCell(resultTotStandardAry[1]);// Pa, amt all bill for workorder till // billdate createcreateDeductionTypeDataTable.addCell(resultAry[0]); // Rs. amt for this deduction for this bill createcreateDeductionTypeDataTable.addCell(resultAry[1]);// Pa. amt for this deduction for this bill } if (!customDeductionList.isEmpty()) for (final EgBilldetails egBilldetails : customDeductionList) { final BigDecimal totCustomAmt = getTotStandardAmountForDeduction(egBilldetails); final String resultTotCustomAmt = getIntDecimalParts(totCustomAmt); final String[] resultTotCustomAry = resultTotCustomAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); final String resultAmt = getIntDecimalParts(egBilldetails.getCreditamount()); final String[] resultAry = resultAmt.split(":"); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(7); createcreateDeductionTypeDataTable.addCell(chartOfAccountsHibernateDAO .findById(Long.valueOf(egBilldetails.getGlcodeid().toString()), false).getName()); createcreateDeductionTypeDataTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); createcreateDeductionTypeDataTable.getDefaultCell().setColspan(1); createcreateDeductionTypeDataTable.addCell(resultTotCustomAry[0]);// Rs. amt all bill for workorder till billdate createcreateDeductionTypeDataTable.addCell(resultTotCustomAry[1]);// Pa, amt all bill for workorder till billdate createcreateDeductionTypeDataTable.addCell(resultAry[0]); // amt for this deduction specific to bill createcreateDeductionTypeDataTable.addCell(resultAry[1]); } return createcreateDeductionTypeDataTable; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createNetPayableTable() { final String resultAmt = getIntDecimalParts(netPayableAmount); final String[] resultAry = resultAmt.split(":"); final PdfPTable createNetPayableData = new PdfPTable(11); createNetPayableData.getDefaultCell().setBorderWidth(1); createNetPayableData.getDefaultCell().setColspan(9); createNetPayableData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); createNetPayableData.addCell(makePara( pdfLabel.get("contractorbill.pdf.netamount") + ":\t" + getNetPayAmtInWords(), Font.UNDERLINE)); createNetPayableData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); createNetPayableData.getDefaultCell().setColspan(1); createNetPayableData.addCell(resultAry[0]); createNetPayableData.addCell(resultAry[1]); return createNetPayableData; }
From source file:org.egov.works.web.actions.contractorBill.ContractorBillPDFGenerator.java
License:Open Source License
protected PdfPTable createWorkValueDataTable() { final PdfPTable createWorkValueData = new PdfPTable(11); createWorkValueData.getDefaultCell().setBorderWidth(1); createWorkValueData.getDefaultCell().setColspan(7); createWorkValueData.addCell(makePara(pdfLabel.get("contractorbill.pdf.valueofworkdone"))); createWorkValueData.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); createWorkValueData.getDefaultCell().setColspan(1); final BigDecimal totalBillAmtUptBill = contractorBillService.getTotalValueWoForUptoBillDate( egBillRegister.getBilldate(), workOrderId, mbHeader.getWorkOrderEstimate().getId()); if (totalBillAmtUptBill.compareTo(BigDecimal.ZERO) > 0) { final String totalBillAmt = toCurrency(totalBillAmtUptBill.doubleValue()); try {//from w w w . j a v a 2 s . c om createWorkValueData .addCell(rightPara(blankSpace + totalBillAmt.substring(0, totalBillAmt.indexOf('.')))); createWorkValueData.addCell(centerPara( blankSpace + totalBillAmt.substring(totalBillAmt.indexOf('.') + 1, totalBillAmt.length()))); } catch (final StringIndexOutOfBoundsException e) { logger.error("----totalBillAmt has no fractional part----" + e.getMessage()); createWorkValueData.addCell(centerPara(blankSpace + totalBillAmt)); createWorkValueData.addCell("00"); } } else { createWorkValueData.addCell(" "); createWorkValueData.addCell(" "); } BigDecimal billAmount = BigDecimal.ZERO; if (egBillRegister.getBillamount() != null) billAmount = egBillRegister.getBillamount(); if (billAmount.compareTo(BigDecimal.ZERO) > 0) { final String billAmt = toCurrency(billAmount.doubleValue()); try { createWorkValueData.addCell(centerPara(blankSpace + billAmt.substring(0, billAmt.indexOf('.')))); createWorkValueData.addCell( centerPara(blankSpace + billAmt.substring(billAmt.indexOf('.') + 1, billAmt.length()))); } catch (final StringIndexOutOfBoundsException e) { logger.error("---billAmt has no fractional part---" + e.getMessage()); createWorkValueData.addCell(centerPara(blankSpace + billAmt)); createWorkValueData.addCell(""); } } else { createWorkValueData.addCell(" "); createWorkValueData.addCell(" "); } return createWorkValueData; }
From source file:org.egov.works.web.actions.estimate.EstimatePDFGenerator.java
License:Open Source License
private PdfPTable createBudgetDetailsForEstimateTable(final AbstractEstimate estimate) throws DocumentException { try {/*from www. j a v a 2 s . c o m*/ final PdfPTable estBudgetDetailsTable = new PdfPTable(4); estBudgetDetailsTable.setWidthPercentage(75); estBudgetDetailsTable.setWidths(new float[] { 0.6f, 1f, 0.5f, 1f }); BigDecimal totalGrant; BigDecimal budgetAvailable; BigDecimal balOnHand; BigDecimal amtAppropriated = BigDecimal.ZERO; BigDecimal totGrantafterMultiFactor = BigDecimal.ZERO; BigDecimal totalUtilizedAmt; BigDecimal amtAppropriatedsofar = BigDecimal.ZERO; worksService.getAccountdetailtypeByName("DEPOSITCODE"); AbstractEstimateAppropriation latestAbstractEstimateAppropriation; if (abstractEstimateAppropriationList != null && !abstractEstimateAppropriationList.isEmpty()) { latestAbstractEstimateAppropriation = abstractEstimateAppropriationList .get(abstractEstimateAppropriationList.size() - 1); if (latestAbstractEstimateAppropriation != null) if (estimate.getDepositCode() == null) { if (latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount() != 0) { final Department dept = getDeptFromBudgtAppropriationNo( latestAbstractEstimateAppropriation.getBudgetUsage().getAppropriationnumber()); totalGrant = abstractEstimateService.getTotalGrantForYearAsOnDate( estimate.getFinancialDetails().get(0), latestAbstractEstimateAppropriation.getBudgetUsage().getFinancialYearId() .longValue(), Integer.parseInt(dept.getId().toString()), latestAbstractEstimateAppropriation.getBudgetUsage().getUpdatedTime()); final BigDecimal planningBudgetPerc = abstractEstimateService .getPlanningBudgetPercentage(estimate.getFinancialDetails().get(0), latestAbstractEstimateAppropriation.getBudgetUsage() .getFinancialYearId().longValue(), Integer.parseInt(dept.getId().toString())); if (planningBudgetPerc != null && planningBudgetPerc.compareTo(BigDecimal.ZERO) != 0) { totGrantafterMultiFactor = totalGrant .multiply(planningBudgetPerc.divide(new BigDecimal(100))); appValue = planningBudgetPerc.divide(new BigDecimal(100)).toString(); } budgetAvailable = latestAbstractEstimateAppropriation.getBalanceAvailable(); balOnHand = budgetAvailable.add(new BigDecimal( latestAbstractEstimateAppropriation.getBudgetUsage().getConsumedAmount())); amtAppropriated = totGrantafterMultiFactor.subtract(balOnHand); } } else if (latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount() .doubleValue() != 0) { totalUtilizedAmt = depositWorksUsageService.getTotalUtilizedAmountForDepositWorks( latestAbstractEstimateAppropriation.getAbstractEstimate().getFinancialDetails() .get(0), latestAbstractEstimateAppropriation.getDepositWorksUsage().getCreatedDate()); if (totalUtilizedAmt == null) totalUtilizedAmt = BigDecimal.ZERO; amtAppropriatedsofar = totalUtilizedAmt.subtract( latestAbstractEstimateAppropriation.getDepositWorksUsage().getConsumedAmount()); } } addRow(estBudgetDetailsTable, true, centerPara("Estimate Date"), centerPara(DateUtils.getFormattedDate(estimate.getEstimateDate(), "dd/MM/yyyy")), centerPara("Fund"), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getFund().getName())); if (estimate.getDepositCode() == null) { addRow(estBudgetDetailsTable, true, centerPara("Function "), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getFunction().getName()), centerPara("Budget Head"), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getBudgetGroup().getName())); addRow(estBudgetDetailsTable, true, centerPara("Amount Appropriated so far"), centerPara(amtAppropriated == null ? "" : toCurrency(amtAppropriated.doubleValue())), centerPara("Estimate Amount"), centerPara(toCurrency(estimate.getTotalAmount().getValue()))); } else { addRow(estBudgetDetailsTable, true, centerPara("Function "), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getFunction().getName()), centerPara("Deposit COA/Deposit Code"), centerPara(estimate.getFinancialDetails().isEmpty() ? "" : estimate.getFinancialDetails().get(0).getCoa().getGlcode().concat("-") .concat(estimate.getFinancialDetails().get(0).getCoa().getName()) .concat(" / ").concat(estimate.getDepositCode().getCode()))); addRow(estBudgetDetailsTable, true, centerPara("Amount Appropriated so far"), centerPara( amtAppropriatedsofar == null ? "" : toCurrency(amtAppropriatedsofar.doubleValue())), centerPara("Estimate Amount"), makePara(toCurrency(estimate.getTotalAmount().getValue()), Element.ALIGN_RIGHT)); } return estBudgetDetailsTable; } catch (final Exception e) { throw new ApplicationRuntimeException("Exception occured while estimate details method 2 " + e); } }