List of usage examples for com.lowagie.text Chunk NEWLINE
Chunk NEWLINE
To view the source code for com.lowagie.text Chunk NEWLINE.
Click Source Link
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForBatchPdfView.java
License:Open Source License
@Override protected final String addContent(final Document document, final Map<String, Object> model, final Locale locale, final PdfWriter writer) throws DocumentException, IOException { String documentTitle = translationService.translate("qualityControls.qualityControlForBatch.report.title", locale);/*from www. j av a 2 s .c om*/ String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); qualityControlsReportService.addQualityControlReportHeader(document, model, locale); List<Entity> orders = qualityControlsReportService.getOrderSeries(model, "qualityControlsForBatch"); Map<Entity, List<Entity>> productOrders = qualityControlsReportService.getQualityOrdersForProduct(orders); Map<Entity, List<BigDecimal>> quantities = qualityControlsReportService .getQualityOrdersQuantitiesForProduct(orders); quantities = SortUtil.sortMapUsingComparator(quantities, new EntityNumberComparator()); addOrderSeries(document, quantities, locale); productOrders = SortUtil.sortMapUsingComparator(productOrders, new EntityNumberComparator()); for (Entry<Entity, List<Entity>> entry : productOrders.entrySet()) { document.add(Chunk.NEWLINE); addProductSeries(document, entry, locale); } return translationService.translate("qualityControls.qualityControlForBatch.report.fileName", locale); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOperationPdfView.java
License:Open Source License
@Override protected final String addContent(final Document document, final Map<String, Object> model, final Locale locale, final PdfWriter writer) throws DocumentException, IOException { String documentTitle = translationService .translate("qualityControls.qualityControlForOperation.report.title", locale); String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); qualityControlsReportService.addQualityControlReportHeader(document, model, locale); List<Entity> orders = qualityControlsReportService.getOrderSeries(model, "qualityControlsForOperation"); Map<Entity, List<Entity>> operationOrders = qualityControlsReportService .getQualityOrdersForOperation(orders); Map<Entity, List<BigDecimal>> quantities = qualityControlsReportService .getQualityOrdersResultsQuantitiesForOperation(orders); quantities = SortUtil.sortMapUsingComparator(quantities, new EntityNumberComparator()); addOrderSeries(document, quantities, locale); operationOrders = SortUtil.sortMapUsingComparator(operationOrders, new EntityNumberComparator()); for (Entry<Entity, List<Entity>> entry : operationOrders.entrySet()) { document.add(Chunk.NEWLINE); addProductSeries(document, entry, locale); }//from ww w .jav a2s.c o m return translationService.translate("qualityControls.qualityControlForOperation.report.fileName", locale); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOrderPdfView.java
License:Open Source License
@Override protected final String addContent(final Document document, final Map<String, Object> model, final Locale locale, final PdfWriter writer) throws DocumentException, IOException { String documentTitle = translationService.translate("qualityControls.qualityControlForOrder.report.title", locale);/*from ww w . j a va 2 s .com*/ String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); qualityControlsReportService.addQualityControlReportHeader(document, model, locale); List<Entity> orders = qualityControlsReportService.getOrderSeries(model, "qualityControlsForOrder"); Map<Entity, List<Entity>> productOrders = qualityControlsReportService.getQualityOrdersForProduct(orders); Map<Entity, List<BigDecimal>> quantities = qualityControlsReportService .getQualityOrdersResultsQuantitiesForProduct(orders); quantities = SortUtil.sortMapUsingComparator(quantities, new EntityNumberComparator()); addOrderSeries(document, quantities, locale); productOrders = SortUtil.sortMapUsingComparator(productOrders, new EntityNumberComparator()); for (Entry<Entity, List<Entity>> entry : productOrders.entrySet()) { document.add(Chunk.NEWLINE); addProductSeries(document, entry, locale); } return translationService.translate("qualityControls.qualityControlForOrder.report.fileName", locale); }
From source file:com.qcadoo.mes.qualityControls.print.QualityControlForUnitPdfView.java
License:Open Source License
@Override protected final String addContent(final Document document, final Map<String, Object> model, final Locale locale, final PdfWriter writer) throws DocumentException, IOException { String documentTitle = translationService.translate("qualityControls.qualityControlForUnit.report.title", locale);/* ww w .j a v a 2 s .co m*/ String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); qualityControlsReportService.addQualityControlReportHeader(document, model, locale); List<Entity> orders = qualityControlsReportService.getOrderSeries(model, "qualityControlsForUnit"); Map<Entity, List<Entity>> productOrders = qualityControlsReportService.getQualityOrdersForProduct(orders); Map<Entity, List<BigDecimal>> quantities = qualityControlsReportService .getQualityOrdersQuantitiesForProduct(orders); quantities = SortUtil.sortMapUsingComparator(quantities, new EntityNumberComparator()); addOrderSeries(document, quantities, locale); productOrders = SortUtil.sortMapUsingComparator(productOrders, new EntityNumberComparator()); for (Entry<Entity, List<Entity>> entry : productOrders.entrySet()) { document.add(Chunk.NEWLINE); addProductSeries(document, entry, locale); } return translationService.translate("qualityControls.qualityControlForUnit.report.fileName", locale); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addOrders(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { document.add(Chunk.NEWLINE); document.add(new Paragraph(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.paragrah2", locale), FontUtils.getDejavuBold11Dark())); List<String> simpleMaterialBalanceOrdersTableHeader = new ArrayList<String>(); simpleMaterialBalanceOrdersTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.number", locale)); simpleMaterialBalanceOrdersTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.name", locale)); PdfPTable table = pdfHelper.createTableWithHeader(2, simpleMaterialBalanceOrdersTableHeader, false); List<Entity> orders = new ArrayList<Entity>( simpleMaterialBalance.getHasManyField(L_SIMPLE_MATERIAL_BALANCE_ORDERS_COMPONENTS)); Collections.sort(orders, new EntityOrderNumberComparator()); for (Entity e : orders) { table.addCell(new Phrase(e.getBelongsToField(L_ORDER).getStringField(L_NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(e.getBelongsToField(L_ORDER).getStringField(L_NAME), FontUtils.getDejavuRegular7Dark())); }/* www. j a va 2s . c om*/ document.add(table); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addLocations(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { document.add(Chunk.NEWLINE); document.add(new Paragraph(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.paragrah3", locale), FontUtils.getDejavuBold11Dark())); List<String> simpleMaterialBalanceLocationTableHeader = new ArrayList<String>(); simpleMaterialBalanceLocationTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.number", locale)); simpleMaterialBalanceLocationTableHeader.add(translationService .translate("simpleMaterialBalance.simpleMaterialBalance.report.columnHeader.name", locale)); PdfPTable table = pdfHelper.createTableWithHeader(2, simpleMaterialBalanceLocationTableHeader, false); List<Entity> simpleMaterialBalanceLocationComponents = new ArrayList<Entity>( simpleMaterialBalance.getHasManyField(L_SIMPLE_MATERIAL_BALANCE_LOCATIONS_COMPONENTS)); Collections.sort(simpleMaterialBalanceLocationComponents, new EntityLocationNumberComparator()); for (Entity simpleMaterialBalanceLocationComponent : simpleMaterialBalanceLocationComponents) { table.addCell(new Phrase( simpleMaterialBalanceLocationComponent.getBelongsToField(L_LOCATION).getStringField(L_NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase( simpleMaterialBalanceLocationComponent.getBelongsToField(L_LOCATION).getStringField(L_NAME), FontUtils.getDejavuRegular7Dark())); }// w ww . j a v a 2 s.com document.add(table); }
From source file:com.qcadoo.mes.workPlans.pdf.document.order.component.OrderTable.java
License:Open Source License
public void print(GroupingContainer groupingContainer, Document document, Locale locale) throws DocumentException { document.add(ordersTableHeaderParagraph(locale)); Map<OrderColumn, ColumnAlignment> orderColumnToAlignment = groupingContainer.getOrderColumnToAlignment(); int columnCount = orderColumnToAlignment.size(); Map<String, HeaderAlignment> headerAlignments = new HashMap<String, HeaderAlignment>(columnCount); List<String> headers = new ArrayList<String>(columnCount); fill(locale, orderColumnToAlignment, headers, headerAlignments); PdfPTable orderTable = pdfHelper.createTableWithHeader(columnCount, headers, false, headerAlignments); PdfPCell defaultCell = orderTable.getDefaultCell(); for (Entity order : groupingContainer.getOrders()) { for (Map.Entry<OrderColumn, ColumnAlignment> e : orderColumnToAlignment.entrySet()) { alignColumn(defaultCell, e.getValue()); orderTable.addCell(orderColumnValuePhrase(order, e.getKey())); }//from w w w .j a va 2s . com } document.add(orderTable); document.add(Chunk.NEWLINE); }
From source file:com.qcadoo.report.internal.PdfHelperImpl.java
License:Open Source License
@Override public void addDocumentHeader(final Document document, final String name, final String documenTitle, final String documentAuthor, final Date date, final String username) throws DocumentException { SimpleDateFormat df = new SimpleDateFormat(DateUtils.L_DATE_TIME_FORMAT, getLocale()); LineSeparator line = new LineSeparator(3, 100f, ColorUtils.getLineDarkColor(), Element.ALIGN_LEFT, 0); document.add(Chunk.NEWLINE); Paragraph title = new Paragraph(new Phrase(documenTitle, FontUtils.getDejavuBold17Light())); title.add(new Phrase(" " + name, FontUtils.getDejavuBold17Dark())); title.setSpacingAfter(7f);/* www.j a v a 2 s. c o m*/ document.add(title); document.add(line); PdfPTable userAndDate = new PdfPTable(2); userAndDate.setWidthPercentage(100f); userAndDate.setHorizontalAlignment(Element.ALIGN_LEFT); userAndDate.getDefaultCell().setBorderWidth(0); Paragraph userParagraph = new Paragraph(new Phrase(documentAuthor, FontUtils.getDejavuRegular9Light())); userParagraph.add(new Phrase(" " + username, FontUtils.getDejavuRegular9Dark())); Paragraph dateParagraph = new Paragraph(df.format(date), FontUtils.getDejavuRegular9Light()); userAndDate.addCell(userParagraph); userAndDate.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); userAndDate.addCell(dateParagraph); userAndDate.setSpacingAfter(14f); document.add(userAndDate); }
From source file:com.qcadoo.report.internal.PdfHelperImpl.java
License:Open Source License
@Override public void addDocumentHeader(final Document document, final String name, final String documenTitle, final String documentAuthor, final Date date) throws DocumentException { SimpleDateFormat df = new SimpleDateFormat(DateUtils.L_DATE_TIME_FORMAT, getLocale()); LineSeparator line = new LineSeparator(2, 100f, ColorUtils.getLineDarkColor(), Element.ALIGN_LEFT, 0); document.add(Chunk.NEWLINE); Paragraph title = new Paragraph(new Phrase(documenTitle, FontUtils.getDejavuBold17Light())); title.add(new Phrase(" " + name, FontUtils.getDejavuBold17Dark())); title.setSpacingAfter(7f);//from ww w . ja v a 2 s. com document.add(title); document.add(line); PdfPTable userAndDate = new PdfPTable(2); userAndDate.setWidthPercentage(100f); userAndDate.setHorizontalAlignment(Element.ALIGN_LEFT); userAndDate.getDefaultCell().setBorderWidth(0); Paragraph userParagraph = new Paragraph(new Phrase(documentAuthor, FontUtils.getDejavuRegular9Light())); userParagraph.add(new Phrase(" " + getDocumentAuthor(), FontUtils.getDejavuRegular9Dark())); Paragraph dateParagraph = new Paragraph(df.format(date), FontUtils.getDejavuRegular9Light()); userAndDate.addCell(userParagraph); userAndDate.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); userAndDate.addCell(dateParagraph); userAndDate.setSpacingAfter(14f); document.add(userAndDate); }
From source file:com.qcadoo.report.internal.PdfHelperImpl.java
License:Open Source License
@Override public void addImage(final Document document, final String fileName) { try {//from ww w .j a v a2 s . c om Image img = Image.getInstance(fileName); if (img.getWidth() > 515 || img.getHeight() > 370) { img.scaleToFit(515, 370); } document.add(img); document.add(Chunk.NEWLINE); } catch (BadElementException e) { LOG.error(e.getMessage(), e); } catch (MalformedURLException e) { LOG.error(e.getMessage(), e); } catch (IOException e) { LOG.error(e.getMessage(), e); } catch (DocumentException e) { LOG.error(e.getMessage(), e); } }