Example usage for com.lowagie.text Font BOLD

List of usage examples for com.lowagie.text Font BOLD

Introduction

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

Prototype

int BOLD

To view the source code for com.lowagie.text Font BOLD.

Click Source Link

Document

this is a possible style.

Usage

From source file:com.orange.atk.error.ErrorFrame.java

License:Apache License

public ErrorFrame() {
    super();//from  w ww . j a  v a  2 s  . c o  m
    setTitle(defaultTitle);
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());

    addWindowListener(new WindowListener() {
        public void windowActivated(WindowEvent arg0) {
        }

        public void windowClosed(WindowEvent arg0) {
        }

        public void windowClosing(WindowEvent arg0) {
            close();
        }

        public void windowDeactivated(WindowEvent arg0) {
        }

        public void windowDeiconified(WindowEvent arg0) {
        }

        public void windowIconified(WindowEvent arg0) {
        }

        public void windowOpened(WindowEvent arg0) {
        }
    });

    //default constraints
    //top left with no insets or a 0.1 weight (few move on resizing
    GridBagConstraints gbc = new GridBagConstraints(0, 0, //gridx, gridy
            2, 1, //gridwidth, gridheight
            0, 0, //weightx, weighty
            GridBagConstraints.CENTER, // anchor
            GridBagConstraints.NONE, // FILL
            new Insets(10, 10, 5, 10), // padding top, left, bottom, right
            0, 0); //ipadx, ipady

    // Error message
    errorLabel = new MultiLineLabel(UIManager.getIcon("OptionPane.errorIcon"));
    panel.add(errorLabel, gbc);

    // ok Button
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.weightx = 0.5;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(5, 10, 10, 5);
    okButton = new JButton(ResourceManager.getInstance().getString("OK_BUTTON_TITLE"));
    okButton.setFont(okButton.getFont().deriveFont(Font.BOLD, 11));
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            close();
        }
    });

    panel.add(okButton, gbc);

    // Detail Button
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridwidth = 1;
    gbc.weightx = 0.5;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(5, 5, 10, 10);
    detailButton = new JButton(detailArrowsRight);
    detailButton.setFont(okButton.getFont().deriveFont(Font.BOLD, 11));
    detailButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            detailPerformed();
        }
    });
    panel.add(detailButton, gbc);

    // Detail Area
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 2;
    gbc.weightx = 1;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(0, 10, 10, 10);
    detailArea = new JTextArea(8, 40);
    detailScrollPane = new JScrollPane(detailArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    detailArea.setEditable(false);
    detailScrollPane.setVisible(false);
    panel.add(detailScrollPane, gbc);

    this.setContentPane(panel);
    this.setMaximumSize(new Dimension(500, 500));
    setOnMiddleOfTheScreen();
    this.setAlwaysOnTop(true);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}

From source file:com.qcadoo.report.api.FontUtils.java

License:Open Source License

/**
 * Prepare fonts./*from  w ww.j a va2 s  .c o m*/
 * 
 * @throws DocumentException
 * @throws IOException
 */
public static synchronized void prepare() throws DocumentException, IOException {
    if (dejavuBold10Dark == null) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Pdf fonts initialization");
        }
        try {
            FontFactory.register("/fonts/dejaVu/DejaVuSans.ttf");
            dejavu = BaseFont.createFont("/fonts/dejaVu/DejaVuSans.ttf", BaseFont.IDENTITY_H,
                    BaseFont.EMBEDDED);
        } catch (ExceptionConverter e) {
            LOG.warn("Font not found, using embedded font helvetica");
            dejavu = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
        }
        dejavuBold70Light = new Font(dejavu, 70);
        dejavuBold70Light.setStyle(Font.BOLD);
        dejavuBold70Light.setColor(ColorUtils.getLightColor());

        dejavuBold70Dark = new Font(dejavu, 70);
        dejavuBold70Dark.setStyle(Font.BOLD);
        dejavuBold70Dark.setColor(ColorUtils.getDarkColor());

        dejavuBold19Light = new Font(dejavu, 19);
        dejavuBold19Light.setStyle(Font.BOLD);
        dejavuBold19Light.setColor(ColorUtils.getLightColor());

        dejavuBold19Dark = new Font(dejavu, 19);
        dejavuBold19Dark.setStyle(Font.BOLD);
        dejavuBold19Dark.setColor(ColorUtils.getDarkColor());

        dejavuBold14Dark = new Font(dejavu, 14);
        dejavuBold14Dark.setStyle(Font.BOLD);
        dejavuBold14Dark.setColor(ColorUtils.getDarkColor());

        dejavuBold17Light = new Font(dejavu, 17);
        dejavuBold17Light.setStyle(Font.BOLD);
        dejavuBold17Light.setColor(ColorUtils.getLightColor());

        dejavuBold14Light = new Font(dejavu, 17);
        dejavuBold14Light.setStyle(Font.BOLD);
        dejavuBold14Light.setColor(ColorUtils.getLightColor());

        dejavuBold17Dark = new Font(dejavu, 17);
        dejavuBold17Dark.setStyle(Font.BOLD);
        dejavuBold17Dark.setColor(ColorUtils.getDarkColor());

        dejavuRegular9Light = new Font(dejavu, 9);
        dejavuRegular9Light.setColor(ColorUtils.getLightColor());

        dejavuRegular9Dark = new Font(dejavu, 9);
        dejavuRegular9Dark.setColor(ColorUtils.getDarkColor());

        dejavuRegular7Dark = new Font(dejavu, 7);
        dejavuRegular7Dark.setColor(ColorUtils.getDarkColor());

        dejavuBold9Dark = new Font(dejavu, 9);
        dejavuBold9Dark.setColor(ColorUtils.getDarkColor());
        dejavuBold9Dark.setStyle(Font.BOLD);

        dejavuBold11Dark = new Font(dejavu, 11);
        dejavuBold11Dark.setColor(ColorUtils.getDarkColor());
        dejavuBold11Dark.setStyle(Font.BOLD);

        dejavuBold11Light = new Font(dejavu, 11);
        dejavuBold11Light.setColor(ColorUtils.getLightColor());
        dejavuBold11Light.setStyle(Font.BOLD);

        dejavuRegular10Dark = new Font(dejavu, 10);
        dejavuRegular10Dark.setColor(ColorUtils.getDarkColor());

        dejavuBold10Dark = new Font(dejavu, 10);
        dejavuBold10Dark.setColor(ColorUtils.getDarkColor());
        dejavuBold10Dark.setStyle(Font.BOLD);

        dejavuRegular7Light = new Font(dejavu, 7);
        dejavuRegular7Light.setColor(ColorUtils.getLightColor());

        dejavuBold7Dark = new Font(dejavu, 7);
        dejavuBold7Dark.setColor(ColorUtils.getDarkColor());
        dejavuBold7Dark.setStyle(Font.BOLD);

        dejavuBold8Dark = new Font(dejavu, 8);
        dejavuBold8Dark.setColor(ColorUtils.getDarkColor());
        dejavuBold8Dark.setStyle(Font.BOLD);

    }
}

From source file:com.rapidminer.studio.io.data.internal.file.LocalFileLocationChooserView.java

License:Open Source License

private void updateFileTypePanel() {
    SwingTools.invokeLater(() -> {//from   ww  w  .j  a va 2 s . co m
        selectedTypePanel.removeAll();

        GridBagConstraints constraint = new GridBagConstraints();
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.insets = new Insets(SELECTED_TYPE_PANEL_INSETS_TOP, SELECTED_TYPE_PANEL_INSETS_LEFT,
                SELECTED_TYPE_PANEL_INSETS_BOTTOM, SELECTED_TYPE_PANEL_INSETS_RIGHT);

        constraint.fill = GridBagConstraints.BOTH;
        constraint.weightx = 1.0;
        JPanel fillerPanel = new JPanel();
        selectedTypePanel.add(fillerPanel, constraint);

        // set constraints for other component
        constraint.fill = GridBagConstraints.NONE;
        constraint.weightx = 0.0;

        if (getSelectedLocation() != null) {

            boolean showComboBox = showFileDataSourceComboBox;

            // add first label
            if (fileDataSourceFactory != null) {
                if (showComboBox) {
                    JLabel typeLabel = new ResourceLabel("io.dataimport.step.file_selection.select_type");
                    selectedTypePanel.add(typeLabel, constraint);
                } else {
                    JLabel typeLabel = new ResourceLabel("io.dataimport.step.file_selection.type_detected");
                    selectedTypePanel.add(typeLabel, constraint);

                    String selectedTypeName = DataImportWizardUtils.getFactoryLabel(fileDataSourceFactory);
                    JLabel selectedTypeLabel = new JLabel(selectedTypeName);
                    selectedTypeLabel.setFont(selectedTypeLabel.getFont().deriveFont(Font.BOLD));
                    selectedTypePanel.add(selectedTypeLabel, constraint);
                }
            } else {
                JLabel unknownTypeLabel = new ResourceLabel("io.dataimport.step.file_selection.unknown_type");
                selectedTypePanel.add(unknownTypeLabel, constraint);
                showComboBox = true;
            }

            if (showComboBox) {
                selectedTypePanel.add(factoryDropDownComboBox, constraint);

                LinkLocalButton changeTypeButton = new LinkLocalButton(selectTypeAction);
                changeTypeButton.setAlignmentX(SwingConstants.CENTER);
                selectedTypePanel.add(changeTypeButton, constraint);
            } else {
                LinkLocalButton changeTypeButton = new LinkLocalButton(changeTypeAction);
                changeTypeButton.setAlignmentX(SwingConstants.CENTER);
                selectedTypePanel.add(changeTypeButton, constraint);
            }

        } else {
            // add a no file selected label
            selectedTypePanel.add(new ResourceLabel("io.dataimport.step.file_selection.no_file_selected"),
                    constraint);
        }

        // ensure same height for every panel content to avoid flickering
        selectedTypePanel
                .setPreferredSize(new Dimension(SELECTED_TYPE_PANEL_WIDTH, SELECTED_TYPE_PANEL_HEIGHT));
        selectedTypePanel.setMinimumSize(new Dimension(SELECTED_TYPE_PANEL_WIDTH, SELECTED_TYPE_PANEL_HEIGHT));

        selectedTypePanel.revalidate();
        selectedTypePanel.repaint();
    });
}

From source file:com.silverpeas.kmelia.workflowextensions.SendInKmelia.java

License:Open Source License

private void generatePDFStepContent(HistoryStep step, com.lowagie.text.Document document) {
    try {//www.j av  a 2 s .  c o  m
        Form form;
        if ("#question#".equals(step.getAction()) || "#response#".equals(step.getAction())) {
            // TODO
            form = null;
        } else {
            form = getProcessInstance().getProcessModel().getPresentationForm(step.getAction(), getRole(),
                    getLanguage());
        }

        XmlForm xmlForm = (XmlForm) form;
        if (xmlForm != null && step.getActionRecord() != null) {
            DataRecord data = step.getActionRecord();
            VersioningUtil versioningUtil = new VersioningUtil();

            // Force simpletext displayers because itext cannot display HTML Form fields (select,
            // radio...)
            float[] colsWidth = { 25, 75 };
            PdfPTable tableContent = new PdfPTable(colsWidth);
            tableContent.setWidthPercentage(100);

            PdfPCell cell = null;
            Field field;
            String fieldLabel;
            String fieldValue = "";
            Font fontLabel = new Font(Font.HELVETICA, 10, Font.BOLD);
            Font fontValue = new Font(Font.HELVETICA, 10, Font.NORMAL);
            List<FieldTemplate> fieldTemplates = xmlForm.getFieldTemplates();
            for (FieldTemplate fieldTemplate1 : fieldTemplates) {
                GenericFieldTemplate fieldTemplate = (GenericFieldTemplate) fieldTemplate1;

                fieldLabel = fieldTemplate.getLabel("fr");
                field = data.getField(fieldTemplate.getFieldName());
                String componentId = step.getProcessInstance().getProcessModel().getModelId();

                //          fieldValue = data.getField(fieldTemplate.getFieldName()).getValue();
                //wysiwyg field
                if ("wysiwyg".equals(fieldTemplate.getDisplayerName())) {
                    String file = WysiwygFCKFieldDisplayer.getFile(componentId,
                            getProcessInstance().getInstanceId(), fieldTemplate.getFieldName(), getLanguage());

                    //Extract the text content of the html code
                    Source source = new Source(file);
                    if (source != null) {
                        fieldValue = source.getTextExtractor().toString();
                    }
                }
                //Field file type
                else if (FileField.TYPE.equals(fieldTemplate.getDisplayerName())
                        && StringUtil.isDefined(field.getValue())) {
                    boolean fromCompoVersion = "yes".equals(getOrganizationController()
                            .getComponentParameterValue(componentId, "versionControl"));
                    //Versioning Used
                    if (fromCompoVersion) {
                        DocumentVersion documentVersion = versioningUtil
                                .getDocumentVersion(new DocumentVersionPK(Integer.parseInt(field.getValue())));
                        if (documentVersion != null) {
                            fieldValue = documentVersion.getLogicalName();
                        }
                    } else {
                        AttachmentDetail attDetail = AttachmentController
                                .searchAttachmentByPK(new AttachmentPK(field.getValue(), componentId));
                        if (attDetail != null) {
                            fieldValue = attDetail.getLogicalName(getLanguage());
                        }
                    }
                }
                //Field date type
                else if (fieldTemplate.getTypeName().equals("date")) {
                    fieldValue = DateUtil.getOutputDate(fieldValue, "fr");
                }
                //Others fields type
                else {
                    fieldTemplate.setDisplayerName("simpletext");
                    fieldValue = field.getValue(getLanguage());
                }

                cell = new PdfPCell(new Phrase(fieldLabel, fontLabel));
                cell.setBorderWidth(0);
                cell.setPaddingBottom(5);
                tableContent.addCell(cell);

                cell = new PdfPCell(new Phrase(fieldValue, fontValue));
                cell.setBorderWidth(0);
                cell.setPaddingBottom(5);
                tableContent.addCell(cell);
            }

            document.add(tableContent);
        }
    } catch (Exception e) {
        SilverTrace.error("workflowEngine", "SendInKmelia.generatePDFStep()", "root.MSG_GEN_ERROR", e);
    }
}

From source file:com.sinkluge.reports.contracts.GenContractChecklist.java

public void create(Info in, Image toplogo) throws Exception {

    //adds the unchecked box
    Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg");
    Chunk ch2 = new Chunk(checkbox, -10, -10);
    Phrase checkboxPhrase = new Phrase();
    checkboxPhrase.add(ch2);//from w  w  w . j  a v  a 2 s  .  c o m
    int[] two = { 10, 90 };//sets the widths of the columns(2) with checkboxes

    //blank spacer for keeping tables apart
    Table spacer = new Table(1, 1);
    spacer.setBorderWidth(0);
    //spacer.setDefaultCellBorderWidth(0);
    spacer.setWidth(100);
    spacer.setPadding(0);
    spacer.setSpacing(0);
    Cell blank = new Cell();
    blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 1, Font.BOLD, new Color(255, 255, 255))));
    blank.setBorderWidth(0);
    blank.setLeading(0);
    spacer.addCell(blank);

    init();
    //document.setMargins(left, right, top, bottom);
    //add image
    Phrase p1 = new Phrase();
    int[] widths = { 60, 40 };
    Table table1 = new Table(2, 1);
    table1.setWidths(widths);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(2);
    table1.setSpacing(2);
    toplogo.scalePercent(20);
    //Chunk ch1=new Chunk(toplogo, -10, -80);
    Cell cell = new Cell(toplogo);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);
    //just added image

    //add title on right side
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\n" + title + " Checklist", new Font(Font.TIMES_ROMAN, 18, Font.BOLD)));
    cell.add(new Phrase("\n" + currentDate, new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);

    //add "To:" and "Re:"
    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    p1 = new Phrase("To:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD));
    cell.setVerticalAlignment("middle");
    cell.add(p1);
    cell.add(new Phrase("\t\t" + companyName, new Font(Font.TIMES_ROMAN, 14, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Re:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD)));
    cell.add(new Phrase("\t\t" + jobName, new Font(Font.TIMES_ROMAN, 14, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Enclosed:", new Font(Font.TIMES_ROMAN, 14, Font.BOLD)));
    cell.add(new Phrase("\t\t" + title + " Agreement", new Font(Font.TIMES_ROMAN, 14, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(spacer);

    //add Instructions
    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "In order to finalize your agreement with " + shortName
                    + ", please complete all items as outlined below. "
                    + " It is essential to be finalized no later than ",
            new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.add(new Phrase(agreementDate + ".  ", new Font(Font.TIMES_ROMAN, 12, Font.BOLDITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    //p1 = new Phrase("Subcontractor Change Order Overview Report", new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "A subcontract is considered finalized and ready to activate when all of the attached items outlined below "
                    + "are completed, signed, and returned to " + shortName
                    + ". Do not make any changes directly to the contract documents."
                    + " Any alterations or amendments must be negotiated and mutually agreed upon in advance. If necessary, a new, "
                    + "updated contract will be sent. Contract negotiations are best in person and can be accomplished following the pre-"
                    + "construction conference.",
            new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(spacer);

    //add "Checklist:"
    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Checklist: ", new Font(Font.TIMES_ROMAN, 12, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //add "Business Information"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("top");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Business Information", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.add(new Phrase(" (* indicates required information)", new Font(Font.TIMES_ROMAN, 12, Font.ITALIC)));

    cell.add(new Phrase("\n     * Business Telephone Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Primary Contact Name", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Business Fax Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Mobile Telephone Number", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n        Email Address", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("\n     * Federal ID # or Social Security Number",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    if (insure) {
        cell.add(new Phrase("\n     * Contractor's License Number",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\n     * Attach copy of current contractor's license",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    }
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //add "Sign and Date the Agreement"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Sign and date the agreement", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    //add "initial all pages"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Initial front page where indicated", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    //add "provide signatures"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Provide appropriate signatures at Exhibit \"C\", Item #2",
            new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    //add "complete and sign exhibit d"
    if (insure) {
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setWidths(two);

        cell = new Cell(checkboxPhrase);
        cell.setBorderWidth(0);
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setVerticalAlignment("bottom");
        cell.add(new Phrase("Complete and sign Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        document.add(table1);

        //add "Forward"
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setWidths(two);

        cell = new Cell(checkboxPhrase);
        cell.setBorderWidth(0);
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setVerticalAlignment("bottom");
        cell.add(new Phrase(
                "Forward the required insurance certificates (per article 7 and Exhibit \"C\") to " + shortName,
                new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        document.add(table1);
    }

    //add "return all pages"
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidths(two);

    cell = new Cell(checkboxPhrase);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setVerticalAlignment("bottom");
    cell.add(new Phrase("Return all pages of both completed copies of your " + title
            + " agreement.  Do not remove any pages.", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

}

From source file:com.sinkluge.reports.contracts.GenSubcontract.java

public void create(Info in, Image toplogo) throws Exception {

    //for the unchecked box
    Image checkbox = Image.getInstance(in.path + "/WEB-INF/images/unchecked.jpg");
    Chunk ch2 = new Chunk(checkbox, -7, -7);
    Phrase checkboxPhrase = new Phrase();
    checkboxPhrase.add(ch2);//from   ww  w  .j ava  2 s.c o  m

    Font tnr8 = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL);

    Image iBox = Image.getInstance(in.path + "/WEB-INF/images/initialsBox.jpg");//(in.path + "/jsp/dev/images/epcologo3.jpg");
    Chunk ch3 = new Chunk(iBox, -3, -3);
    Phrase initialsBoxPhrase = new Phrase();
    initialsBoxPhrase.add(ch3);

    Phrase footerPhrase = new Phrase(
            attr.get("full_name") + ", " + attr.get("address") + ", " + attr.get("city") + ", "
                    + attr.get("state") + " " + attr.get("zip") + "\nPhone: " + attr.get("phone") + "   Fax: "
                    + attr.get("fax") + "   " + attr.get("url") + "   Page: ",
            new Font(Font.TIMES_ROMAN, 7, Font.BOLD | Font.ITALIC));

    HeaderFooter footer = new HeaderFooter(footerPhrase, true);
    footer.setBorder(0);
    footer.setAlignment(Element.ALIGN_CENTER);
    init(40, 40, 40, 40, footer);

    Phrase underLinePhrase = new Phrase(
            "  ___________________________________________________________________________________________  ",
            new Font(Font.TIMES_ROMAN, 10, Font.BOLD));
    int[] twoC = { 30, 70 };
    int[] twoD = { 5, 95 };
    int[] twoF = { 10, 90 };
    int[] twoE = { 25, 75 };
    int[] twoG = { 40, 60 };
    int[] threeD = { 4, 11, 85 };
    int[] threeB = { 70, 15, 15 };
    //int[] threeC = { 47, 5, 48 };
    int[] five = { 18, 25, 14, 18, 25 };

    //blank spacer for keeping tables apart
    Table spacer = new Table(1, 1);
    spacer.setBorderWidth(0);
    //spacer.setDefaultCellBorderWidth(0);
    spacer.setWidth(100);
    spacer.setPadding(0);
    spacer.setSpacing(0);
    Cell blank = new Cell();
    blank.add(new Chunk("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD, new Color(255, 255, 255))));
    blank.setBorderWidth(0);
    //blank.setLeading(0);
    spacer.addCell(blank);

    //start of document
    //document.setFooter(footer);

    //document.setFooter(footer);

    //add image
    Phrase p1 = new Phrase();
    Table table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(2);
    table1.setSpacing(2);
    toplogo.scalePercent(20);
    //Chunk ch1=new Chunk(toplogo, -36, -55);
    //p1.add(ch1);
    Cell cell = new Cell(toplogo);
    cell.setBorderWidth(0);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(cell);

    document.add(table1);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);
    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setLeading(19);
    cell.add(
            new Phrase(title.toUpperCase() + " AGREEMENT BETWEEN CONTRACTOR AND " + cTitle.toUpperCase() + "\n",
                    new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setUseDescender(true);
    cell.setBackgroundColor(Color.lightGray);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setSpacing(0);
    cell = new Cell();
    cell.add(underLinePhrase);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\nDOCUMENTS CONTAINED HEREIN:\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(3, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setWidths(threeD);
    table1.setPadding(0);
    table1.setSpacing(0);
    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Page 1", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Agreement Declaration", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.add(new Phrase("    Initial boxes below to indicate complete review of this agreement.",
            new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Page 2", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Articles of " + title + " Agreement and Standard Provisions", tnr8));
    cell.add(new Phrase("    Sign the concluding page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Exhibit \"A\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("List of Contract Documents, Plans, Specifications, Etc.", tnr8));
    cell.setBorder(0);
    //cell.add(new Phrase("    Read and initial each page.", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Exhibit \"B\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle + "'s Scope of Work", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Exhibit \"C\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase(cTitle + "'s Special Provisions and Procedure Requirements", tnr8));
    cell.add(new Phrase("    Read and complete \"Release Authorization\" information.",
            new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    table1.addCell(blank);
    if (insure) {
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Exhibit \"D\"", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);

        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(cTitle + " Cost Breakdown", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.add(new Phrase("    Complete and return with signed contract",
                new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);

        table1.addCell(blank);
    }
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.setColspan(2);
    cell.add(new Phrase("NOTE OTHERS HERE:", new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    table1 = new Table(3);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(threeB);
    table1.addCell(blank);
    cell = new Cell();
    cell.setColspan(2);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("(Initial) Entire agreement thoroughly reviewed:\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);

    cell = new Cell();

    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Contractor: ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle + ": ________", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setColspan(3);
    cell.add(underLinePhrase);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("AGREEMENT", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" made as of " + agreementDate, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("BETWEEN", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Contractor: \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("full_name") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("address") + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + attr.get("city") + ", " + attr.get("state") + " " + attr.get("zip"),
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Contractor\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("AND", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the " + cTitle + ": \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + subCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"" + cTitle + "\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the the fixed sum of  " + DocHelper.numberAndText(amount) + " \n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    //cell.add(new Phrase("     " + amountString + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Project known as:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + projectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Project\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("BY", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Architect:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + architectCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Architect\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    cell.add(new Phrase("FOR", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Project owner:\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerName + " \n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerAddress + "\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("     " + ownerCityStateZip, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.add(new Phrase("                (hereinafter known as \"Owner\")\n",
            new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("WHEREFORE", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.add(new Phrase(" the Contractor and " + cTitle + " agree as follows:\n\n\n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);
    /*
          table1 = new Table(1);
          table1.setBorderWidth(0); table1.setWidth(100);
          //table1.setDefaultCellBorder(0);
          table1.setPadding(0);
               
          cell = new Cell();
          cell.setHorizontalAlignment("center");
          cell.setVerticalAlignment("middle");
          //cell.add(new Phrase("\n", new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
          cell.setBorder(Rectangle.BOTTOM | Rectangle.TOP);
          cell.setBorderWidth(1.1f);
          cell.add(footerPhrase);
          cell.add(new Phrase(" 1\n ",
    new Font(Font.TIMES_ROMAN, 6, Font.NORMAL)));
          //cell.add(footerPhrase2);
                  
          cell.setBorder(0); table1.addCell(cell);
            
          document.add(table1);
    */
    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " AGREEMENT\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setLeading(19);
    cell.setUseDescender(true);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    Paragraph para = new Paragraph(8, "\n\n" + text.toString(), tnr8);

    document.add(para);

    Phrase p;

    document.add(spacer);
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setWidths(twoC);
    table1.setPadding(0);
    p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("_________________________________________________________________",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("            General Contractor                                               Title\n",
            tnr8));
    cell.setBorder(0);
    table1.addCell(cell);

    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setColspan(2);
    cell.add(new Phrase("\nThis " + title
            + " Agreement supercedes all other proposals, documents, and negotiations whether written or verbal\n\n",
            new Font(Font.TIMES_ROMAN, 8, Font.BOLDITALIC)));
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("Date:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("Signed:\n\n", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    p = new Phrase("_______________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);
    p = new Phrase("_________________________________________________________________",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(p);
    cell.setBorder(0);
    table1.addCell(cell);

    table1.addCell(blank);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "            " + cTitle + "                                                       Title\n", tnr8));
    cell.setBorder(0);
    table1.addCell(cell);
    table1.setCellsFitPage(true);
    table1.setTableFitsPage(true);
    document.add(table1);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle.toUpperCase() + " INFORMATION\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setLeading(19);
    cell.setUseDescender(true);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    document.add(new Phrase("\n"));

    table1 = new Table(5, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(1);
    table1.setWidths(five);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Federal I.D. : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(federal_id, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("(Both Required)", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));

    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("License Number : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(license_number, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Contact : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.setUseDescender(true);
    cell.add(new Phrase(contactName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Company : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Telephone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.setUseDescender(true);
    cell.add(new Phrase(telephone, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("Fax : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(fax, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");

    cell.add(new Phrase("Mobile phone : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(mobile, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 8, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("E-mail : ", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.setBorder(15);
    cell.add(new Phrase(email, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    table1.addCell(cell);
    document.add(table1);

    //document.add(spacer);

    table1 = new Table(1, 1);
    //table1.setBorderWidth(4);
    //table1.setBorderColor(Color.lightGray);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setBorder(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    if (insure)
        cell.add(new Phrase("Please attach a COPY of your current state license to this page:",
                new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    else
        cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 12, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    if (insure)
        cell.add(new Phrase("\n\nAttach\nCopy of\nContractor's\nLicense\nHere\n(If Applicable)",
                new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray)));
    else
        cell.add(new Phrase("", new Font(Font.TIMES_ROMAN, 24, Font.NORMAL, Color.lightGray)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    //document.setMargins(72, 72, 36, 36);
    document.newPage();

    table1 = new Table(1, 1);
    table1.setOffset(0);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidth(100);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"A\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("CONTRACT DOCUMENTS, PLANS,\nSPECIFICATIONS, ADDENDUMS, ETC.\n",
            new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBackgroundColor(Color.lightGray);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("\n" + subName
            + " is responsible to verify versions, dates, and completeness of documents that were used in the preparation of the "
            + cTitle + "'s bid proposal before signing this " + title + " Agreement\n", tnr8));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("This " + title + " Agreement includes, but is not limited to the following items:",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setUseDescender(true);
    cell.setBorder(Rectangle.BOTTOM);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);
    document.add(table1);

    Paragraph prgh = new Paragraph("\n" + bidDocuments + "\n", tnr8);
    prgh.setLeading(10);
    document.add(prgh);

    document.add(spacer);
    /*
     p = new Phrase("\n"+bidDocuments, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
     p.setLeading(10);
     cell= new Cell(p);
     cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
     cell.setBorderWidth(0.5f);
     //cell.setBorderColor(Color.lightGray);
     cell.setHorizontalAlignment("left");
     cell.setVerticalAlignment("middle");
     //cell.setLeading(10);
     cell.setUseDescender(true);
     table1.addCell(cell);
     */

    table1 = new Table(1, 1);
    table1.setOffset(0);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setWidth(100);
    table1.setTableFitsPage(true);
    p = new Phrase("\nPlease note below all verbal conditions or instructions, if any, that the " + cTitle
            + " has received during the bid process which might affect the scope of work as required by the contract documents",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
    p.setLeading(10);
    cell = new Cell(p);
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(0.5f);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(cell);

    document.add(table1);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    table1.setWidth(100);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"B\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase("SCOPE OF WORK\n", new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(
            "\nThis " + title + " Agreement includes, but is not limited to the following items:\n\n",
            new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
    cell.setBorder(Rectangle.BOTTOM);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);

    document.add(table1);

    prgh = new Paragraph("\n" + contractDescription + "\n", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
    prgh.setLeading(10);
    document.add(prgh);
    //cell= new Cell(prgh);
    //cell.setBorder(Rectangle.TOP | Rectangle.BOTTOM);
    //cell.setBorderWidth(0.5f);
    //cell.setBorderColor(Color.lightGray);
    //cell.setHorizontalAlignment("left");
    //cell.setVerticalAlignment("middle");
    //cell.setLeading(10);
    //cell.setUseDescender(true);
    //table1.addCell(cell);

    document.add(spacer);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    table1.setWidth(100);
    table1.setTableFitsPage(true);

    p = new Phrase("\nAll " + cTitle
            + " bid proposal conditions that are outside of, in addition to or are limiting of conditions contained in the Contract Documents are of no effect and are invalid to the "
            + title + " Agreement unless expressly included in the description above.", tnr8);
    p.setLeading(10);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.setBorder(Rectangle.TOP);
    cell.setBorderWidth(0.5f);
    table1.addCell(cell);

    document.add(table1);

    //document.setMargins(10, 10, 30, 30);

    document.newPage();

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"C\"\n", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
    cell.setLeading(6);
    cell.setBorder(0);
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("center");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(cTitle.toUpperCase() + " SPECIAL PROVISIONS AND REQUIREMENTS\n",
            new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
    cell.setBackgroundColor(Color.lightGray);
    cell.setUseDescender(true);
    cell.setLeading(17);
    cell.setBorder(0);
    table1.addCell(cell);

    document.add(table1);

    int count = 1;

    if (insure) {

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(4);
        cell = new Cell();
        cell.add(new Phrase("1.     Insurance Provisions (If Applicable)",
                new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
        //cell.setLeading(6);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        count++;
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoD);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(6);
        cell.add(new Phrase(
                "a.  The " + cTitle + " is required to name the following as additional Primary-Insured:",
                tnr8));
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoE);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Contractor:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(attr.get("full_name"), new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Owner:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(ownerName, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("right");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("Other:  ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase("_______________________________________", tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setWidths(twoD);
        table1.setOffset(4);
        p = new Phrase("b.  The " + cTitle
                + " must provide verification of current Worker's Compensation coverage with reference to "
                + jobName + " on the policy.", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
        p.setLeading(8);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(8);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
    }

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(4);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Release Authorizations", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    count++;
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    table1 = new Table(2, 1);
    table1.setOffset(4);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoD);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    p = new Phrase(
            "List any Owners, Partners, and/or Corporate Officers who are legally authorized to sign for "
                    + subName
                    + " and who will be signing the MONTHLY REQUEST FOR PAYMENT, FINAL REQUEST FOR PAYMENT, and LIEN WAIVER documents:\n\n",
            tnr8);
    p.setLeading(8);
    p1 = new Phrase(
            "       ______________________________________________________________________          ______________________________________________________________________\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    //p1.setLeading(0);
    Phrase p2 = new Phrase(
            "       Printed name and title                                                                                                                   Signature\n\n",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    //cell.setLeading(8);
    cell.add(p);
    cell.add(p1);
    cell.add(p2);
    cell.add(p1);
    cell.add(p2);
    cell.add(p1);
    cell.add(p2);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(3);
    table1.setOffset(0);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Shop Drawings - Samples - Submittals",
            new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    count++;

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoD);
    table1.setOffset(2);
    p = new Phrase(
            "All shop drawings, materials samples, and submittals shall be submitted to the Contractor within 30 days of the issuance of this "
                    + title
                    + " Agreement unless specifically noted below.  All submitted items shall be in number and type as per the contract documents including, but not limited to, the following:",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setWidths(twoF);
    table1.setOffset(4);

    p = new Phrase("--The number of copies of each submittal for " + jobName + " is " + submittal_copies
            + ".\n--All submittals, of any type, are due on or before " + dueDate
            + " unless specifically noted otherwise.\n", tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    String submittals = "";
    if (!submittalVector.isEmpty()) {
        p = new Phrase("            Due Date:\n", new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
        p.setLeading(8);
        cell = new Cell(p);
        cell.setColspan(2);
        cell.setBorder(0);
        table1.addCell(cell);
        for (int i = 0; i < submittalVector.size(); i++) {
            submittals += (String) submittalVector.elementAt(i) + "\n";
        }
        p = new Phrase(submittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL));
        p.setLeading(8);
        cell = new Cell(p);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
    } else {
        p = new Phrase("\nSubmittals required per contract documents and specifications.\n",
                new Font(Font.TIMES_ROMAN, 8, Font.BOLD));
        p.setLeading(8);
        cell = new Cell(p);
        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
    }
    p = new Phrase("\n(" + subName
            + " is responsible for all submittals required in the Contract Documents as pertaining to labor and materials included in the scope of this "
            + title + " Agreement regardless of items listed, not listed, or incorrectly listed above.)",
            new Font(Font.TIMES_ROMAN, 6, Font.ITALIC));
    p.setLeading(8);
    cell = new Cell(p);

    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(1);
    table1.setWidths(twoD);
    table1.setOffset(2);
    p = new Phrase(cTitle.toUpperCase()
            + " acknowledges that review and approval of any type of submittal which deviates from the Project Plans and Specifications does NOT relieve the "
            + cTitle
            + " from costs, penalties and all other remedies required to meet the published specifications where the "
            + cTitle
            + " failed to notify the Owner/Architect/Contractor in writing of the variations from the specifications and failed to obtain written approval for EACH variation from the published specifications.",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(8);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(1, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(2);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    cell.add(new Phrase(count + ".     Project Close-out", new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);
    count++;
    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(4);
    table1.setWidths(twoD);
    p = new Phrase(
            "All project close-out documents, materials, and Owner-training required by the Contract Documents shall be submitted to the Contractor PRIOR to payment of the "
                    + cTitle
                    + "'s 90% completion payment request.  The requirements shall include, but not be limited to, the following:",
            tnr8);
    p.setLeading(8);
    cell = new Cell(p);
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("middle");
    //cell.setLeading(8);
    table1.addCell(blank);
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    table1 = new Table(2, 1);
    table1.setBorderWidth(0);
    table1.setWidth(100);
    //table1.setDefaultCellBorder(0);
    table1.setPadding(0);
    table1.setOffset(0);
    table1.setWidths(twoG);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("\"O & M\" Submittals: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(omSubmittals, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Full Warranty: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(fullWarranty, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Up-to-date Lien Release(s): ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(lienReleases, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Signed Training Form: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(signedTraining, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Materials-Equip-Specialty Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(specialtyItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("right");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase("Other Items: ", new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    cell = new Cell();
    cell.setHorizontalAlignment("left");
    cell.setVerticalAlignment("top");
    cell.add(new Phrase(otherItems, new Font(Font.TIMES_ROMAN, 8, Font.NORMAL)));
    cell.setBorder(0);
    table1.addCell(cell);
    document.add(table1);

    if (insure) {
        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setOffset(2);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(count + ".     " + cTitle + " Safety Program (If Applicable)",
                new Font(Font.TIMES_ROMAN, 10, Font.BOLD)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        table1 = new Table(2, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(2);
        table1.setWidths(twoD);
        p = new Phrase(
                cTitle + " will submit one copy of the " + cTitle + "'s job-specific safety program to "
                        + attr.get("full_name")
                        + " before any equipment, manpower, or materials are brought onto the Project site.  ",
                tnr8);
        p.setLeading(8);
        cell = new Cell(p);
        p = new Phrase(cTitle + " will require it's " + cTitle.toLowerCase()
                + "s to have in place a job-specific safety program before they enter the Project site.", tnr8);
        p.setLeading(8);
        cell.add(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(8);

        table1.addCell(blank);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
    }

    if (insure) {
        document.newPage();

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(3);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(title.toUpperCase() + " EXHIBIT \"D\"", new Font(Font.TIMES_ROMAN, 20, Font.BOLD)));
        cell.setLeading(6);
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell(new Phrase("\n", new Font(Font.TIMES_ROMAN, 8)));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(cTitle.toUpperCase() + "'S COST BREAKDOWN\n",
                new Font(Font.TIMES_ROMAN, 16, Font.BOLD)));
        cell.setBackgroundColor(Color.lightGray);
        cell.setUseDescender(true);
        cell.setLeading(17);
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setPadding(0);
        table1.setOffset(2);
        p = new Phrase("The following information is to be supplied by " + subName + " for " + jobName
                + ". List all SUPPLIERS and SUBCONTRACTORS for approval and payment confirmation (attach additional pages if needed):",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        p.setLeading(12);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(
                "     Name                                        City                                  Phone                                                                            Estimated Dollar Amount",
                tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        p = new Phrase(
                "________________________________________________________________________  $___________________\n",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        for (int i = 0; i < 10; i++) {
            cell.add(p);
        }
        cell.setBorder(0);
        table1.addCell(cell);

        p = new Phrase(
                "Supplier accepts full responsibility for acts and omissions of his subcontractors and suppliers.  No suppliers or subcontractors are to be added or deleted without prior notification to "
                        + attr.get("full_name") + ".",
                new Font(Font.TIMES_ROMAN, 8, Font.ITALIC));
        p.setLeading(10);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(15);
        cell.setBorder(0);
        table1.addCell(cell);
        p = new Phrase(
                "List the primary phases of your contracted scope of work and the associated costs.  This information may be released to the Owner if disputes arise over future billings and progress payments.",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        p.setLeading(12);
        cell = new Cell(p);
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.setLeading(15);
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        cell.add(new Phrase(
                "Description/Phase of Work                     Labor                      Material                    Equipment/Tools       Sub-subcontractor     Total",
                tnr8));
        cell.setBorder(0);
        table1.addCell(cell);
        cell = new Cell();
        p = new Phrase(
                "________________________  $____________ $____________ $____________ $____________ $____________ \n",
                new Font(Font.TIMES_ROMAN, 10, Font.NORMAL));
        cell.setHorizontalAlignment("left");
        cell.setVerticalAlignment("middle");
        for (int i = 0; i < 13; i++) {
            cell.add(p);
        }
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

        document.add(spacer);

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setOffset(2);
        table1.setPadding(1);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase(subName, new Font(Font.TIMES_ROMAN, 10, Font.UNDERLINE)));
        cell.add(new Phrase("\n" + cTitle, new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        document.add(spacer);
        document.add(spacer);

        table1 = new Table(1, 1);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        table1.setOffset(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\nPrint Name of Authorized Company Officer",
                new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);
        document.add(spacer);
        document.add(spacer);
        table1 = new Table(1, 1);
        table1.setOffset(0);
        table1.setBorderWidth(0);
        table1.setWidth(100);
        //table1.setDefaultCellBorder(0);
        cell = new Cell();
        cell.setHorizontalAlignment("center");
        cell.setVerticalAlignment("middle");
        //cell.setLeading(10);
        cell.add(new Phrase("By:____________________________", new Font(Font.TIMES_ROMAN, 10, Font.NORMAL)));
        cell.add(new Phrase("\nAuthorized Signature", new Font(Font.TIMES_ROMAN, 6, Font.ITALIC)));
        cell.setBorder(0);
        table1.addCell(cell);
        document.add(table1);

    }

}

From source file:com.slamd.report.PDFReportGenerator.java

License:Open Source License

/**
 * Writes the table of contents to the document.
 *
 * @param  document  The document to which the contents are to be written.
 *
 * @return  {@code true} if the contents information was written to the
 *          PDF document, or {@code false} if not.
 *
 * @throws  DocumentException  If a problem occurs while writing the contents.
 *//*w w w  .java  2  s  .  c  o  m*/
private boolean writeContents(Document document) throws DocumentException {
    // First, make sure that there is actually something to write.  If we're
    // only going to write information for a single job or optimizing job, then
    // there is no reason to have a contents section.
    if (((reportJobs.length == 1) && (reportOptimizingJobs.length == 0))
            || ((reportJobs.length == 0) && (reportOptimizingJobs.length == 1))) {
        return false;
    }

    if (reportJobs.length > 0) {
        // Write the job data header.
        Paragraph p = new Paragraph("Job Data",
                FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD, Color.BLACK));
        document.add(p);

        // Create a table with the list of jobs.
        PdfPTable table = new PdfPTable(3);
        table.setWidthPercentage(100);
        writeTableHeaderCell(table, "Job ID");
        writeTableHeaderCell(table, "Description");
        writeTableHeaderCell(table, "Job Type");

        for (int i = 0; i < reportJobs.length; i++) {
            Job job = reportJobs[i];
            Anchor anchor = new Anchor(job.getJobID(),
                    FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, Color.BLUE));
            anchor.setReference('#' + job.getJobID());
            table.addCell(new PdfPCell(anchor));

            String descriptionStr = job.getJobDescription();
            if ((descriptionStr == null) || (descriptionStr.length() == 0)) {
                descriptionStr = "(Not Specified)";
            }
            writeTableCell(table, descriptionStr);

            writeTableCell(table, job.getJobClass().getJobName());
        }
        document.add(table);

        // Write a blank line between the job data and optimizing job data.
        document.add(new Paragraph(" "));
    }

    if (reportOptimizingJobs.length > 0) {
        // Write the optimizing job data header.
        Paragraph p = new Paragraph("Optimizing Job Data",
                FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD, Color.BLACK));
        document.add(p);

        // Create a table with the list of jobs.
        PdfPTable table = new PdfPTable(3);
        table.setWidthPercentage(100);
        writeTableHeaderCell(table, "Optimizing Job ID");
        writeTableHeaderCell(table, "Description");
        writeTableHeaderCell(table, "Job Type");

        for (int i = 0; i < reportOptimizingJobs.length; i++) {
            OptimizingJob optimizingJob = reportOptimizingJobs[i];
            Anchor anchor = new Anchor(optimizingJob.getOptimizingJobID(),
                    FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, Color.BLUE));
            anchor.setReference('#' + optimizingJob.getOptimizingJobID());
            table.addCell(new PdfPCell(anchor));

            String descriptionStr = optimizingJob.getDescription();
            if ((descriptionStr == null) || (descriptionStr.length() == 0)) {
                descriptionStr = "(Not Specified)";
            }
            writeTableCell(table, descriptionStr);

            writeTableCell(table, optimizingJob.getJobClass().getJobName());
        }
        document.add(table);
    }

    return true;
}

From source file:com.slamd.report.PDFReportGenerator.java

License:Open Source License

/**
 * Writes information about the provided job to the document.
 *
 * @param  document  The document to which the job information should be
 *                   written.//from   w ww. j  a  v a  2 s  . co  m
 * @param  job       The job to include in the document.
 *
 * @throws  DocumentException  If a problem occurs while writing the contents.
 */
private void writeJob(Document document, Job job) throws DocumentException {
    Anchor anchor = new Anchor("Job " + job.getJobID(),
            FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD, Color.BLACK));
    anchor.setName(job.getJobID());
    Paragraph p = new Paragraph(anchor);
    document.add(p);

    // Write the general information to the document.
    p = new Paragraph("General Information",
            FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
    document.add(p);

    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100);
    table.setWidths(new int[] { 30, 70 });
    writeTableCell(table, "Job ID");
    writeTableCell(table, job.getJobID());

    String optimizingJobID = job.getOptimizingJobID();
    if ((optimizingJobID != null) && (optimizingJobID.length() > 0)) {
        writeTableCell(table, "Optimizing Job ID");
        writeTableCell(table, optimizingJobID);
    }

    String descriptionStr = job.getJobDescription();
    if ((descriptionStr == null) || (descriptionStr.length() == 0)) {
        descriptionStr = "(Not Specified)";
    }
    writeTableCell(table, "Job Description");
    writeTableCell(table, descriptionStr);

    writeTableCell(table, "Job Type");
    writeTableCell(table, job.getJobClassName());

    writeTableCell(table, "Job Class");
    writeTableCell(table, job.getJobClass().getClass().getName());

    writeTableCell(table, "Job State");
    writeTableCell(table, job.getJobStateString());
    document.add(table);

    // Write the schedule config if appropriate.
    if (includeScheduleConfig) {
        document.add(new Paragraph(" "));
        p = new Paragraph("Schedule Information",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        Date startTime = job.getStartTime();
        String startStr;
        if (startTime == null) {
            startStr = "(Not Available)";
        } else {
            startStr = dateFormat.format(startTime);
        }
        writeTableCell(table, "Scheduled Start Time");
        writeTableCell(table, startStr);

        Date stopTime = job.getStopTime();
        String stopStr;
        if (stopTime == null) {
            stopStr = "(Not Specified)";
        } else {
            stopStr = dateFormat.format(stopTime);
        }
        writeTableCell(table, "Scheduled Stop Time");
        writeTableCell(table, stopStr);

        int duration = job.getDuration();
        String durationStr;
        if (duration > 0) {
            durationStr = duration + " seconds";
        } else {
            durationStr = "(Not Specified)";
        }
        writeTableCell(table, "Scheduled Duration");
        writeTableCell(table, durationStr);

        writeTableCell(table, "Number of Clients");
        writeTableCell(table, String.valueOf(job.getNumberOfClients()));

        String[] requestedClients = job.getRequestedClients();
        if ((requestedClients != null) && (requestedClients.length > 0)) {
            PdfPTable clientTable = new PdfPTable(1);
            for (int i = 0; i < requestedClients.length; i++) {
                PdfPCell clientCell = new PdfPCell(new Phrase(requestedClients[i]));
                clientCell.setBorder(0);
                clientTable.addCell(clientCell);
            }

            writeTableCell(table, "Requested Clients");
            table.addCell(clientTable);
        }

        String[] monitorClients = job.getResourceMonitorClients();
        if ((monitorClients != null) && (monitorClients.length > 0)) {
            PdfPTable clientTable = new PdfPTable(1);
            for (int i = 0; i < monitorClients.length; i++) {
                PdfPCell clientCell = new PdfPCell(new Phrase(monitorClients[i]));
                clientCell.setBorder(0);
                clientTable.addCell(clientCell);
            }

            writeTableCell(table, "Resource Monitor Clients");
            table.addCell(clientTable);
        }

        writeTableCell(table, "Threads per Client");
        writeTableCell(table, String.valueOf(job.getThreadsPerClient()));

        writeTableCell(table, "Thread Startup Delay");
        writeTableCell(table, job.getThreadStartupDelay() + " milliseconds");

        writeTableCell(table, "Statistics Collection Interval");
        writeTableCell(table, job.getCollectionInterval() + " seconds");

        document.add(table);
    }

    // Write the job-specific parameter information if appropriate.
    if (includeJobConfig) {
        document.add(new Paragraph(" "));
        p = new Paragraph("Parameter Information",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        Parameter[] params = job.getParameterList().getParameters();
        for (int i = 0; i < params.length; i++) {
            writeTableCell(table, params[i].getDisplayName());
            writeTableCell(table, params[i].getDisplayValue());
        }

        document.add(table);
    }

    // Write the statistical data if appropriate.
    if (includeStats && job.hasStats()) {
        document.add(new Paragraph(" "));
        p = new Paragraph("General Execution Data",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        Date actualStartTime = job.getActualStartTime();
        String startStr;
        if (actualStartTime == null) {
            startStr = "(Not Available)";
        } else {
            startStr = dateFormat.format(actualStartTime);
        }
        writeTableCell(table, "Actual Start Time");
        writeTableCell(table, startStr);

        Date actualStopTime = job.getActualStopTime();
        String stopStr;
        if (actualStopTime == null) {
            stopStr = "(Not Available)";
        } else {
            stopStr = dateFormat.format(actualStopTime);
        }
        writeTableCell(table, "Actual Stop Time");
        writeTableCell(table, stopStr);

        int actualDuration = job.getActualDuration();
        String durationStr;
        if (actualDuration > 0) {
            durationStr = actualDuration + " seconds";
        } else {
            durationStr = "(Not Available)";
        }
        writeTableCell(table, "Actual Duration");
        writeTableCell(table, durationStr);

        String[] clients = job.getStatTrackerClientIDs();
        if ((clients != null) && (clients.length > 0)) {
            PdfPTable clientTable = new PdfPTable(1);
            for (int i = 0; i < clients.length; i++) {
                PdfPCell clientCell = new PdfPCell(new Phrase(clients[i]));
                clientCell.setBorder(0);
                clientTable.addCell(clientCell);
            }

            writeTableCell(table, "Clients Used");
            table.addCell(clientTable);
        }

        document.add(table);

        String[] trackerNames = job.getStatTrackerNames();
        for (int i = 0; i < trackerNames.length; i++) {
            StatTracker[] trackers = job.getStatTrackers(trackerNames[i]);
            if ((trackers != null) && (trackers.length > 0)) {
                document.newPage();
                StatTracker tracker = trackers[0].newInstance();
                tracker.aggregate(trackers);

                document.add(new Paragraph(" "));
                document.add(new Paragraph(trackerNames[i],
                        FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK)));

                String[] summaryNames = tracker.getSummaryLabels();
                String[] summaryValues = tracker.getSummaryData();
                table = new PdfPTable(2);
                table.setWidthPercentage(100);
                table.setWidths(new int[] { 50, 50 });
                for (int j = 0; j < summaryNames.length; j++) {
                    writeTableCell(table, summaryNames[j]);
                    writeTableCell(table, summaryValues[j]);
                }
                document.add(table);

                if (includeGraphs) {
                    try {
                        ParameterList params = tracker.getGraphParameterStubs(job);
                        BufferedImage graphImage = tracker.createGraph(job, Constants.DEFAULT_GRAPH_WIDTH,
                                Constants.DEFAULT_GRAPH_HEIGHT, params);
                        Image image = Image.getInstance(imageToByteArray(graphImage));
                        image.scaleToFit(inchesToPoints(5.5), inchesToPoints(4.5));
                        document.add(image);
                    } catch (Exception e) {
                    }
                }
            }
        }
    }

    // Write the resource monitor data if appropriate.
    if (includeMonitorStats && job.hasResourceStats()) {
        String[] trackerNames = job.getResourceStatTrackerNames();
        for (int i = 0; i < trackerNames.length; i++) {
            StatTracker[] trackers = job.getResourceStatTrackers(trackerNames[i]);
            if ((trackers != null) && (trackers.length > 0)) {
                document.newPage();
                StatTracker tracker = trackers[0].newInstance();
                tracker.aggregate(trackers);

                document.add(new Paragraph(" "));
                document.add(new Paragraph(trackerNames[i],
                        FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK)));

                String[] summaryNames = tracker.getSummaryLabels();
                String[] summaryValues = tracker.getSummaryData();
                table = new PdfPTable(2);
                table.setWidthPercentage(100);
                table.setWidths(new int[] { 50, 50 });
                for (int j = 0; j < summaryNames.length; j++) {
                    writeTableCell(table, summaryNames[j]);
                    writeTableCell(table, summaryValues[j]);
                }
                document.add(table);

                if (includeGraphs) {
                    try {
                        ParameterList params = tracker.getGraphParameterStubs(job);
                        BufferedImage graphImage = tracker.createMonitorGraph(job,
                                Constants.DEFAULT_GRAPH_WIDTH, Constants.DEFAULT_MONITOR_GRAPH_HEIGHT, params);
                        Image image = Image.getInstance(imageToByteArray(graphImage));
                        image.scaleToFit(inchesToPoints(5.5), inchesToPoints(4.5));
                        document.add(image);
                    } catch (Exception e) {
                    }
                }
            }
        }
    }
}

From source file:com.slamd.report.PDFReportGenerator.java

License:Open Source License

/**
 * Writes information about the provided optimizing job to the document.
 *
 * @param  document       The document to which the job information should be
 *                        written./*from  w ww . j av  a  2 s  .c  o  m*/
 * @param  optimizingJob  The optimizing job to include in the document.
 *
 * @throws  DocumentException  If a problem occurs while writing the contents.
 */
private void writeOptimizingJob(Document document, OptimizingJob optimizingJob) throws DocumentException {
    Anchor anchor = new Anchor("Optimizing Job " + optimizingJob.getOptimizingJobID(),
            FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLD, Color.BLACK));
    anchor.setName(optimizingJob.getOptimizingJobID());
    Paragraph p = new Paragraph(anchor);
    document.add(p);

    // Write the general information to the document.
    p = new Paragraph("General Information",
            FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
    document.add(p);

    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100);
    table.setWidths(new int[] { 30, 70 });
    writeTableCell(table, "Optimizing Job ID");
    writeTableCell(table, optimizingJob.getOptimizingJobID());

    writeTableCell(table, "Job Type");
    writeTableCell(table, optimizingJob.getJobClassName());

    String descriptionStr = optimizingJob.getDescription();
    if ((descriptionStr == null) || (descriptionStr.length() == 0)) {
        descriptionStr = "(Not Specified)";
    }
    writeTableCell(table, "Base Description");
    writeTableCell(table, descriptionStr);

    writeTableCell(table, "Include Thread Count in Description");
    writeTableCell(table, String.valueOf(optimizingJob.includeThreadsInDescription()));

    writeTableCell(table, "Job State");
    writeTableCell(table, Constants.jobStateToString(optimizingJob.getJobState()));
    document.add(table);

    // Write the schedule config to the document if appropriate.
    if (includeScheduleConfig) {
        document.add(new Paragraph(" "));
        p = new Paragraph("Schedule Information",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        Date startTime = optimizingJob.getStartTime();
        String startStr;
        if (startTime == null) {
            startStr = "(Not Available)";
        } else {
            startStr = dateFormat.format(startTime);
        }
        writeTableCell(table, "Scheduled Start Time");
        writeTableCell(table, startStr);

        int duration = optimizingJob.getDuration();
        String durationStr;
        if (duration > 0) {
            durationStr = duration + " seconds";
        } else {
            durationStr = "(Not Specified)";
        }
        writeTableCell(table, "Job Duration");
        writeTableCell(table, durationStr);

        writeTableCell(table, "Delay Between Iterations");
        writeTableCell(table, optimizingJob.getDelayBetweenIterations() + " seconds");

        writeTableCell(table, "Number of Clients");
        writeTableCell(table, String.valueOf(optimizingJob.getNumClients()));

        String[] requestedClients = optimizingJob.getRequestedClients();
        if ((requestedClients != null) && (requestedClients.length > 0)) {
            PdfPTable clientTable = new PdfPTable(1);
            for (int i = 0; i < requestedClients.length; i++) {
                PdfPCell clientCell = new PdfPCell(new Phrase(requestedClients[i]));
                clientCell.setBorder(0);
                clientTable.addCell(clientCell);
            }

            writeTableCell(table, "Requested Clients");
            table.addCell(clientTable);
        }

        String[] monitorClients = optimizingJob.getResourceMonitorClients();
        if ((monitorClients != null) && (monitorClients.length > 0)) {
            PdfPTable clientTable = new PdfPTable(1);
            for (int i = 0; i < monitorClients.length; i++) {
                PdfPCell clientCell = new PdfPCell(new Phrase(monitorClients[i]));
                clientCell.setBorder(0);
                clientTable.addCell(clientCell);
            }

            writeTableCell(table, "Resource Monitor Clients");
            table.addCell(clientTable);
        }

        writeTableCell(table, "Minimum Number of Threads");
        writeTableCell(table, String.valueOf(optimizingJob.getMinThreads()));

        int maxThreads = optimizingJob.getMaxThreads();
        String maxThreadsStr;
        if (maxThreads > 0) {
            maxThreadsStr = String.valueOf(maxThreads);
        } else {
            maxThreadsStr = "(Not Specified)";
        }
        writeTableCell(table, "Maximum Number of Threads");
        writeTableCell(table, maxThreadsStr);

        writeTableCell(table, "Thread Increment Between Iterations");
        writeTableCell(table, String.valueOf(optimizingJob.getThreadIncrement()));

        writeTableCell(table, "Statistics Collection Interval");
        writeTableCell(table, optimizingJob.getCollectionInterval() + " seconds");
        document.add(table);
    }

    // Get the optimization algorithm used.
    OptimizationAlgorithm optimizationAlgorithm = optimizingJob.getOptimizationAlgorithm();
    ParameterList paramList = optimizationAlgorithm.getOptimizationAlgorithmParameters();
    Parameter[] optimizationParams = paramList.getParameters();

    // Write the optimizing config to the document if appropriate.
    if (includeScheduleConfig) {
        document.add(new Paragraph(" "));
        p = new Paragraph("Optimization Settings",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        for (int i = 0; i < optimizationParams.length; i++) {
            writeTableCell(table, optimizationParams[i].getDisplayName());
            writeTableCell(table, optimizationParams[i].getDisplayValue());
        }

        writeTableCell(table, "Maximum Consecutive Non-Improving Iterations");
        writeTableCell(table, String.valueOf(optimizingJob.getMaxNonImproving()));

        writeTableCell(table, "Re-Run Best Iteration");
        writeTableCell(table, String.valueOf(optimizingJob.reRunBestIteration()));

        int reRunDuration = optimizingJob.getReRunDuration();
        String durationStr;
        if (reRunDuration > 0) {
            durationStr = reRunDuration + " seconds";
        } else {
            durationStr = "(Not Specified)";
        }
        writeTableCell(table, "Re-Run Duration");
        writeTableCell(table, durationStr);

        document.add(table);
    }

    // Write the job-specific config to the document if appropriate.
    if (includeJobConfig) {
        document.add(new Paragraph(" "));
        p = new Paragraph("Parameter Information",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        Parameter[] params = optimizingJob.getParameters().getParameters();
        for (int i = 0; i < params.length; i++) {
            writeTableCell(table, params[i].getDisplayName());
            writeTableCell(table, params[i].getDisplayValue());
        }

        document.add(table);
    }

    // Write the statistical data to the document if appropriate.
    if (includeStats && optimizingJob.hasStats()) {
        document.add(new Paragraph(" "));
        p = new Paragraph("Execution Data",
                FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
        document.add(p);

        table = new PdfPTable(2);
        table.setWidthPercentage(100);
        table.setWidths(new int[] { 30, 70 });

        Date actualStartTime = optimizingJob.getActualStartTime();
        String startTimeStr;
        if (actualStartTime == null) {
            startTimeStr = "(Not Available)";
        } else {
            startTimeStr = dateFormat.format(actualStartTime);
        }
        writeTableCell(table, "Actual Start Time");
        writeTableCell(table, startTimeStr);

        Date actualStopTime = optimizingJob.getActualStopTime();
        String stopTimeStr;
        if (actualStopTime == null) {
            stopTimeStr = "(Not Available)";
        } else {
            stopTimeStr = dateFormat.format(actualStopTime);
        }
        writeTableCell(table, "Actual Stop Time");
        writeTableCell(table, stopTimeStr);

        Job[] iterations = optimizingJob.getAssociatedJobs();
        if ((iterations != null) && (iterations.length > 0)) {
            writeTableCell(table, "Job Iterations Completed");
            writeTableCell(table, String.valueOf(iterations.length));

            int optimalThreadCount = optimizingJob.getOptimalThreadCount();
            String threadStr;
            if (optimalThreadCount > 0) {
                threadStr = String.valueOf(optimalThreadCount);
            } else {
                threadStr = "(Not Available)";
            }
            writeTableCell(table, "Optimal Thread Count");
            writeTableCell(table, threadStr);

            double optimalValue = optimizingJob.getOptimalValue();
            String valueStr;
            if (optimalThreadCount > 0) {
                valueStr = decimalFormat.format(optimalValue);
            } else {
                valueStr = "(Not Available)";
            }
            writeTableCell(table, "Optimal Value");
            writeTableCell(table, valueStr);

            String optimalID = optimizingJob.getOptimalJobID();
            writeTableCell(table, "Optimal Job Iteration");
            if ((optimalID == null) || (optimalID.length() == 0)) {
                writeTableCell(table, "(Not Available)");
            } else if (includeOptimizingIterations) {
                anchor = new Anchor(optimalID,
                        FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, Color.BLUE));
                anchor.setReference('#' + optimalID);
                table.addCell(new PdfPCell(anchor));
            } else {
                writeTableCell(table, optimalID);
            }
        }

        Job reRunIteration = optimizingJob.getReRunIteration();
        if (reRunIteration != null) {
            writeTableCell(table, "Re-Run Iteration");
            if (includeOptimizingIterations) {
                anchor = new Anchor(reRunIteration.getJobID(),
                        FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, Color.BLUE));
                anchor.setReference('#' + reRunIteration.getJobID());
                table.addCell(new PdfPCell(anchor));
            } else {
                writeTableCell(table, reRunIteration.getJobID());
            }

            String valueStr;
            try {
                double iterationValue = optimizationAlgorithm.getIterationOptimizationValue(reRunIteration);
                valueStr = decimalFormat.format(iterationValue);
            } catch (Exception e) {
                valueStr = "N/A";
            }

            writeTableCell(table, "Re-Run Iteration Value");
            writeTableCell(table, valueStr);
        }

        document.add(table);

        if (includeOptimizingIterations && (iterations != null) && (iterations.length > 0)) {
            document.add(new Paragraph(" "));
            p = new Paragraph("Job Iterations",
                    FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
            document.add(p);

            table = new PdfPTable(2);
            table.setWidthPercentage(100);
            table.setWidths(new int[] { 50, 50 });

            for (int i = 0; i < iterations.length; i++) {
                String valueStr;
                try {
                    double iterationValue = optimizationAlgorithm.getIterationOptimizationValue(iterations[i]);
                    valueStr = decimalFormat.format(iterationValue);
                } catch (Exception e) {
                    valueStr = "N/A";
                }

                anchor = new Anchor(iterations[i].getJobID(),
                        FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, Color.BLUE));
                anchor.setReference('#' + iterations[i].getJobID());
                table.addCell(new PdfPCell(anchor));
                writeTableCell(table, valueStr);
            }

            document.add(table);
        }

        if (includeGraphs && (iterations != null) && (iterations.length > 0)) {
            String[] statNames = iterations[0].getStatTrackerNames();
            for (int j = 0; j < statNames.length; j++) {
                StatTracker[] trackers = iterations[0].getStatTrackers(statNames[j]);
                if ((trackers != null) && (trackers.length > 0)) {
                    StatTracker tracker = trackers[0].newInstance();
                    tracker.aggregate(trackers);

                    try {
                        document.newPage();
                        ParameterList params = tracker.getGraphParameterStubs(iterations);
                        BufferedImage graphImage = tracker.createGraph(iterations,
                                Constants.DEFAULT_GRAPH_WIDTH, Constants.DEFAULT_GRAPH_HEIGHT, params);
                        Image image = Image.getInstance(imageToByteArray(graphImage));
                        image.scaleToFit(inchesToPoints(5.5), inchesToPoints(4.5));
                        document.add(image);
                    } catch (Exception e) {
                    }
                }
            }
        }

        if (includeOptimizingIterations && (iterations != null) && (iterations.length > 0)) {
            for (int i = 0; i < iterations.length; i++) {
                document.newPage();
                writeJob(document, iterations[i]);
            }
        }
        if (includeOptimizingIterations && (reRunIteration != null)) {
            document.newPage();
            writeJob(document, reRunIteration);
        }
    }
}

From source file:com.slamd.report.PDFReportGenerator.java

License:Open Source License

/**
 * Writes the specified text to the provided table as a header cell.
 *
 * @param  table  The table to which the header cell should be written.
 * @param  text   The text to write to the header cell.
 *//*from ww  w.  j a  v a  2  s .c om*/
private void writeTableHeaderCell(PdfPTable table, String text) {
    Phrase phrase = new Phrase(text, FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD, Color.BLACK));
    table.addCell(new PdfPCell(phrase));
}