List of usage examples for com.lowagie.text.pdf PdfPTable setSpacingAfter
public void setSpacingAfter(float spacing)
From source file:com.qcadoo.mes.productionCounting.print.ProductionTrackingReportPdfService.java
License:Open Source License
@Override protected void buildPdfContent(final Document document, final Entity productionTrackingReport, final Locale locale) throws DocumentException { final String documentTitle = translationService .translate("productionCounting.productionTrackingReport.report.title", locale) + " " + productionTrackingReport.getId().toString(); final String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale);//ww w . j a v a2s.c o m pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, productionTrackingReport.getDateField(ProductionTrackingReportFields.DATE)); final PdfPTable leftPanel = createLeftPanel(productionTrackingReport, locale); final PdfPTable rightPanel = createRightPanel(productionTrackingReport, locale); final PdfPTable panelTable = pdfHelper.createPanelTable(2); panelTable.addCell(leftPanel); panelTable.addCell(rightPanel); panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); document.add(panelTable); Entity order = productionTrackingReport.getBelongsToField(ProductionTrackingReportFields.ORDER); final List<Entity> productionTrackings = productionCountingService.getProductionTrackingsForOrder(order); Collections.sort(productionTrackings, new EntityProductionTrackingComparator()); for (Entity productionTracking : productionTrackings) { addProductionTracking(document, productionTracking, locale); } }
From source file:com.qcadoo.mes.productionCountingWithCosts.pdf.ProductionBalanceWithCostsPdfService.java
License:Open Source License
@Override protected void buildPdfContent(final Document document, final Entity productionBalance, final Locale locale) throws DocumentException { String documentTitle = translationService.translate("productionCounting.productionBalance.report.title", locale);//from w w w . ja va 2 s. co m String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, productionBalance.getDateField(ProductionBalanceFields.DATE)); PdfPTable topTable = pdfHelper.createPanelTable(2); topTable.addCell(productionBalancePdfService.createLeftPanel(productionBalance, locale)); topTable.addCell(productionBalancePdfService.createRightPanel(productionBalance, locale)); topTable.setSpacingBefore(20); document.add(topTable); PdfPTable parametersForCostsPanel = createParametersForCostsPanel(productionBalance, locale); parametersForCostsPanel.setSpacingBefore(20); document.add(parametersForCostsPanel); Entity order = productionBalance.getBelongsToField(ProductionBalanceFields.ORDER); String typeOfProductionRecording = order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING); String calculateOperationCostMode = productionBalance .getStringField(ProductionBalanceFields.CALCULATE_OPERATION_COST_MODE); final boolean isTypeOfProductionRecordingCumulated = productionCountingService .isTypeOfProductionRecordingCumulated(typeOfProductionRecording); final boolean isTypeOfProductionRecordingForEach = productionCountingService .isTypeOfProductionRecordingForEach(typeOfProductionRecording); final boolean isCalculateOperationCostModeHourly = productionCountingService .isCalculateOperationCostModeHourly(calculateOperationCostMode); final boolean isCalculateOperationCostModePiecework = productionCountingService .isCalculateOperationCostModePiecework(calculateOperationCostMode); if (isCalculateOperationCostModeHourly && isTypeOfProductionRecordingCumulated) { PdfPTable assumptionForCumulatedRecordsPanel = createAssumptionsForCumulatedRecordsPanel( productionBalance, locale); assumptionForCumulatedRecordsPanel.setSpacingBefore(20); document.add(assumptionForCumulatedRecordsPanel); } PdfPTable bottomTable = pdfHelper.createPanelTable(2); bottomTable.addCell(createCostsPanel(productionBalance, locale)); bottomTable.addCell(createOverheadsAndSummaryPanel(productionBalance, locale)); bottomTable.setSpacingBefore(20); bottomTable.setSpacingAfter(20); document.add(bottomTable); productionBalancePdfService.addInputProductsBalance(document, productionBalance, locale); addMaterialCost(document, productionBalance, locale); productionBalancePdfService.addOutputProductsBalance(document, productionBalance, locale); if (isCalculateOperationCostModeHourly) { if (isTypeOfProductionRecordingCumulated) { productionBalancePdfService.addTimeBalanceAsPanel(document, productionBalance, locale); addProductionCosts(document, productionBalance, locale); } else if (isTypeOfProductionRecordingForEach) { productionBalancePdfService.addMachineTimeBalance(document, productionBalance, locale); addCostsBalance("machine", document, productionBalance, locale); productionBalancePdfService.addLaborTimeBalance(document, productionBalance, locale); addCostsBalance("labor", document, productionBalance, locale); } } else if (isCalculateOperationCostModePiecework) { productionBalancePdfService.addPieceworkBalance(document, productionBalance, locale); addCostsBalance("cycles", document, productionBalance, locale); } costCalculationPdfService.printMaterialAndOperationNorms(document, productionBalance, locale); }
From source file:com.qcadoo.mes.simpleMaterialBalance.internal.print.SimpleMaterialBalancePdfService.java
License:Open Source License
private void addPanel(final Document document, final Entity simpleMaterialBalance, final Locale locale) throws DocumentException { PdfPTable panelTable = pdfHelper.createPanelTable(2); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.date", locale), DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.DEFAULT, locale) .format((Date) simpleMaterialBalance.getField(L_DATE))); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.name", locale),//from w w w. j a va 2 s . c o m simpleMaterialBalance.getStringField(L_NAME)); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.worker", locale), simpleMaterialBalance.getStringField(L_WORKER)); pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "simpleMaterialBalance.simpleMaterialBalance.report.panel.simpleMaterialBalance.mrpAlgorithm", locale), translationService.translate("simpleMaterialBalance.simpleMaterialBalance.mrpAlgorithm.value." + simpleMaterialBalance.getStringField("mrpAlgorithm"), locale)); panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); document.add(panelTable); }
From source file:com.qcadoo.mes.technologies.print.TechnologiesTechnologyDetailsPdfView.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 { checkState(model.get("id") != null, "Unable to generate report for unsaved technology! (missing id)"); String documentTitle = translationService .translate("technologies.technologiesTechnologyDetails.report.title", locale); String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); DataDefinition technologyDD = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY); Entity technology = technologyDD.get(valueOf(model.get("id").toString())); Map<String, String> panelTableValues = newLinkedHashMap(); panelTableValues.put(TechnologyFields.NAME, technology.getStringField(TechnologyFields.NAME)); panelTableValues.put(TechnologyFields.NUMBER, technology.getStringField(TechnologyFields.NUMBER)); panelTableValues.put(TechnologyFields.PRODUCT, technology.getBelongsToField(TechnologyFields.PRODUCT).getStringField(ProductFields.NAME)); panelTableValues.put("default", technology.getBooleanField(TechnologyFields.MASTER) ? translationService.translate("qcadooView.true", locale) : translationService.translate("qcadooView.false", locale)); panelTableValues.put(TechnologyFields.DESCRIPTION, technology.getStringField(TechnologyFields.DESCRIPTION)); PdfPTable panelTable = pdfHelper.createPanelTable(2); for (Map.Entry<String, String> panelEntry : panelTableValues.entrySet()) { pdfHelper.addTableCellAsOneColumnTable(panelTable, translationService.translate( "technologies.technologiesTechnologyDetails.report.panel.technology." + panelEntry.getKey(), locale), panelEntry.getValue()); }// www .j a v a 2s . c o m panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); document.add(panelTable); List<String> technologyDetailsTableHeader = new ArrayList<String>(); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.level", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.name", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.direction", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.productNumber", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.productName", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.quantity", locale)); technologyDetailsTableHeader.add(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.unit", locale)); Map<String, HeaderAlignment> alignments = Maps.newHashMap(); alignments.put(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.level", locale), HeaderAlignment.LEFT); alignments.put(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.name", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.direction", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.productNumber", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.productName", locale), HeaderAlignment.LEFT); alignments.put( translationService.translate( "technologies.technologiesTechnologyDetails.report.columnHeader.quantity", locale), HeaderAlignment.RIGHT); alignments.put(translationService .translate("technologies.technologiesTechnologyDetails.report.columnHeader.unit", locale), HeaderAlignment.LEFT); PdfPTable table = pdfHelper.createTableWithHeader(7, technologyDetailsTableHeader, false, alignments); EntityTree technologyTree = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); treeNumberingService.generateTreeNumbers(technologyTree); List<Entity> technologyOperationComponents = entityTreeUtilsService.getSortedEntities(technologyTree); for (Entity technologyOperationComponent : technologyOperationComponents) { String nodeNumber = technologyOperationComponent .getStringField(TechnologyOperationComponentFields.NODE_NUMBER); String operationName = technologyOperationComponent .getBelongsToField(TechnologyOperationComponentFields.OPERATION) .getStringField(OperationFields.NAME); List<Entity> operationProductComponents = newArrayList(); operationProductComponents.addAll(technologyOperationComponent .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_IN_COMPONENTS)); operationProductComponents.addAll(technologyOperationComponent .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS)); for (Entity operationProductComponent : operationProductComponents) { Entity product = operationProductComponent.getBelongsToField(L_PRODUCT); String productType = "technologies.technologiesTechnologyDetails.report.direction.out"; if (operationProductComponent.getDataDefinition().getName().equals("operationProductInComponent")) { productType = "technologies.technologiesTechnologyDetails.report.direction.in"; } table.addCell(new Phrase(nodeNumber, FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(operationName, FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(translationService.translate(productType, locale), FontUtils.getDejavuRegular7Dark())); table.addCell(new Phrase(product.getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular7Dark())); table.addCell( new Phrase(product.getStringField(ProductFields.NAME), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(new Phrase(numberService.format(operationProductComponent.getField(L_QUANTITY)), FontUtils.getDejavuRegular7Dark())); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell( new Phrase(product.getStringField(ProductFields.UNIT), FontUtils.getDejavuRegular7Dark())); } } document.add(table); return translationService.translate("technologies.technologiesTechnologyDetails.report.fileName", locale); }
From source file:com.qcadoo.mes.warehouseMinimalState.print.DocumentPdf.java
License:Open Source License
private PdfPTable createTable() { int[] headerWidths = Ints.toArray(getHeaderWidths()); Map<String, HeaderAlignment> headerValues = getHeaderValues(locale); PdfPTable warehouseTable = pdfHelper.createTableWithHeader(headerWidths.length, Lists.newArrayList(headerValues.keySet()), false, headerWidths, headerValues); warehouseTable.getDefaultCell().disableBorderSide(PdfPCell.RIGHT); warehouseTable.getDefaultCell().disableBorderSide(PdfPCell.LEFT); warehouseTable.setHeaderRows(1);/*from w ww . j a v a 2 s. co m*/ warehouseTable.setSpacingAfter(12.0f); return warehouseTable; }
From source file:com.qcadoo.mes.workPlans.pdf.document.operation.component.OperationCommentOperation.java
License:Open Source License
public void print(Entity operationComponent, Document document, Locale locale) throws DocumentException { String commentContent = operationComponent.getStringField(TechnologyOperationComponentFields.COMMENT); if (commentContent == null) return;//from www .j a va2 s. c om PdfPTable table = pdfHelper.createPanelTable(1); table.getDefaultCell().setBackgroundColor(null); String commentLabel = translationService.translate("workPlans.workPlan.report.operation.comment", locale); pdfHelper.addTableCellAsOneColumnTable(table, commentLabel, commentContent); table.setSpacingAfter(18); table.setSpacingBefore(9); document.add(table); }
From source file:com.qcadoo.mes.workPlans.pdf.document.operation.component.OperationOrderHeader.java
License:Open Source License
public void print(Entity order, GroupingContainer groupingContainer, Entity operationComponent, Document document, Locale locale) throws DocumentException { PdfPTable operationTable = pdfHelper.createPanelTable(3); operationOrderInfoOperation.print(operationComponent, operationTable, locale); if (groupingContainer.hasManyOrders() && isOrderInfoEnabled(operationComponent)) { operationOrderInfoHeader.print(order, operationTable, locale); }// w w w . ja v a 2 s. com if (isWorkstationInfoEnabled(operationComponent)) { operationOrderInfoWorkstation.print(operationComponent, operationTable, locale); } operationTable.setSpacingAfter(18); operationTable.setSpacingBefore(9); document.add(operationTable); }
From source file:com.qcadoo.mes.workPlans.pdf.document.operation.component.OperationProductInTable.java
License:Open Source License
public void print(GroupingContainer groupingContainer, Entity operationComponent, Document document, Locale locale) throws DocumentException { Map<Long, Map<OperationProductColumn, ColumnAlignment>> map = groupingContainer .getOperationComponentIdProductInColumnToAlignment(); Map<OperationProductColumn, ColumnAlignment> operationProductColumnAlignmentMap = map .get(operationComponent.getId()); int columnCount = operationProductColumnAlignmentMap.size(); Map<String, HeaderAlignment> headerAlignments = new HashMap<String, HeaderAlignment>(columnCount); List<String> headers = new ArrayList<String>(columnCount); fill(locale, operationProductColumnAlignmentMap, headers, headerAlignments); PdfPTable table = pdfHelper.createTableWithHeader(columnCount, headers, false, headerAlignments); PdfPCell defaultCell = table.getDefaultCell(); for (Entity operationProduct : operationProductInComponents(operationComponent)) { for (Map.Entry<OperationProductColumn, ColumnAlignment> e : operationProductColumnAlignmentMap .entrySet()) {/* w w w. j ava 2 s .c o m*/ alignColumn(defaultCell, e.getValue()); table.addCell(operationProductPhrase(operationProduct, e.getKey())); } } int additionalRows = workPlansService .getAdditionalRowsFromParameter(ParameterFieldsWP.ADDITIONAL_INPUT_ROWS); for (int i = 0; i < additionalRows; i++) { for (Map.Entry<OperationProductColumn, ColumnAlignment> e : operationProductColumnAlignmentMap .entrySet()) { alignColumn(defaultCell, e.getValue()); table.addCell(" "); } } table.setSpacingAfter(18); table.setSpacingBefore(9); document.add(table); }
From source file:com.qcadoo.mes.workPlans.pdf.document.operation.component.OperationProductOutTable.java
License:Open Source License
public void print(GroupingContainer groupingContainer, Entity operationComponent, Document document, Locale locale) throws DocumentException { Map<Long, Map<OperationProductColumn, ColumnAlignment>> map = groupingContainer .getOperationComponentIdProductInColumnToAlignment(); Map<OperationProductColumn, ColumnAlignment> operationProductColumnAlignmentMap = map .get(operationComponent.getId()); int columnCount = operationProductColumnAlignmentMap.size(); Map<String, HeaderAlignment> headerAlignments = new HashMap<String, HeaderAlignment>(columnCount); List<String> headers = new ArrayList<String>(columnCount); fill(locale, operationProductColumnAlignmentMap, headers, headerAlignments); PdfPTable table = pdfHelper.createTableWithHeader(columnCount, headers, false, headerAlignments); PdfPCell defaultCell = table.getDefaultCell(); for (Entity operationProduct : operationProductOutComponents(operationComponent)) { for (Map.Entry<OperationProductColumn, ColumnAlignment> e : operationProductColumnAlignmentMap .entrySet()) {/*w ww . j a v a 2 s . co m*/ alignColumn(defaultCell, e.getValue()); table.addCell(operationProductPhrase(operationProduct, e.getKey())); } } int additionalRows = workPlansService .getAdditionalRowsFromParameter(ParameterFieldsWP.ADDITIONAL_OUTPUT_ROWS); for (int i = 0; i < additionalRows; i++) { for (Map.Entry<OperationProductColumn, ColumnAlignment> e : operationProductColumnAlignmentMap .entrySet()) { alignColumn(defaultCell, e.getValue()); table.addCell(" "); } } table.setSpacingAfter(18); table.setSpacingBefore(9); document.add(table); }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addWorkPlanTitle(Document document, Entity workPlan, String title, Locale locale) throws DocumentException { PdfPTable headerTable = pdfHelper.createPanelTable(2); PdfPCell titleCell = new PdfPCell(); titleCell.setBorder(Rectangle.NO_BORDER); Paragraph workPlanTitle = new Paragraph( new Phrase(getWorkPlanTitle(locale), FontUtils.getDejavuBold11Light())); workPlanTitle.add(new Phrase(" " + getWorkPlanName(workPlan), FontUtils.getDejavuBold11Dark())); titleCell.addElement(workPlanTitle); PdfPCell divisionCell = new PdfPCell(); divisionCell.setBorder(Rectangle.NO_BORDER); Paragraph divisionTitle = new Paragraph( new Phrase(getDivisionTitle(locale), FontUtils.getDejavuBold11Light())); divisionTitle.add(new Phrase(" " + getDivisionFromTitle(title, locale), FontUtils.getDejavuBold11Dark())); divisionTitle.setAlignment(Element.ALIGN_RIGHT); divisionCell.addElement(divisionTitle); headerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); headerTable.setTableEvent(null);/* w w w. ja va2 s . com*/ headerTable.setSpacingAfter(4.0f); headerTable.addCell(titleCell); headerTable.addCell(divisionCell); document.add(headerTable); }