Example usage for com.lowagie.text ListItem ListItem

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

Introduction

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

Prototype

public ListItem(Phrase phrase) 

Source Link

Document

Constructs a ListItem with a certain Phrase.

Usage

From source file:FirstPdf.java

private static void createList(Section subCatPart) {
    List list = new List(true, false, 10);
    list.add(new ListItem("First point"));
    list.add(new ListItem("Second point"));
    list.add(new ListItem("Third point"));
    subCatPart.add(list);//from   w ww .j  a v a2s  . c o m
}

From source file:classroom.filmfestival_c.Movies17.java

@SuppressWarnings("unchecked")
protected static Element directors(FilmTitle movie) {
    Set<DirectorName> directors = movie.getDirectorNames();
    if (directors.size() == 0) {
        Paragraph p = new Paragraph("various directors");
        p.setLeading(16);// ww  w  . j av  a2 s .co m
        return p;
    }
    if (directors.size() == 1) {
        DirectorName name = directors.iterator().next();
        Paragraph p = new Paragraph(name.getName());
        p.setLeading(16);
        return p;
    }
    List list = new List(List.UNORDERED, 10);
    ListItem li;
    for (DirectorName director : directors) {
        li = new ListItem(director.getName());
        li.setLeading(16);
        list.add(li);
    }
    return list;
}

From source file:classroom.filmfestival_c.Movies17.java

@SuppressWarnings({ "unchecked", "deprecation" })
protected static Element screenings(FestivalScreening screening) {
    // the specific screening
    Paragraph p = getScreening(screening, BOLDSMALL);
    p.setLeading(16);//from   w ww .  ja v  a  2 s  . c o m

    FilmTitle movie = screening.getFilmTitle();
    Set<FestivalScreening> screenings = movie.getFestivalScreenings();
    if (screenings.size() == 1) {
        return p;
    }
    // the alternative screenings
    List list = new List(List.UNORDERED, 10);
    list.add(new ListItem(p));
    ListItem li;
    for (FestivalScreening ascreening : screenings) {
        if (ascreening.getId().equals(screening.getId()))
            continue;
        GregorianCalendar gc = new GregorianCalendar();
        gc.setTime(ascreening.getId().getDay());
        if (gc.get(GregorianCalendar.YEAR) != YEAR)
            continue;
        li = new ListItem(getScreening(ascreening, SMALL));
        li.setLeading(12);
        list.add(li);
    }
    return list;
}

From source file:com.aryjr.nheengatu.pdf.PDFDocument.java

License:Open Source License

private void extractVisibleComponents(final Tag tag, final Document doc, final MultiColumnText mct,
        final Paragraph paragraph, final List list) throws DocumentException {
    final Iterator tags = tag.tags();
    Object component;/* w ww .  j a  v  a  2s. c o m*/
    Image image;
    PDFTable table;
    final TagsManager tm = TagsManager.getInstance();

    PDFDocument.log.info("extractVisibleComponents");
    // PDFDocument.log.info(tm.states.size());
    // PDFDocument.log.info(tm.getTextIndent());
    // if (paragraph != null)
    // PDFDocument.log.info(paragraph.getFirstLineIndent());

    while (tags.hasNext()) {
        component = tags.next();
        if (component instanceof Text) {
            System.out.println("Processamento: Iniciou while -> if instanceof text");
            String s = ((Text) component).getText();
            if (s.contains("\\\"")) {
                s = s.replace("\\\"", "\"");
                ((Text) component).setText(s);
            }
            PDFDocument.log.info("text: " + ((Text) component).getText());
            // PDFDocument.log.info(tm.states.size());
            // PDFDocument.log.info(tm.getTextIndent());
            // PDFDocument.log.info(tm.getSpacingBefore());
            // PDFDocument.log.info(tm.getSpacingAfter());

            // If it's a text, create a iText text component for it
            if (paragraph != null)
                paragraph.add(PDFText.createChunk((Text) component));
            else if (list != null)
                list.add(PDFText.createParagraph((Text) component, tm));
            else
                mct.addElement(PDFText.createParagraph((Text) component, tm));
            System.out.println("Processamento: terminou while -> if instanceof text");
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("br")) {
            // PDFDocument.log.info("br");
            // PDFDocument.log.info(tm.states.size());
            // PDFDocument.log.info(tm.getTextIndent());

            // If it's a HTML line break
            if (paragraph == null) {
                mct.addElement(new Paragraph("\n"));
            } else {
                paragraph.add("\n");
            }
            System.out.println("Processamento: Iniciou while -> if instanceof tag br");
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("p")) {
            // If it's a HTML paragraph, create a iText paragraph for it

            tm.checkTag((Tag) component);
            final Paragraph p = PDFText.createParagraph(null, tm);

            PDFDocument.log.info("p");
            PDFDocument.log.info(tm.getFont().getSize());
            PDFDocument.log.info(p.getLeading());
            // PDFDocument.log.info(tm.states.size());
            // PDFDocument.log.info(tm.getTextIndent());
            // PDFDocument.log.info("align:");
            // PDFDocument.log.info(((Tag)
            // component).getPropertyValue("align"));
            // PDFDocument.log.info(tm.getAlign());

            // Paragraph p = new Paragraph();
            // p.setAlignment(tm.getAlign());
            // p.setKeepTogether(true);
            // // float b = tm.getSpacingBefore();
            // // float a = tm.getSpacingAfter();
            // p.setSpacingBefore(tm.getSpacingBefore());
            // p.setSpacingAfter(tm.getSpacingAfter());
            // p.setFirstLineIndent(tm.getTextIndent());
            extractVisibleComponents((Tag) component, doc, mct, p, list);
            if (paragraph != null)
                paragraph.add(p);
            else
                mct.addElement(p);

            // String align = ((Tag) component).getPropertyValue("align");
            // if (align != null) {
            // p.setAlignment(align.toLowerCase());
            // }
            tm.back();
            System.out.println("Processamento: Iniciou while -> if instanceof tag p");
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("ol")) {
            // If it's a HTML paragraph, create a iText paragraph for it
            tm.checkTag((Tag) component);
            if (tm.getListStyleType() == null) {
                ((GraphicsState) tm.states.get(tm.states.size() - 1)).setListStyleType("upper-roman");
            } else if (tm.getListStyleType().equals("upper-roman")) {
                ((GraphicsState) tm.states.get(tm.states.size() - 1)).setListStyleType("lower-alpha");
            }
            final List l = new RomanList(tm.getListStyleType(), 30);
            if (list != null)
                list.add(l);
            else
                mct.addElement(l);
            extractVisibleComponents((Tag) component, doc, mct, null, l);
            tm.back();
            System.out.println("Processamento: Iniciou while -> if instanceof tag ol");
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("ul")) {
            // If it's a HTML paragraph, create a iText paragraph for it
            final List l = new List(false, false, 20.0f);
            tm.checkTag((Tag) component);
            if (paragraph != null)
                paragraph.add(l);
            else
                mct.addElement(l);
            extractVisibleComponents((Tag) component, doc, mct, null, l);
            tm.back();
            System.out.println("Processamento: Iniciou while -> if instanceof tag ul");
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("li")) {
            // If it's a HTML paragraph, create a iText paragraph for it
            final ListItem li = new ListItem(tm.getFont().getSize() * 1.25f);
            li.setSpacingAfter(tm.getFont().getSize() * 0.5f);

            PDFDocument.log.info("li");
            PDFDocument.log.info(tm.getFont().getSize());
            PDFDocument.log.info(li.getLeading());

            tm.checkTag((Tag) component);
            if (list == null)
                mct.addElement(li);
            else
                list.add(li);
            extractVisibleComponents((Tag) component, doc, mct, li, list);
            tm.back();
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("img")) {
            // If it's a HTML image, create a iText image component for it
            try {
                // TODO the image path can't be static
                image = PDFImage.createImage((Tag) component);
                if (paragraph == null) {
                    mct.addElement(image);
                } else {
                    paragraph.add(image);
                }
            } catch (final Exception e) {
                e.printStackTrace();
            }
            System.out.println("Processamento: Iniciou while -> if instanceof tag img");
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("table")) {
            // If it's a HTML table, create a iText table component for it
            try {
                table = PDFTable.createTable((Tag) component);
                mct.addElement(table);
            } catch (final Exception e) {
                e.printStackTrace();
            }
        } else if (component instanceof Tag && ((Tag) component).getName().equalsIgnoreCase("div")) {
            final String s = ((Tag) component).getPropertyValue("style");
            if (s != null && s.equals("PAGE-BREAK-AFTER: always")) {
                doc.add(mct);
                mct.nextColumn();
            }
            tm.checkTag((Tag) component);
            extractVisibleComponents((Tag) component, doc, mct, paragraph, list);
            tm.back();
            System.out.println("Processamento: Iniciou while -> if instanceof tag div");
        } else {
            // If it's an another tag, check the name and call this method
            // again

            // PDFDocument.log.info("other!");
            // PDFDocument.log.info(tm.states.size());
            // PDFDocument.log.info(tm.getTextIndent());

            tm.checkTag((Tag) component);
            extractVisibleComponents((Tag) component, doc, mct, paragraph, list);
            tm.back();
            System.out.println("Processamento: Iniciou while -> else if");
        }
    }
}

From source file:com.aryjr.nheengatu.pdf.RomanList.java

License:Open Source License

/**
 * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>.
 *
 * @param   o   the object to add./*from  ww w. ja  va2 s.c o  m*/
 * @return true if adding the object succeeded
 */
public boolean add(Object o) {
    if (o instanceof ListItem) {
        ListItem item = (ListItem) o;
        final TagsManager tm = TagsManager.getInstance();
        Chunk chunk;
        if (listStyleType != null && listStyleType.equals("lower-roman"))
            chunk = new Chunk(toRomanLowerCase(first + list.size()), tm.getFont());
        else if (listStyleType != null && listStyleType.equals("upper-roman"))
            chunk = new Chunk(toRomanUppercase(first + list.size()), tm.getFont());
        else if (listStyleType != null && listStyleType.equals("lower-alpha"))
            chunk = new Chunk(nextLetter(), tm.getFont());
        else if (listStyleType != null && listStyleType.equals("upper-alpha"))
            chunk = new Chunk(nextLetter(), tm.getFont());
        else
            chunk = new Chunk(String.valueOf(first + list.size()), tm.getFont());
        chunk.append(" - ");
        item.setListSymbol(chunk);
        item.setIndentationLeft(symbolIndent);
        item.setIndentationRight(0);
        list.add(item);
    } else if (o instanceof List) {
        List nested = (List) o;
        nested.setIndentationLeft(nested.getIndentationLeft() + symbolIndent);
        first--;
        return list.add(nested);
    } else if (o instanceof String) {
        return this.add(new ListItem((String) o));
    }
    return false;
}

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));
    }/*  w w  w .j a  v  a  2s .c o  m*/
    subsection.add(list);
}

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

License:Apache License

private void printVariablesPdf(Chapter chapter, List<VariableVO> variables, int parentLevel) {
    Paragraph sTitle = new Paragraph("Process Variables", sectionFont);
    Section section = chapter.addSection(sTitle, parentLevel == 0 ? 0 : (parentLevel + 1));
    com.lowagie.text.List list = new com.lowagie.text.List(false, false, 10.0f);
    for (VariableVO var : variables) {
        Phrase phrase = new Phrase();
        phrase.add(new Chunk(var.getVariableName(), fixedWidthFont));
        String v = var.getVariableType();
        if (var.getDescription() != null)
            v += " (" + var.getDescription() + ")";
        phrase.add(new Chunk(": " + v + "\n", normalFont));
        list.add(new ListItem(phrase));
    }//from ww w . ja  va 2 s.  com
    section.add(list);
}

From source file:com.concursive.connect.web.modules.wiki.utils.WikiPDFUtils.java

License:Open Source License

private static boolean parseContent(WikiPDFContext context, Wiki wiki, String content, Document document,
        PdfPCell cell, Connection db, ArrayList<Integer> wikiListTodo, ArrayList<Integer> wikiListDone,
        float cellWidth) throws Exception {

    LOG.debug("PARSING CONTENT: " + content);

    // Parse the wiki page
    int lastIndent = 0;
    boolean preTag = false;
    boolean pre = false;
    boolean code = false;
    boolean header = true;

    try {//  w  ww.  j  ava 2  s  .  co  m

        BufferedReader in = new BufferedReader(new StringReader(content));
        String line = null;

        ArrayList unorderedParents = null;
        List thisList = null;
        Paragraph codeParagraph = null;

        while ((line = in.readLine()) != null) {
            // Tables
            if (line.startsWith("|")) {
                // @todo Close all ordered lists, unordered lists, and paragraphs

                // Parse the table
                line = parseTable(context, wiki, line, document, db, wikiListTodo, wikiListDone, in);

                if (line == null) {
                    continue;
                }
            }

            // Forms
            if (line.startsWith("[{form")) {
                // @todo close any lists or paragraphs

                // parseForm operates over all the lines that make up the form,
                // it will have to look forward so it returns an unparsed line
                parseForm(context, db, in, line, document, cell);
                continue;
            }

            // Handle code blocks
            // @todo chunk the content similar to WikiToHTMLUtils otherwise inaccurate
            if (line.startsWith("<pre>") || line.startsWith("<code>")) {
                if (!code && !pre) {
                    if (line.startsWith("<pre>")) {
                        preTag = true;
                        pre = true;
                    } else if (line.startsWith("<code>")) {
                        code = true;
                    }
                    codeParagraph = new Paragraph("", codeFont);
                    codeParagraph.setSpacingBefore(10);

                    if (pre && line.length() > ("<pre>").length()) {
                        int endOfLine = line.length();
                        if (line.endsWith("</pre>")) {
                            endOfLine = line.indexOf("</pre>");
                        }
                        // This line has some extra content that needs to be added
                        codeParagraph.add(new Chunk(
                                line.substring(line.indexOf("<pre>") + 5, endOfLine) + Chunk.NEWLINE));
                    }
                    if (code && line.length() > ("<code>").length()) {
                        int endOfLine = line.length();
                        if (line.endsWith("</code>")) {
                            endOfLine = line.indexOf("</code>");
                        }
                        // This line has some extra content that needs to be added
                        codeParagraph.add(new Chunk(
                                line.substring(line.indexOf("<code>") + 6, endOfLine) + Chunk.NEWLINE));
                    }
                    // See if this is a single line block
                    if (preTag && line.endsWith("</pre>")) {
                        // This is a single line block, so finish processing it
                    } else if (code && line.endsWith("</code>")) {
                        // This is a single line block, so finish processing it
                    } else {
                        // There are more lines to process, so do that
                        continue;
                    }
                }
            }
            if (line.startsWith("</code>") || line.endsWith("</code>")) {
                if (code) {
                    code = false;
                    if (line.indexOf("</code>") > 0 && !line.startsWith("<code>")) {
                        // This line has some extra content that needs to be added
                        codeParagraph
                                .add(new Chunk(line.substring(0, line.indexOf("</code>")) + Chunk.NEWLINE));
                    }
                    // Draw the final content
                    PdfPTable codeTable = new PdfPTable(1);
                    codeTable.setWidthPercentage(100);
                    codeTable.setSpacingBefore(10);
                    PdfPCell codeCell = new PdfPCell(codeParagraph);
                    codeCell.setPadding(20);
                    codeCell.setBorderColor(new Color(100, 100, 100));
                    codeCell.setBackgroundColor(new Color(200, 200, 200));
                    //            codeCell.setNoWrap(true);
                    codeTable.addCell(codeCell);
                    LOG.debug("document.add(codeTable)");
                    document.add(codeTable);
                    continue;
                }
            }
            if (line.startsWith("</pre>") || line.endsWith("</pre>")) {
                if (pre) {
                    preTag = false;
                    pre = false;
                    if (line.indexOf("</pre>") > 0 && !line.startsWith("<pre>")) {
                        // This line has some extra content that needs to be added
                        codeParagraph.add(new Chunk(line.substring(0, line.indexOf("</pre>")) + Chunk.NEWLINE));
                    }
                    // Draw the final content
                    PdfPTable codeTable = new PdfPTable(1);
                    codeTable.setWidthPercentage(100);
                    codeTable.setSpacingBefore(10);
                    PdfPCell codeCell = new PdfPCell(codeParagraph);
                    codeCell.setPadding(20);
                    codeCell.setBorderColor(new Color(100, 100, 100));
                    codeCell.setBackgroundColor(new Color(200, 200, 200));
                    //            codeCell.setNoWrap(true);
                    codeTable.addCell(codeCell);
                    LOG.debug("document.add(codeTable)");
                    document.add(codeTable);
                    continue;
                }
            }
            if (code || preTag) {
                // Append the chunk
                codeParagraph.add(new Chunk(line + Chunk.NEWLINE));
                continue;
            }

            // Section
            if (line.startsWith("=") && line.endsWith("=")) {
                // @todo close any open lists or paragraphs

                int hCount = parseHCount(line, "=");
                if (hCount > 6) {
                    hCount = 6;
                }
                String section = line.substring(line.indexOf("=") + hCount, line.lastIndexOf("=") - hCount + 1);
                header = true;
                context.foundHeader(hCount);
                String headerAnchor = null;

                // Store the h2's with anchors for table of contents or index
                if (hCount == 2) {
                    headerAnchor = StringUtils.toHtmlValue(section).replace(" ", "_");
                    context.getHeaderAnchors().put(headerAnchor, section);
                }
                if (hCount == 3) {
                    Paragraph title = new Paragraph(section.trim(), section2Font);
                    title.setSpacingBefore(10);
                    if (cell != null) {
                        LOG.debug("phrase.add(title)");
                        cell.addElement(title);
                    } else {
                        LOG.debug("document.add(title)");
                        document.add(title);
                    }
                } else if (hCount > 3) {
                    Paragraph title = new Paragraph(section.trim(), section3Font);
                    title.setSpacingBefore(10);
                    if (cell != null) {
                        LOG.debug("phrase.add(title)");
                        cell.addElement(title);
                    } else {
                        LOG.debug("document.add(title)");
                        document.add(title);
                    }
                } else {
                    Paragraph title = new Paragraph(section.trim(), sectionFont);
                    title.setSpacingBefore(10);
                    if (cell != null) {
                        LOG.debug("phrase.add(title)");
                        cell.addElement(title);
                    } else {
                        LOG.debug("document.add(title)");
                        document.add(title);
                    }
                }
                continue;
            }
            if (header) {
                header = false;
                if (line.trim().equals("")) {
                    // remove the extra space a user may leave after a header
                    continue;
                }
            }

            // Determine if this is a bulleted list
            if (line.startsWith("*") || line.startsWith("#")) {
                // Initialize the list array
                if (unorderedParents == null) {
                    unorderedParents = new ArrayList();
                    //            if (phrase != null) {
                    //              LOG.debug("phrase.add(new Paragraph(Chunk.NEWLINE))");
                    //              phrase.add(new Paragraph(Chunk.NEWLINE));
                    //            } else {
                    //              LOG.debug("document.add(new Paragraph(Chunk.NEWLINE))");
                    //              document.add(new Paragraph(Chunk.NEWLINE));
                    //            }
                }
                // Get the indent level
                boolean ol = line.startsWith("#");
                int hCount = WikiPDFUtils.parseHCount(line, ol ? "#" : "*");
                // Determine a shift in the tree
                if (lastIndent == 0) {
                    if (ol) {
                        thisList = new List(ol, 20);
                    } else {
                        thisList = new List(ol, 10);
                        thisList.setListSymbol(
                                new Chunk("\u2022", FontFactory.getFont(FontFactory.HELVETICA, 12)));
                    }
                    thisList.setIndentationLeft(36);
                    thisList.setIndentationRight(36);
                    unorderedParents.add(thisList);
                } else {
                    if (hCount > lastIndent) {
                        if (ol) {
                            thisList = new List(ol, 20);
                        } else {
                            thisList = new List(ol, 10);
                            thisList.setListSymbol(
                                    new Chunk("\u2022", FontFactory.getFont(FontFactory.HELVETICA, 12)));
                        }
                        thisList.setIndentationLeft(36);
                        thisList.setIndentationRight(36);
                        ((List) unorderedParents.get(unorderedParents.size() - 1)).add(thisList);
                        unorderedParents.add(thisList);
                    } else if (hCount < lastIndent) {
                        unorderedParents.remove(unorderedParents.size() - 1);
                        thisList = (List) unorderedParents.get(unorderedParents.size() - 1);
                    }
                }
                lastIndent = hCount;
                // Append the item...
                Paragraph thisItem = new Paragraph();
                parseLine(context, line.substring(hCount).trim(), thisItem, db, wikiListTodo, cellWidth, cell);
                thisList.add(new ListItem(thisItem));
                continue;
            }
            // List is finished, so append it to the document before working on
            // other paragraphs
            if (unorderedParents != null) {
                if (cell != null) {
                    LOG.debug("phrase.add((List) unorderedParents.get(0))");
                    cell.addElement((List) unorderedParents.get(0));
                } else {
                    LOG.debug("document.add((List) unorderedParents.get(0))");
                    document.add((List) unorderedParents.get(0));
                }
                unorderedParents = null;
                thisList = null;
                lastIndent = 0;
            }

            // Otherwise a simple paragraph
            Paragraph paragraph = new Paragraph();
            parseLine(context, line, paragraph, db, wikiListTodo, cellWidth, cell);
            if (cell != null) {
                LOG.debug("phrase.add(paragraph)");
                if (cell.getHorizontalAlignment() == Element.ALIGN_CENTER) {
                    paragraph.setAlignment(Element.ALIGN_CENTER);
                }
                paragraph.setSpacingBefore(5);
                cell.addElement(paragraph);
            } else {
                LOG.debug("document.add(paragraph)");
                paragraph.setSpacingBefore(5);
                document.add(paragraph);
            }
        }

        // Cleanup now that the lines are finished
        if (pre || code) {
            PdfPTable codeTable = new PdfPTable(1);
            codeTable.setWidthPercentage(100);
            codeTable.setSpacingBefore(10);
            PdfPCell codeCell = new PdfPCell(codeParagraph);
            codeCell.setPadding(20);
            codeCell.setBorderColor(new Color(100, 100, 100));
            codeCell.setBackgroundColor(new Color(200, 200, 200));
            //        codeCell.setNoWrap(true);
            codeTable.addCell(codeCell);
            LOG.debug("document.add(codeTable)");
            document.add(codeTable);
        }
        if (unorderedParents != null) {
            if (cell != null) {
                LOG.debug("phrase.add((List) unorderedParents.get(0))");
                cell.addElement((List) unorderedParents.get(0));
            } else {
                LOG.debug("document.add((List) unorderedParents.get(0))");
                document.add((List) unorderedParents.get(0));
            }
        }
        in.close();
    } catch (Exception e) {
        LOG.error("parseContent", e);
    }
    return true;
}

From source file:de.xirp.report.ReportGenerator.java

License:Open Source License

/**
 * Adds the header page to the PDF/*from w  w  w  . j  a  va2  s.c o  m*/
 * {@link com.lowagie.text.Document}.
 * 
 * @throws DocumentException
 *             if something went wrong adding the page.
 * @see com.lowagie.text.Document
 */
private static void addHeader() throws DocumentException {
    Header header = report.getHeader();

    para = getParagraph(header.getTitle(), HEADER, Element.ALIGN_CENTER);
    document.add(para);
    addSkip(4);
    List list = getList(ListType.BULLET);
    list.add(new ListItem(I18n.getString("ReportGenerator.report.header.created.date") //$NON-NLS-1$
            + " " + Util.getTimeAsString(header.getDate(), "dd.MM.yyyy"))); //$NON-NLS-1$ //$NON-NLS-2$
    list.add(new ListItem(I18n.getString("ReportGenerator.report.header.created.time") //$NON-NLS-1$
            + " " //$NON-NLS-1$
            + Util.getTimeAsString(header.getDate(), "HH:mm") //$NON-NLS-1$
            + I18n.getString("ReportGenerator.report.oClock"))); //$NON-NLS-1$
    list.add(new ListItem(I18n.getString("ReportGenerator.report.header.created.plugin") //$NON-NLS-1$
            + " " + header.getPlugin().getName())); //$NON-NLS-1$
    list.add(new ListItem(I18n.getString("ReportGenerator.report.header.created.robot") //$NON-NLS-1$
            + " " + header.getRobot().getName())); //$NON-NLS-1$
    document.add(list);
}

From source file:de.xirp.report.ReportGenerator.java

License:Open Source License

/**
 * Adds a// ww w . j a  va  2  s  .co m
 * {@link de.xirp.report.data.ContentPartList list}
 * item to the PDF {@link com.lowagie.text.Document}.
 * 
 * @param contentPartlist
 *            The list item to add.
 * @throws DocumentException
 *             if something went wrong adding the page.
 * @see de.xirp.report.data.ContentPartList
 * @see com.lowagie.text.Document
 */
private static void addList(ContentPartList contentPartlist) throws DocumentException {
    List list = getList(contentPartlist.getType());

    for (String item : contentPartlist.getEntrys()) {
        list.add(new ListItem(item));
    }
    document.add(list);
}