com.itextpdf.text
Class ListItem

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Element>
              extended by com.itextpdf.text.Phrase
                  extended by com.itextpdf.text.Paragraph
                      extended by com.itextpdf.text.ListItem
All Implemented Interfaces:
Indentable, Spaceable, Element, IAccessibleElement, TextElementArray, Serializable, Cloneable, Iterable<Element>, Collection<Element>, List<Element>, RandomAccess

public class ListItem
extends Paragraph

A ListItem is a Paragraph that can be added to a List.

Example 1:

 List list = new List(true, 20);
 list.add(new ListItem("First line"));
 list.add(new ListItem("The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?"));
 list.add(new ListItem("Third line"));
 
The result of this code looks like this:
  1. First line
  2. The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
  3. Third line
Example 2:
 List overview = new List(false, 10);
 overview.add(new ListItem("This is an item"));
 overview.add("This is another item");
 
The result of this code looks like this:

See Also:
Element, List, Paragraph, Serialized Form

Field Summary
protected  Chunk symbol
          this is the symbol that will precede the listitem.
 
Fields inherited from class com.itextpdf.text.Paragraph
accessibleAttributes, alignment, indentationLeft, indentationRight, keeptogether, role, spacingAfter, spacingBefore
 
Fields inherited from class com.itextpdf.text.Phrase
font, hyphenation, leading, multipliedLeading, tabSettings
 
Fields inherited from class java.util.AbstractList
modCount
 
Fields inherited from interface com.itextpdf.text.Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, YMARK
 
Constructor Summary
ListItem()
          Constructs a ListItem.
ListItem(Chunk chunk)
          Constructs a ListItem with a certain Chunk.
ListItem(float leading)
          Constructs a ListItem with a certain leading.
ListItem(float leading, Chunk chunk)
          Constructs a ListItem with a certain Chunk and a certain leading.
ListItem(float leading, String string)
          Constructs a ListItem with a certain String and a certain leading.
ListItem(float leading, String string, Font font)
          Constructs a ListItem with a certain leading, String and Font.
ListItem(Phrase phrase)
          Constructs a ListItem with a certain Phrase.
ListItem(String string)
          Constructs a ListItem with a certain String.
ListItem(String string, Font font)
          Constructs a ListItem with a certain String and a certain Font.
 
Method Summary
 void adjustListSymbolFont()
          Changes the font of the list symbol to the font of the first chunk in the list item.
 ListBody getListBody()
           
 ListLabel getListLabel()
           
 Chunk getListSymbol()
          Returns the listsymbol.
 void setIndentationLeft(float indentation, boolean autoindent)
          Sets the indentation of this paragraph on the left side.
 void setListSymbol(Chunk symbol)
          Sets the listsymbol.
 int type()
          Gets the type of the text element.
 
Methods inherited from class com.itextpdf.text.Paragraph
add, breakUp, cloneShallow, getAccessibleAttribute, getAccessibleAttributes, getAlignment, getExtraParagraphSpace, getFirstLineIndent, getId, getIndentationLeft, getIndentationRight, getKeepTogether, getRole, getSpacingAfter, getSpacingBefore, isInline, setAccessibleAttribute, setAlignment, setExtraParagraphSpace, setFirstLineIndent, setId, setIndentationLeft, setIndentationRight, setKeepTogether, setRole, setSpacingAfter, setSpacingBefore, spacingAfter, spacingBefore
 
Methods inherited from class com.itextpdf.text.Phrase
add, add, addAll, addChunk, addSpecial, getChunks, getContent, getFont, getHyphenation, getInstance, getInstance, getInstance, getLeading, getMultipliedLeading, getTabSettings, getTotalLeading, hasLeading, isContent, isEmpty, isNestable, process, setFont, setHyphenation, setLeading, setLeading, setMultipliedLeading, setTabSettings, trim
 
Methods inherited from class java.util.ArrayList
addAll, clear, clone, contains, ensureCapacity, get, indexOf, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.itextpdf.text.Element
toString
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

symbol

protected Chunk symbol
this is the symbol that will precede the listitem.

Since:
5.0 used to be private
Constructor Detail

ListItem

public ListItem()
Constructs a ListItem.


ListItem

public ListItem(float leading)
Constructs a ListItem with a certain leading.

Parameters:
leading - the leading

ListItem

public ListItem(Chunk chunk)
Constructs a ListItem with a certain Chunk.

Parameters:
chunk - a Chunk

ListItem

public ListItem(String string)
Constructs a ListItem with a certain String.

Parameters:
string - a String

ListItem

public ListItem(String string,
                Font font)
Constructs a ListItem with a certain String and a certain Font.

Parameters:
string - a String
font - a String

ListItem

public ListItem(float leading,
                Chunk chunk)
Constructs a ListItem with a certain Chunk and a certain leading.

Parameters:
leading - the leading
chunk - a Chunk

ListItem

public ListItem(float leading,
                String string)
Constructs a ListItem with a certain String and a certain leading.

Parameters:
leading - the leading
string - a String

ListItem

public ListItem(float leading,
                String string,
                Font font)
Constructs a ListItem with a certain leading, String and Font.

Parameters:
leading - the leading
string - a String
font - a Font

ListItem

public ListItem(Phrase phrase)
Constructs a ListItem with a certain Phrase.

Parameters:
phrase - a Phrase
Method Detail

type

public int type()
Gets the type of the text element.

Specified by:
type in interface Element
Overrides:
type in class Paragraph
Returns:
a type

setListSymbol

public void setListSymbol(Chunk symbol)
Sets the listsymbol.

Parameters:
symbol - a Chunk

setIndentationLeft

public void setIndentationLeft(float indentation,
                               boolean autoindent)
Sets the indentation of this paragraph on the left side.

Parameters:
indentation - the new indentation
autoindent - if set to true, indentation is done automagically, the given indentation float is disregarded.

adjustListSymbolFont

public void adjustListSymbolFont()
Changes the font of the list symbol to the font of the first chunk in the list item.

Since:
5.0.6

getListSymbol

public Chunk getListSymbol()
Returns the listsymbol.

Returns:
a Chunk

getListBody

public ListBody getListBody()

getListLabel

public ListLabel getListLabel()


Copyright © 2014. All Rights Reserved.