Example usage for com.lowagie.text Phrase Phrase

List of usage examples for com.lowagie.text Phrase Phrase

Introduction

In this page you can find the example usage for com.lowagie.text Phrase Phrase.

Prototype

public Phrase(float leading, String string) 

Source Link

Document

Constructs a Phrase with a certain leading and a certain String.

Usage

From source file:com.qcadoo.mes.productionCountingWithCosts.pdf.ProductionBalanceWithCostsPdfService.java

License:Open Source License

private PdfPTable createAssumptionsForCumulatedRecordsPanel(final Entity productionBalance,
        final Locale locale) {
    PdfPTable parametersForCostsPanel = pdfHelper.createPanelTable(1);

    parametersForCostsPanel.addCell(new Phrase(translationService.translate(
            "productionCounting.productionBalance.report.panel.assumptionsForCumulatedRecords", locale) + ":",
            FontUtils.getDejavuBold10Dark()));

    PdfPTable content = pdfHelper.createPanelTable(2);
    content.setTableEvent(null);/*from  w  w  w .j  a v a 2  s  .com*/

    BigDecimal averageMachineHourlyCost = productionBalance
            .getDecimalField(ProductionBalanceFieldsPCWC.AVERAGE_MACHINE_HOURLY_COST);
    String averageMachineHourlyCostLabel = translationService
            .translate("productionCounting.productionBalance.averageMachineHourlyCost.label", locale);
    pdfHelper.addTableCellAsTable(content, averageMachineHourlyCostLabel,
            numberService.format(averageMachineHourlyCost), FontUtils.getDejavuBold9Dark(),
            FontUtils.getDejavuRegular7Dark(), 2);

    BigDecimal averageLaborHourlyCost = productionBalance
            .getDecimalField(ProductionBalanceFieldsPCWC.AVERAGE_LABOR_HOURLY_COST);
    String averageLaborHourlyCostLabel = translationService
            .translate("productionCounting.productionBalance.averageLaborHourlyCost.label", locale);
    pdfHelper.addTableCellAsTable(content, averageLaborHourlyCostLabel,
            numberService.format(averageLaborHourlyCost), FontUtils.getDejavuBold9Dark(),
            FontUtils.getDejavuRegular7Dark(), 2);

    parametersForCostsPanel.addCell(content);

    return parametersForCostsPanel;
}

From source file:com.qcadoo.mes.productionCountingWithCosts.pdf.ProductionBalanceWithCostsPdfService.java

License:Open Source License

private void addRegisteredTechnicalCosts(final PdfPTable content, final Entity productionBalance,
        final Locale locale) {
    content.addCell(new Phrase(translationService.translate(
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.registeredTechnicalProductionCosts",
            locale) + ":", FontUtils.getDejavuBold10Dark()));
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.registeredTotalTechnicalProductionCostsLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.REGISTERED_TOTAL_TECHNICAL_PRODUCTION_COSTS),
            locale);//from www . j a v  a 2 s .co  m
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.registeredTotalTechnicalProductionCostPerUnitLabel.label",
            productionBalance.getField(
                    ProductionBalanceFieldsPCWC.REGISTERED_TOTAL_TECHNICAL_PRODUCTION_COST_PER_UNIT),
            locale);
}

From source file:com.qcadoo.mes.productionCountingWithCosts.pdf.ProductionBalanceWithCostsPdfService.java

License:Open Source License

private void addPlannedTechnicalCosts(final PdfPTable content, final Entity productionBalance,
        final Locale locale) {
    content.addCell(new Phrase(translationService.translate(
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.plannedTechnicalProductionCosts",
            locale) + ":", FontUtils.getDejavuBold10Dark()));
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.totalTechnicalProductionCostsLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.TOTAL_TECHNICAL_PRODUCTION_COSTS), locale);
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.totalTechnicalProductionCostPerUnitLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.TOTAL_TECHNICAL_PRODUCTION_COST_PER_UNIT),
            locale);/*  w ww .java2  s . c  o  m*/

}

From source file:com.qcadoo.mes.productionCountingWithCosts.pdf.ProductionBalanceWithCostsPdfService.java

License:Open Source License

private void addTechnicalCostsBalance(final PdfPTable content, final Entity productionBalance,
        final Locale locale) {
    content.addCell(new Phrase(translationService.translate(
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.technicalProductionCostsBalance",
            locale) + ":", FontUtils.getDejavuBold10Dark()));
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.balanceTechnicalProductionCostsLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.BALANCE_TECHNICAL_PRODUCTION_COSTS), locale);
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.balanceTechnicalProductionCostPerUnitLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.BALANCE_TECHNICAL_PRODUCTION_COST_PER_UNIT),
            locale);/*  www. j a  v  a  2s. com*/

}

From source file:com.qcadoo.mes.productionCountingWithCosts.pdf.ProductionBalanceWithCostsPdfService.java

License:Open Source License

private PdfPTable createOverheadsAndSummaryPanel(final Entity productionBalance, final Locale locale) {
    PdfPTable content = pdfHelper.createPanelTable(1);

    content.addCell(new Phrase(translationService.translate(
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.overheadsForRegisteredCosts",
            locale) + ":", FontUtils.getDejavuBold10Dark()));

    addCurrencyNumericWithLabel(content, "productionCounting.productionBalance.productionCostMarginValue.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.PRODUCTION_COST_MARGIN_VALUE), locale);
    addCurrencyNumericWithLabel(content, "productionCounting.productionBalance.materialCostMarginValue.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.MATERIAL_COST_MARGIN_VALUE), locale);
    addCurrencyNumericWithLabel(content, "productionCounting.productionBalance.additionalOverheadValue.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.ADDITIONAL_OVERHEAD_VALUE), locale);
    addCurrencyNumericWithLabel(content, "productionCounting.productionBalance.totalOverhead.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.TOTAL_OVERHEAD), locale,
            FontUtils.getDejavuRegular7Dark(), FontUtils.getDejavuBold9Dark());

    content.addCell(new Phrase(translationService.translate(
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.summaryForRegisteredCosts",
            locale), FontUtils.getDejavuBold10Dark()));

    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.totalCostsLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.TOTAL_COSTS), locale);
    addCurrencyNumericWithLabel(content,
            "productionCounting.productionBalanceDetails.window.costsSummaryTab.totalCostPerUnitLabel.label",
            productionBalance.getField(ProductionBalanceFieldsPCWC.TOTAL_COST_PER_UNIT), locale);

    return content;
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForBatchPdfView.java

License:Open Source License

private void addOrderSeries(final Document document, final Map<Entity, List<BigDecimal>> quantities,
        final Locale locale) throws DocumentException {
    List<String> qualityHeader = new ArrayList<String>();
    qualityHeader/*www .j  ava  2  s  . c o  m*/
            .add(translationService.translate("qualityControls.qualityControl.report.product.number", locale));
    qualityHeader.add(translationService.translate(
            "qualityControlsForBatch.qualityControlForBatchDetails.window.mainTab.qualityControlForBatch.controlledQuantity.label",
            locale));
    qualityHeader.add(translationService.translate(
            "qualityControlsForBatch.qualityControlForBatchDetails.window.mainTab.qualityControlForBatch.rejectedQuantity.label",
            locale));
    qualityHeader.add(translationService.translate(
            "qualityControlsForBatch.qualityControlForBatchDetails.window.mainTab.qualityControlForBatch.acceptedDefectsQuantity.label",
            locale));
    Map<String, HeaderAlignment> alignments = Maps.newHashMap();
    alignments.put(translationService.translate("qualityControls.qualityControl.report.product.number", locale),
            HeaderAlignment.LEFT);
    alignments.put(translationService.translate(
            "qualityControlsForBatch.qualityControlForBatchDetails.window.mainTab.qualityControlForBatch.controlledQuantity.label",
            locale), HeaderAlignment.RIGHT);
    alignments.put(translationService.translate(
            "qualityControlsForBatch.qualityControlForBatchDetails.window.mainTab.qualityControlForBatch.rejectedQuantity.label",
            locale), HeaderAlignment.RIGHT);
    alignments.put(translationService.translate(
            "qualityControlsForBatch.qualityControlForBatchDetails.window.mainTab.qualityControlForBatch.acceptedDefectsQuantity.label",
            locale), HeaderAlignment.RIGHT);

    PdfPTable table = pdfHelper.createTableWithHeader(4, qualityHeader, false, alignments);
    for (Entry<Entity, List<BigDecimal>> entry : quantities.entrySet()) {
        table.addCell(new Phrase(entry.getKey() == null ? "" : entry.getKey().getStringField("number"),
                FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(0)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(1)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(2)), FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    }
    document.add(table);
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForBatchPdfView.java

License:Open Source License

private void addProductSeries(final Document document, final Entry<Entity, List<Entity>> entry,
        final Locale locale) throws DocumentException {

    document.add(qualityControlsReportService.prepareTitle(entry.getKey(), locale, "batch"));

    List<String> productHeader = new ArrayList<String>();
    productHeader/*from w ww.  j a v a  2s.  c om*/
            .add(translationService.translate("qualityControls.qualityControl.report.batch.number", locale));
    productHeader
            .add(translationService.translate("qualityControls.qualityControl.report.control.number", locale));
    productHeader.add(
            translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale));
    productHeader.add(
            translationService.translate("qualityControls.qualityControl.report.rejected.quantity", locale));
    productHeader.add(translationService
            .translate("qualityControls.qualityControl.report.accepted.defects.quantity", locale));
    Map<String, HeaderAlignment> alignments = Maps.newHashMap();
    alignments.put(translationService.translate("qualityControls.qualityControl.report.batch.number", locale),
            HeaderAlignment.LEFT);
    alignments.put(translationService.translate("qualityControls.qualityControl.report.control.number", locale),
            HeaderAlignment.LEFT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.rejected.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(translationService.translate(
            "qualityControls.qualityControl.report.accepted.defects.quantity", locale), HeaderAlignment.RIGHT);

    PdfPTable table = pdfHelper.createTableWithHeader(5, productHeader, false, alignments);

    List<Entity> sortedOrders = entry.getValue();

    Collections.sort(sortedOrders, new EntityBatchNumberComparator());

    for (Entity entity : sortedOrders) {
        table.addCell(
                new Phrase(entity.getStringField("batchNr") == null ? "" : entity.getStringField("batchNr"),
                        FontUtils.getDejavuRegular7Dark()));
        table.addCell(new Phrase(entity.getStringField("number"), FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(new Phrase(numberService.format(entity.getDecimalField("controlledQuantity")),
                FontUtils.getDejavuRegular7Dark()));
        table.addCell(new Phrase(numberService.format(entity.getDecimalField("rejectedQuantity")),
                FontUtils.getDejavuRegular7Dark()));
        table.addCell(new Phrase(numberService.format(entity.getDecimalField("acceptedDefectsQuantity")),
                FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    }

    document.add(table);
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOperationPdfView.java

License:Open Source License

private void addOrderSeries(final Document document, final Map<Entity, List<BigDecimal>> quantities,
        final Locale locale) throws DocumentException {
    List<String> qualityHeader = new ArrayList<String>();
    qualityHeader.add(// ww  w.  j  av  a 2s  .c  o m
            translationService.translate("qualityControls.qualityControl.report.operation.number", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.correct.quantity", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.incorrect.quantity", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.objective.quantity", locale));
    Map<String, HeaderAlignment> alignments = Maps.newHashMap();
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.operation.number", locale),
            HeaderAlignment.LEFT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.correct.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.incorrect.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.objective.quantity", locale),
            HeaderAlignment.RIGHT);

    PdfPTable table = pdfHelper.createTableWithHeader(5, qualityHeader, false, alignments);
    for (Entry<Entity, List<BigDecimal>> entry : quantities.entrySet()) {
        table.addCell(new Phrase(entry.getKey() == null ? "" : entry.getKey().getStringField("nodeNumber"),
                FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(0)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(1)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(2)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(3)), FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    }
    document.add(table);
}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOperationPdfView.java

License:Open Source License

private void addProductSeries(final Document document, final Entry<Entity, List<Entity>> entry,
        final Locale locale) throws DocumentException {

    document.add(qualityControlsReportService.prepareTitle(entry.getKey(), locale, "operation"));

    List<String> productHeader = new ArrayList<String>();
    productHeader/*from  w w w . j  a v  a 2s  .co  m*/
            .add(translationService.translate("qualityControls.qualityControl.report.control.number", locale));
    productHeader.add(translationService.translate(
            "qualityControlsForOperation.qualityControlForOperationDetails.window.mainTab.qualityControlForOperation.controlResult.label",
            locale));
    PdfPTable table = pdfHelper.createTableWithHeader(2, productHeader, false);
    List<Entity> sortedOrders = entry.getValue();
    Collections.sort(sortedOrders, new EntityNumberComparator());
    for (Entity entity : sortedOrders) {
        table.addCell(new Phrase(entity.getStringField("number"), FontUtils.getDejavuRegular7Dark()));
        table.addCell(new Phrase(
                translationService.translate("qualityControls.qualityForOrder.controlResult.value."
                        + entity.getField("controlResult").toString(), locale),
                FontUtils.getDejavuRegular7Dark()));
    }
    document.add(table);

}

From source file:com.qcadoo.mes.qualityControls.print.QualityControlForOrderPdfView.java

License:Open Source License

private void addOrderSeries(final Document document, final Map<Entity, List<BigDecimal>> quantities,
        final Locale locale) throws DocumentException {
    List<String> qualityHeader = new ArrayList<String>();
    qualityHeader// w ww  .  ja v a2  s.co m
            .add(translationService.translate("qualityControls.qualityControl.report.product.number", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale));
    qualityHeader
            .add(translationService.translate("qualityControls.qualityControl.report.done.quantity", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.correct.quantity", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.incorrect.quantity", locale));
    qualityHeader.add(
            translationService.translate("qualityControls.qualityControl.report.objective.quantity", locale));
    Map<String, HeaderAlignment> alignments = Maps.newHashMap();
    alignments.put(translationService.translate("qualityControls.qualityControl.report.product.number", locale),
            HeaderAlignment.LEFT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.controlled.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(translationService.translate("qualityControls.qualityControl.report.done.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.correct.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.incorrect.quantity", locale),
            HeaderAlignment.RIGHT);
    alignments.put(
            translationService.translate("qualityControls.qualityControl.report.objective.quantity", locale),
            HeaderAlignment.RIGHT);

    PdfPTable table = pdfHelper.createTableWithHeader(6, qualityHeader, false, alignments);

    for (Entry<Entity, List<BigDecimal>> entry : quantities.entrySet()) {
        table.addCell(new Phrase(entry.getKey() == null ? "" : entry.getKey().getStringField("number"),
                FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(0)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(4)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(1)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(2)), FontUtils.getDejavuRegular7Dark()));
        table.addCell(
                new Phrase(numberService.format(entry.getValue().get(3)), FontUtils.getDejavuRegular7Dark()));
        table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
    }
    document.add(table);
}