A
List
contains several
ListItem
s.
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:
-
First line
-
The second line is longer to see what happens once the end of the line is reached. Will it start on a new line?
-
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:
-
This is an item
-
This is another item
first
protected int first
This variable indicates the first number of a numbered list.
firstCh
protected char firstCh
indentationLeft
protected float indentationLeft
The indentation of this list on the left side.
indentationRight
protected float indentationRight
The indentation of this list on the right side.
lastCh
protected char lastCh
lettered
protected boolean lettered
list
protected ArrayList list
This is the ArrayList
containing the different ListItem
s.
markupAttributes
protected Properties markupAttributes
Contains extra markupAttributes
numbered
protected boolean numbered
This variable indicates if the list has to be numbered.
symbol
protected Chunk symbol
This is the listsymbol of a list that is not numbered.
symbolIndent
protected float symbolIndent
The indentation of the listitems.
List
public List(Properties attributes)
Returns a List
that has been constructed taking in account
the value of some attributes.
attributes
- Some attributes
List
public List(boolean numbered,
boolean lettered,
float symbolIndent)
Creates a list
numbered
- has the list to be numbered?lettered
- has the list to be 'numbered' with letterssymbolIndent
- the indentation of the symbol
List
public List(boolean numbered,
float symbolIndent)
Constructs a
List
.
Remark: the parameter
symbolIndent is important for instance when
generating PDF-documents; it indicates the indentation of the listsymbol.
It is not important for HTML-documents.
numbered
- a booleansymbolIndent
- the indentation that has to be used for the listsymbol
add
public boolean add(Object o)
Adds an Object
to the List
.
- add in interface TextElementArray
- true if adding the object succeeded
first
public int first()
Gets the first number .
getChunks
public ArrayList getChunks()
Gets all the chunks in this element.
- getChunks in interface Element
getItems
public ArrayList getItems()
Gets all the items in the list.
- an
ArrayList
containing ListItem
s.
getMarkupAttribute
public String getMarkupAttribute(String name)
- getMarkupAttribute in interface MarkupAttributes
com.lowagie.text.MarkupAttributes.getMarkupAttribute(java.lang.String)
indentationLeft
public float indentationLeft()
Gets the indentation of this paragraph on the left side.
indentationRight
public float indentationRight()
Gets the indentation of this paragraph on the right side.
isNumbered
public boolean isNumbered()
Checks if the list is numbered.
true
if the list is numbered, false
otherwise.
isSymbol
public static boolean isSymbol(String tag)
Checks if a given tag corresponds with the listsymbol tag of this object.
- true if the tag corresponds
isTag
public static boolean isTag(String tag)
Checks if a given tag corresponds with this object.
- true if the tag corresponds
leading
public float leading()
Gets the leading of the first listitem.
listItemsInList
private int listItemsInList()
Counts the number of ListItems in the list ommiting nested lists
- Integer number of ListItems in the list
nextLetter
private String nextLetter()
Retrieves the next letter in the sequence
- String contains the next character (A-Z or a-z)
process
public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an
ElementListener
.
- process in interface Element
listener
- an ElementListener
true
if the element was processed successfully
setFirst
public void setFirst(char first)
Sets the Letter that has to come first in the list.
setFirst
public void setFirst(int first)
Sets the number that has to come first in the list.
setIndentationLeft
public void setIndentationLeft(float indentation)
Sets the indentation of this paragraph on the left side.
indentation
- the new indentation
setIndentationRight
public void setIndentationRight(float indentation)
Sets the indentation of this paragraph on the right side.
indentation
- the new indentation
setListSymbol
public void setListSymbol(String symbol)
Sets the listsymbol.
This is a shortcut for
setListSymbol(Chunk symbol)
.
setListSymbol
public void setListSymbol(Chunk symbol)
Sets the listsymbol.
setMarkupAttribute
public void setMarkupAttribute(String name,
String value)
- setMarkupAttribute in interface MarkupAttributes
com.lowagie.text.MarkupAttributes.setMarkupAttribute(java.lang.String, java.lang.String)
setMarkupAttributes
public void setMarkupAttributes(Properties markupAttributes)
- setMarkupAttributes in interface MarkupAttributes
com.lowagie.text.MarkupAttributes.setMarkupAttributes(java.util.Properties)
size
public int size()
Gets the size of the list.
symbol
public Chunk symbol()
Gets the Chunk containing the symbol.
symbolIndent
public float symbolIndent()
Gets the symbol indentation.
type
public int type()
Gets the type of the text element.
- type in interface Element