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.costCalculation.print.CostCalculationPdfService.java

License:Open Source License

public PdfPTable addOptionTablePrintCostNormsOfMaterials(final Entity costCalculation, final Locale locale) {
    List<String> optionTableHeader = Lists.newArrayList();

    Map<String, String> costModeName = getCostMode(costCalculation);

    for (String translate : Arrays.asList(
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER,
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME,
            costModeName.get(L_LOCALE_TYPE))) {
        optionTableHeader.add(translationService.translate(translate, locale));
    }/*from   w  w w  . ja va2s .  c o m*/

    Entity technology;
    Entity order = costCalculation.getBelongsToField(CostCalculationFields.ORDER);

    if (order == null) {
        technology = costCalculation.getBelongsToField(CostCalculationFields.TECHNOLOGY);
    } else {
        technology = order.getBelongsToField(CostCalculationFields.TECHNOLOGY);
    }

    BigDecimal givenQty = costCalculation.getDecimalField(CostCalculationFields.QUANTITY);

    Map<Long, BigDecimal> neededProductQuantities = productQuantitiesService.getNeededProductQuantities(
            technology, givenQty, MrpAlgorithm.COMPONENTS_AND_SUBCONTRACTORS_PRODUCTS);

    // TODO LUPO fix comparator
    // neededProductQuantities = SortUtil.sortMapUsingComparator(products, new EntityNumberComparator());

    PdfPTable printCostNormsOfMaterialTable = pdfHelper.createTableWithHeader(optionTableHeader.size(),
            optionTableHeader, false);

    for (Entry<Long, BigDecimal> neededProductQuantity : neededProductQuantities.entrySet()) {
        Entity product = productQuantitiesService.getProduct(neededProductQuantity.getKey());

        printCostNormsOfMaterialTable.addCell(
                new Phrase(product.getStringField(ProductFields.NUMBER), FontUtils.getDejavuRegular7Dark()));
        printCostNormsOfMaterialTable.addCell(
                new Phrase(product.getStringField(ProductFields.NAME), FontUtils.getDejavuRegular7Dark()));
        Entity entityProduct = productsCostCalculationService.getAppropriateCostNormForProduct(product, order,
                costCalculation.getStringField(CostCalculationFields.SOURCE_OF_MATERIAL_COSTS));
        BigDecimal toDisplay = entityProduct.getDecimalField(costModeName.get(L_COST_MODE));
        BigDecimal quantity = product.getDecimalField(ProductFieldsCNFP.COST_FOR_NUMBER);
        String unit = product.getStringField(ProductFields.UNIT);

        printCostNormsOfMaterialTable.addCell(new Phrase(
                numberService.format(toDisplay) + " " + " / " + numberService.format(quantity) + " " + unit,
                FontUtils.getDejavuRegular7Dark()));
    }

    return printCostNormsOfMaterialTable;
}

From source file:com.qcadoo.mes.costCalculation.print.CostCalculationPdfService.java

License:Open Source License

public void addOptionTablePrintOperationNormsHourly(final Document document, final Entity costCalculation,
        final Locale locale) throws DocumentException {
    List<String> optionTableHeader = Lists.newArrayList();

    for (String translate : Arrays.asList(
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER,
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME)) {
        optionTableHeader.add(translationService.translate(translate, locale));
    }/*from  w  ww .  j  av a 2 s .co  m*/

    List<Entity> calculationOperationComponents = entityTreeUtilsService.getSortedEntities(
            costCalculation.getTreeField(CostCalculationFields.CALCULATION_OPERATION_COMPONENTS));

    for (Entity calculationOperationComponent : calculationOperationComponents) {
        PdfPTable panelTableHeader = pdfHelper.createPanelTable(2);
        PdfPTable panelTableContent = pdfHelper.createPanelTable(2);
        panelTableHeader.setSpacingBefore(10);
        panelTableContent.getDefaultCell().setBackgroundColor(null);
        panelTableContent.setTableEvent(null);

        Entity technologyOperationComponent = calculationOperationComponent
                .getBelongsToField(CalculationOperationComponentFields.TECHNOLOGY_OPERATION_COMPONENT);
        Entity operation = calculationOperationComponent
                .getBelongsToField(CalculationOperationComponentFields.OPERATION);

        panelTableHeader
                .addCell(new Phrase(
                        translationService.translate(
                                L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER, locale)
                                + ": " + operation.getStringField(OperationFields.NUMBER),
                        FontUtils.getDejavuRegular7Dark()));

        panelTableHeader
                .addCell(new Phrase(
                        translationService.translate(
                                L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME, locale)
                                + ": " + operation.getStringField(OperationFields.NAME),
                        FontUtils.getDejavuRegular7Dark()));

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.productionSetUpTime.label",
                        locale) + ":",
                timeConverterService.convertTimeToString(technologyOperationComponent
                        .getIntegerField(TechnologyOperationComponentFieldsTNFO.TPZ)) + " (g:m:s)");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.machineUtilization.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsTNFO.MACHINE_UTILIZATION)));

        addTableCellAsTwoColumnsTable(panelTableContent, translationService.translate(
                "costCalculation.costCalculationDetails.report.columnHeader.productionTimeForOneCycle.label",
                locale) + ":",
                timeConverterService.convertTimeToString(
                        technologyOperationComponent.getIntegerField(TechnologyOperationComponentFieldsTNFO.TJ))
                        + " (g:m:s)");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.laborUtilization.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsTNFO.LABOR_UTILIZATION)));

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.additionalTime.label",
                        locale) + ":",
                timeConverterService
                        .convertTimeToString(technologyOperationComponent
                                .getIntegerField(TechnologyOperationComponentFieldsTNFO.TIME_NEXT_OPERATION))
                        + " (g:m:s)");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.machineHourlyCost.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsCNFO.MACHINE_HOURLY_COST)));

        addTableCellAsTwoColumnsTable(panelTableContent, "", "");

        addTableCellAsTwoColumnsTable(panelTableContent,
                translationService.translate(
                        "costCalculation.costCalculationDetails.report.columnHeader.laborHourlyCost.label",
                        locale) + ":",
                numberService.format(technologyOperationComponent
                        .getDecimalField(TechnologyOperationComponentFieldsCNFO.LABOR_HOURLY_COST)));

        document.add(panelTableHeader);
        document.add(panelTableContent);
    }
}

From source file:com.qcadoo.mes.costCalculation.print.CostCalculationPdfService.java

License:Open Source License

public PdfPTable addOptionTablePrintOperationNormsPiecework(final Entity costCalculation, final Locale locale) {
    List<String> optionTableHeader = Lists.newArrayList();

    for (String translate : Arrays.asList(
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NUMBER,
            L_COST_CALCULATION_COST_CALCULATION_DETAILS_REPORT_COLUMN_HEADER_NAME,
            "costCalculation.costCalculationDetails.report.columnHeader.pieceworkCost",
            "costCalculation.costCalculationDetails.report.columnHeader.forNumberOfOperations")) {
        optionTableHeader.add(translationService.translate(translate, locale));
    }//  ww w.j ava 2  s .c  om

    List<Entity> calculationOperationComponents = entityTreeUtilsService.getSortedEntities(
            costCalculation.getTreeField(CostCalculationFields.CALCULATION_OPERATION_COMPONENTS));

    PdfPTable operationNormsTable = pdfHelper.createTableWithHeader(optionTableHeader.size(), optionTableHeader,
            false);
    operationNormsTable.setSpacingBefore(10);

    for (Entity calculationOperationComponent : calculationOperationComponents) {
        Entity operation = calculationOperationComponent
                .getBelongsToField(CalculationOperationComponentFields.OPERATION);

        operationNormsTable.addCell(new Phrase(operation.getStringField(OperationFields.NUMBER),
                FontUtils.getDejavuRegular7Dark()));

        operationNormsTable.addCell(
                new Phrase(operation.getStringField(OperationFields.NAME), FontUtils.getDejavuRegular7Dark()));

        BigDecimal pieceworkCost = calculationOperationComponent
                .getDecimalField(CalculationOperationComponentFields.PIECEWORK_COST);

        operationNormsTable
                .addCell(new Phrase((pieceworkCost == null) ? "" : numberService.format(pieceworkCost),
                        FontUtils.getDejavuRegular7Dark()));

        Integer numberOfOperations = calculationOperationComponent
                .getIntegerField(CalculationOperationComponentFields.NUMBER_OF_OPERATIONS);

        operationNormsTable
                .addCell(new Phrase((numberOfOperations == null) ? "" : numberOfOperations.toString(),
                        FontUtils.getDejavuRegular7Dark()));
    }

    return operationNormsTable;
}

From source file:com.qcadoo.mes.deliveries.print.DeliveryReportPdf.java

License:Open Source License

private void createProductsTable(final Document document, final Entity delivery, final Locale locale)
        throws DocumentException {
    List<Entity> columnsForDeliveries = deliveriesService.getColumnsForDeliveries();

    if (!columnsForDeliveries.isEmpty()) {
        List<DeliveryProduct> deliveryProducts = deliveryColumnFetcher.getDeliveryProducts(delivery);

        Map<DeliveryProduct, Map<String, String>> deliveryProductsColumnValues = deliveryColumnFetcher
                .getDeliveryProductsColumnValues(deliveryProducts);

        List<Entity> filteredColumnsForDeliveries = getDeliveryReportColumns(columnsForDeliveries,
                deliveryProducts, deliveryProductsColumnValues);

        if (!filteredColumnsForDeliveries.isEmpty()) {
            List<String> columnsName = Lists.newArrayList();

            for (Entity entity : filteredColumnsForDeliveries) {
                columnsName.add(entity.getStringField(ColumnForDeliveriesFields.IDENTIFIER));
            }// w w  w . java 2 s  .c  o  m

            Map<String, HeaderAlignment> alignments = prepareHeaderAlignment(filteredColumnsForDeliveries,
                    locale);
            PdfPTable productsTable = pdfHelper.createTableWithHeader(filteredColumnsForDeliveries.size(),
                    prepareProductsTableHeader(document, filteredColumnsForDeliveries, locale), false,
                    pdfHelper.getReportColumnWidths(REPORT_WIDTH, parameterService.getReportColumnWidths(),
                            columnsName),
                    alignments);

            for (DeliveryProduct deliveryProduct : deliveryProducts) {
                for (Entity columnForDeliveries : filteredColumnsForDeliveries) {
                    String identifier = columnForDeliveries
                            .getStringField(ColumnForDeliveriesFields.IDENTIFIER);
                    String alignment = columnForDeliveries.getStringField(ColumnForDeliveriesFields.ALIGNMENT);

                    String value = deliveryProductsColumnValues.get(deliveryProduct).get(identifier);

                    prepareProductColumnAlignment(productsTable.getDefaultCell(),
                            ColumnAlignment.parseString(alignment));

                    productsTable.addCell(new Phrase(value, FontUtils.getDejavuRegular7Dark()));
                }
            }

            addTotalRow(productsTable, locale, columnsName, delivery);

            document.add(productsTable);
            document.add(Chunk.NEWLINE);
        }
    }
}

From source file:com.qcadoo.mes.deliveries.print.DeliveryReportPdf.java

License:Open Source License

private void addTotalRow(final PdfPTable productsTable, final Locale locale, final List<String> columnsName,
        Entity delivery) {/*from w w w  .  j a  v a2s .c  om*/
    DeliveryPricesAndQuantities deliveryPricesAndQuantities = new DeliveryPricesAndQuantities(delivery,
            numberService);

    PdfPCell total = new PdfPCell(
            new Phrase(translationService.translate("deliveries.delivery.report.totalCost", locale),
                    FontUtils.getDejavuRegular7Dark()));

    total.setColspan(2);
    total.setHorizontalAlignment(Element.ALIGN_LEFT);
    total.setVerticalAlignment(Element.ALIGN_MIDDLE);
    total.setBackgroundColor(null);
    total.disableBorderSide(Rectangle.RIGHT);
    total.disableBorderSide(Rectangle.LEFT);
    total.setBorderColor(ColorUtils.getLineLightColor());

    productsTable.addCell(total);

    for (int i = 2; i < columnsName.size(); i++) {
        if (columnsName.contains(OrderedProductFields.ORDERED_QUANTITY)
                && columnsName.indexOf(OrderedProductFields.ORDERED_QUANTITY) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            productsTable.addCell(
                    new Phrase(numberService.format(deliveryPricesAndQuantities.getOrderedCumulatedQuantity()),
                            FontUtils.getDejavuRegular7Dark()));
        } else if (columnsName.contains(DeliveredProductFields.DELIVERED_QUANTITY)
                && columnsName.indexOf(DeliveredProductFields.DELIVERED_QUANTITY) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            productsTable.addCell(new Phrase(
                    numberService.format(deliveryPricesAndQuantities.getDeliveredCumulatedQuantity()),
                    FontUtils.getDejavuRegular7Dark()));
        } else if (columnsName.contains(DeliveredProductFields.TOTAL_PRICE)
                && columnsName.indexOf(DeliveredProductFields.TOTAL_PRICE) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            productsTable.addCell(
                    new Phrase(numberService.format(deliveryPricesAndQuantities.getDeliveredTotalPrice()),
                            FontUtils.getDejavuRegular7Dark()));
        } else if (columnsName.contains(L_CURRENCY) && columnsName.indexOf(L_CURRENCY) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            productsTable.addCell(
                    new Phrase(deliveriesService.getCurrency(delivery), FontUtils.getDejavuRegular7Dark()));
        } else {
            productsTable.addCell("");
        }
    }
}

From source file:com.qcadoo.mes.deliveries.print.OrderReportPdf.java

License:Open Source License

private void createProductsTable(final Document document, final Entity delivery, final Locale locale)
        throws DocumentException {
    List<Entity> columnsForOrders = deliveriesService.getColumnsForOrders();

    if (!columnsForOrders.isEmpty()) {
        List<Entity> orderedProducts = delivery.getHasManyField(DeliveryFields.ORDERED_PRODUCTS);

        Map<Entity, Map<String, String>> orderedProductsColumnValues = orderColumnFetcher
                .getOrderedProductsColumnValues(orderedProducts);

        List<Entity> filteredColumnsForOrders = getOrderReportColumns(columnsForOrders, orderedProducts,
                orderedProductsColumnValues);

        if (!filteredColumnsForOrders.isEmpty()) {
            List<String> columnsName = Lists.newArrayList();

            for (Entity entity : filteredColumnsForOrders) {
                columnsName.add(entity.getStringField(ColumnForOrdersFields.IDENTIFIER));
            }// w  w  w. j a  va  2s  . c  o  m

            Map<String, HeaderAlignment> alignments = prepareHeaderAlignment(filteredColumnsForOrders, locale);
            PdfPTable productsTable = pdfHelper.createTableWithHeader(filteredColumnsForOrders.size(),
                    prepareProductsTableHeader(document, filteredColumnsForOrders, locale), false,
                    pdfHelper.getReportColumnWidths(REPORT_WIDTH, parameterService.getReportColumnWidths(),
                            columnsName),
                    alignments);

            for (Entity orderedProduct : orderedProducts) {
                for (Entity columnForOrders : filteredColumnsForOrders) {
                    String identifier = columnForOrders.getStringField(ColumnForOrdersFields.IDENTIFIER);
                    String alignment = columnForOrders.getStringField(ColumnForOrdersFields.ALIGNMENT);

                    String value = orderedProductsColumnValues.get(orderedProduct).get(identifier);

                    prepareProductColumnAlignment(productsTable.getDefaultCell(),
                            ColumnAlignment.parseString(alignment));

                    productsTable.addCell(new Phrase(value, FontUtils.getDejavuRegular7Dark()));
                }
            }

            addTotalRow(productsTable, locale, columnsName, delivery);

            document.add(productsTable);
            // document.add(Chunk.NEWLINE);
        }
    }
}

From source file:com.qcadoo.mes.deliveries.print.OrderReportPdf.java

License:Open Source License

private void addTotalRow(final PdfPTable productsTable, final Locale locale, final List<String> columnsName,
        Entity delivery) {//from  w w  w .j  ava2 s. c  o  m
    DeliveryPricesAndQuantities deliveryPricesAndQuantities = new DeliveryPricesAndQuantities(delivery,
            numberService);

    PdfPCell total = new PdfPCell(
            new Phrase(translationService.translate("deliveries.delivery.report.totalCost", locale),
                    FontUtils.getDejavuRegular7Dark()));

    total.setColspan(2);
    total.setHorizontalAlignment(Element.ALIGN_LEFT);
    total.setVerticalAlignment(Element.ALIGN_MIDDLE);
    total.setBackgroundColor(null);
    total.disableBorderSide(Rectangle.RIGHT);
    total.disableBorderSide(Rectangle.LEFT);
    total.setBorderColor(ColorUtils.getLineLightColor());

    productsTable.addCell(total);

    for (int i = 2; i < columnsName.size(); i++) {
        if (columnsName.contains(OrderedProductFields.ORDERED_QUANTITY)
                && columnsName.indexOf(OrderedProductFields.ORDERED_QUANTITY) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            productsTable.addCell(
                    new Phrase(numberService.format(deliveryPricesAndQuantities.getOrderedCumulatedQuantity()),
                            FontUtils.getDejavuRegular7Dark()));
        } else if (columnsName.contains(OrderedProductFields.TOTAL_PRICE)
                && columnsName.indexOf(OrderedProductFields.TOTAL_PRICE) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
            productsTable.addCell(
                    new Phrase(numberService.format(deliveryPricesAndQuantities.getOrderedTotalPrice()),
                            FontUtils.getDejavuRegular7Dark()));
        } else if (columnsName.contains(L_CURRENCY) && columnsName.indexOf(L_CURRENCY) == i) {
            productsTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
            productsTable.addCell(
                    new Phrase(deliveriesService.getCurrency(delivery), FontUtils.getDejavuRegular7Dark()));
        } else {
            productsTable.addCell("");
        }
    }
}

From source file:com.qcadoo.mes.genealogies.print.GenealogyForProductView.java

License:Open Source License

private void addTables(final Document document, final Entity entity, final Locale locale)
        throws DocumentException {
    List<String> orderHeader = new ArrayList<String>();
    orderHeader.add(translationService.translate("orders.order.number.label", locale));
    orderHeader.add(translationService.translate("orders.order.name.label", locale));
    orderHeader.add(translationService.translate("orders.order.dateFrom.label", locale));
    Paragraph productTitle = new Paragraph(new Phrase(
            translationService.translate("genealogies.genealogyForProduct.report.paragrah.product", locale),
            FontUtils.getDejavuBold11Light()));
    productTitle.setSpacingBefore(20);/*from w  w w . ja  va  2 s .  c  o m*/
    document.add(productTitle);
    PdfPTable headerData = pdfHelper.createPanelTable(3);
    headerData.setSpacingBefore(7);
    Entity product = entity.getBelongsToField(ORDER_FIELD).getBelongsToField(PRODUCT_FIELD);
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("basic.product.number.label", locale), product.getField(NUMBER_FIELD));
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("basic.product.name.label", locale), product.getField(NAME_FIELD));
    pdfHelper.addTableCellAsOneColumnTable(headerData,
            translationService.translate("genealogies.genealogy.batch.label", locale),
            entity.getField(BATCH_FIELD));
    document.add(headerData);
    Paragraph orderTitle = new Paragraph(new Phrase(
            translationService.translate("genealogies.genealogyForProduct.report.paragrah.order", locale),
            FontUtils.getDejavuBold11Light()));
    orderTitle.setSpacingBefore(20);
    document.add(orderTitle);
    List<Entity> orders = getOrders(entity);
    Collections.sort(orders, new EntityNumberComparator());
    addOrderSeries(document, orders, orderHeader);
    if (pluginManager.isPluginEnabled(GENEALOGIES_FOR_COMPONENTS_PLUGIN)) {
        addComponentSeries(document, orders, locale);
    }
}

From source file:com.qcadoo.mes.genealogies.print.GenealogyForProductView.java

License:Open Source License

private void addComponentSeries(final Document document, final List<Entity> orders, final Locale locale)
        throws DocumentException {
    for (Entity order : orders) {
        document.add(Chunk.NEWLINE);/*from w w  w .ja va2s. c  o  m*/
        Paragraph title = new Paragraph(new Phrase(
                translationService.translate("genealogies.genealogyForProduct.report.paragrah", locale),
                FontUtils.getDejavuBold11Light()));
        title.add(new Phrase(" " + order.getField(NUMBER_FIELD).toString(), FontUtils.getDejavuBold19Dark()));
        document.add(title);
        List<String> componentHeader = new ArrayList<String>();
        componentHeader.add(translationService.translate("basic.product.number.label", locale));
        componentHeader.add(translationService.translate("basic.product.name.label", locale));
        componentHeader.add(
                translationService.translate("genealogiesForComponents.productInBatch.batch.label", locale));
        PdfPTable table = pdfHelper.createTableWithHeader(3, componentHeader, false);

        List<Pair<String, Entity>> batchList = getBatchList(order);

        Collections.sort(batchList, new BatchOrderNrComparator());

        for (Pair<String, Entity> pair : batchList) {
            String batch = pair.getKey();
            Entity product = pair.getValue();
            table.addCell(
                    new Phrase(product.getField(NUMBER_FIELD).toString(), FontUtils.getDejavuRegular9Dark()));
            table.addCell(
                    new Phrase(product.getField(NAME_FIELD).toString(), FontUtils.getDejavuRegular9Dark()));
            table.addCell(new Phrase(batch, FontUtils.getDejavuRegular9Dark()));
        }
        document.add(table);

    }
}

From source file:com.qcadoo.mes.genealogies.print.GenealogyForProductView.java

License:Open Source License

private void addOrderSeries(final Document document, final List<Entity> orders, final List<String> orderHeader)
        throws DocumentException {
    PdfPTable table = pdfHelper.createTableWithHeader(3, orderHeader, false);
    for (Entity order : orders) {
        table.addCell(new Phrase(order.getField(NUMBER_FIELD).toString(), FontUtils.getDejavuRegular9Dark()));
        table.addCell(new Phrase(order.getField(NAME_FIELD).toString(), FontUtils.getDejavuRegular9Dark()));
        table.addCell(//from ww  w .  j av a 2s  . c om
                new Phrase(order.getField(DATE_FROM_FIELD).toString(), FontUtils.getDejavuRegular9Dark()));
    }
    document.add(table);
}