Example usage for com.lowagie.text Section addSection

List of usage examples for com.lowagie.text Section addSection

Introduction

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

Prototype

public Section addSection(float indentation, String title) 

Source Link

Document

Adds a Section to this Section and returns it.

Usage

From source file:com.centurylink.mdw.designer.pages.ExportHelper.java

License:Apache License

private void addSectionContentPdf(Section section, Object one, int parent_level) {
    if (one == null)
        return;/*from  w  w  w  .j  a  v a  2 s  .  c  o  m*/
    if (one instanceof List<?>) {
        for (Object two : (List<?>) one) {
            addSectionContentPdf(section, two, parent_level);
        }
    } else if (one instanceof TempSectionPdf) {
        section.addSection(((TempSectionPdf) one).title, parent_level == 0 ? 0 : (parent_level + 1));
    } else {
        section.add(one);
    }
}

From source file:com.centurylink.mdw.designer.pages.ExportHelper.java

License:Apache License

private void printAttributesPdf(Section section, List<AttributeVO> attrs, int parentLevel) {
    Paragraph sTitle = new Paragraph("Activity Attributes", subSectionFont);
    Section subsection = section.addSection(sTitle, parentLevel == 0 ? 0 : (parentLevel + 1));
    com.lowagie.text.List list = new com.lowagie.text.List(false, false, 20.0f);
    for (AttributeVO attr : attrs) {
        if (excludeAttribute(attr.getAttributeName(), attr.getAttributeValue()))
            continue;
        Phrase phrase = new Phrase();
        phrase.add(new Chunk(attr.getAttributeName(), fixedWidthFont));
        String v = attr.getAttributeValue();
        if (v == null)
            v = "";
        phrase.add(new Chunk(": " + v, normalFont));
        list.add(new ListItem(phrase));
    }/*from   ww w.j  a v  a2s  .  com*/
    subsection.add(list);
}

From source file:com.stratelia.webactiv.newsEdito.control.PdfGenerator.java

License:Open Source License

/**
 * Method declaration// w  w w.j  av  a 2s  .com
 * @param section
 * @param complete
 * @see
 */
public static void addPublication(Section section, CompletePublication complete) {
    Font publicationFont = new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 64, 64));

    try {
        Paragraph pub = new Paragraph(complete.getPublicationDetail().getName(), publicationFont);
        Section subsection = section.addSection(pub, 0);

        if (complete.getPublicationDetail().getDescription() != null) {
            subsection.add(new Paragraph(complete.getPublicationDetail().getDescription()));
        }
        if ((complete.getInfoDetail() != null) && (complete.getModelDetail() != null)) {
            String toParse = complete.getModelDetail().getHtmlDisplayer();

            Iterator<InfoTextDetail> textIterator = complete.getInfoDetail().getInfoTextList().iterator();
            Iterator<InfoImageDetail> imageIterator = complete.getInfoDetail().getInfoImageList().iterator();

            int posit = toParse.indexOf("%WA");
            InfoTextDetail textDetail = null;
            Paragraph text = null;
            InfoImageDetail imageDetail = null;
            Image img = null;

            while (posit != -1) {
                if (posit > 0) {
                    toParse = toParse.substring(posit);
                }
                if (toParse.startsWith("%WATXTDATA%")) {
                    if (textIterator.hasNext()) {
                        textDetail = textIterator.next();
                        text = new Paragraph(textDetail.getContent());

                        subsection.add(text);
                    }
                    toParse = toParse.substring(11);
                } else if (toParse.startsWith("%WAIMGDATA%")) {
                    if (imageIterator.hasNext()) {
                        imageDetail = imageIterator.next();
                        String imagePath = FileRepositoryManager
                                .getAbsolutePath(imageDetail.getPK().getComponentName()) + getImagePath()
                                + File.separator + imageDetail.getPhysicalName();
                        SilverTrace.info("NewsEdito", "PDFGenerator.addPublication", "root.MSG_PARAM_VALUE",
                                "imagePath = " + imagePath);
                        img = Image.getInstance(imagePath);

                        subsection.add(img);
                    }
                    toParse = toParse.substring(11);
                }

                // et on recommence
                posit = toParse.indexOf("%WA");
            }
        }

    } catch (Exception e) {
        SilverTrace.warn("NewsEdito", "PdfGenerator.addPublication", "NewsEdito.EX_NO_PUBLI_ADDED");
    }
}