com.lowagie.text

Class List

Implemented Interfaces:
Element, TextElementArray
Known Direct Subclasses:
GreekList, RomanList, ZapfDingbatsList, ZapfDingbatsNumberList

public class List
extends java.lang.Object
implements TextElementArray

A List contains several ListItems.

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, ListItem

Field Summary

static boolean
ALPHABETICAL
a possible value for the lettered parameter
static boolean
LOWERCASE
a possible value for the lettered parameter
static boolean
NUMBERICAL
a possible value for the lettered parameter
static boolean
ORDERED
a possible value for the numbered parameter
static boolean
UNORDERED
a possible value for the numbered parameter
static boolean
UPPERCASE
a possible value for the lettered parameter
protected boolean
alignindent
protected boolean
autoindent
protected int
first
This variable indicates the first number of a numbered list.
protected float
indentationLeft
The indentation of this list on the left side.
protected float
indentationRight
The indentation of this list on the right side.
protected boolean
lettered
protected ArrayList
list
This is the ArrayList containing the different ListItems.
protected boolean
lowercase
protected Properties
markupAttributes
Contains extra markupAttributes
protected boolean
numbered
This variable indicates if the list has to be numbered.
protected Chunk
symbol
This is the listsymbol of a list that is not numbered.
protected float
symbolIndent
The indentation of the listitems.

Fields inherited from interface com.lowagie.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, CCITTG3_1D, CCITTG3_2D, CCITTG4, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE

Constructor Summary

List()
Constructs a List.
List(Properties attributes)
Returns a List that has been constructed taking in account the value of some attributes.
List(boolean numbered)
Constructs a List.
List(boolean numbered, boolean lettered)
Constructs a List.
List(boolean numbered, boolean lettered, float symbolIndent)
Creates a list
List(boolean numbered, float symbolIndent)
Constructs a List.

Method Summary

boolean
add(Object o)
Adds an Object to the List.
int
first()
Gets the first number .
ArrayList
getChunks()
Gets all the chunks in this element.
ArrayList
getItems()
Gets all the items in the list.
static String
getLowerCaseLetter(int index)
Translates a number to a letter(combination).
static String
getUpperCaseLetter(int index)
Translates a number to a letter(combination).
float
indentationLeft()
Gets the indentation of this paragraph on the left side.
float
indentationRight()
Gets the indentation of this paragraph on the right side.
boolean
isAlignindent()
boolean
isLettered()
Checks if the list is lettered.
boolean
isLowerCase()
Checks if the list lettering is lowercase.
boolean
isNumbered()
Checks if the list is numbered.
static boolean
isSymbol(String tag)
Checks if a given tag corresponds with the listsymbol tag of this object.
static boolean
isTag(String tag)
Checks if a given tag corresponds with this object.
float
leading()
Gets the leading of the first listitem.
void
normalizeIndentation()
boolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
void
setAlignindent(boolean alignindent)
void
setAutoindent(boolean autoindent)
void
setFirst(int first)
Sets the number that has to come first in the list.
void
setIndentationLeft(float indentation)
Sets the indentation of this paragraph on the left side.
void
setIndentationRight(float indentation)
Sets the indentation of this paragraph on the right side.
void
setListSymbol(String symbol)
Sets the listsymbol.
void
setListSymbol(Chunk symbol)
Sets the listsymbol.
void
setLowerCase(boolean uppercase)
int
size()
Gets the size of the list.
Chunk
symbol()
Gets the Chunk containing the symbol.
float
symbolIndent()
Gets the symbol indentation.
int
type()
Gets the type of the text element.

Field Details

ALPHABETICAL

public static final boolean ALPHABETICAL
a possible value for the lettered parameter
Field Value:
true

LOWERCASE

public static final boolean LOWERCASE
a possible value for the lettered parameter
Field Value:
true

NUMBERICAL

public static final boolean NUMBERICAL
a possible value for the lettered parameter
Field Value:
false

ORDERED

public static final boolean ORDERED
a possible value for the numbered parameter
Field Value:
true

UNORDERED

public static final boolean UNORDERED
a possible value for the numbered parameter
Field Value:
false

UPPERCASE

public static final boolean UPPERCASE
a possible value for the lettered parameter
Field Value:
false

alignindent

protected boolean alignindent

autoindent

protected boolean autoindent

first

protected int first
This variable indicates the first number of a numbered list.

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.

lettered

protected boolean lettered

list

protected ArrayList list
This is the ArrayList containing the different ListItems.

lowercase

protected boolean lowercase

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.

Constructor Details

List

public List()
Constructs a List.

List

public List(Properties attributes)
Returns a List that has been constructed taking in account the value of some attributes.
Parameters:
attributes - Some attributes

List

public List(boolean numbered)
Constructs a List.
Parameters:
numbered - a boolean

List

public List(boolean numbered,
            boolean lettered)
Constructs a List.
Parameters:
numbered - a boolean
lettered - has the list to be 'numbered' with letters

List

public List(boolean numbered,
            boolean lettered,
            float symbolIndent)
Creates a list
Parameters:
numbered - has the list to be numbered?
lettered - has the list to be 'numbered' with letters
symbolIndent - 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.

Parameters:
numbered - a boolean
symbolIndent - the indentation that has to be used for the listsymbol

Method Details

add

public boolean add(Object o)
Adds an Object to the List.
Specified by:
add in interface TextElementArray
Parameters:
o - the object to add.
Returns:
true if adding the object succeeded

first

public int first()
Gets the first number .
Returns:
a number

getChunks

public ArrayList getChunks()
Gets all the chunks in this element.
Specified by:
getChunks in interface Element
Returns:
an ArrayList

getItems

public ArrayList getItems()
Gets all the items in the list.
Returns:
an ArrayList containing ListItems.

getLowerCaseLetter

public static String getLowerCaseLetter(int index)
Translates a number to a letter(combination). 1-26 correspond with a-z, 27 is aa, 28 is ab, and so on, aaa comes right after zz.
Parameters:
index - a number greater than 0
Returns:
a String corresponding with the index.

getUpperCaseLetter

public static String getUpperCaseLetter(int index)
Translates a number to a letter(combination). 1-26 correspond with A-Z, 27 is AA, 28 is AB, and so on, ZZ is followed by AAA.
Parameters:
index - a number greater than 0
Returns:
a String corresponding with the index.

indentationLeft

public float indentationLeft()
Gets the indentation of this paragraph on the left side.
Returns:
the indentation

indentationRight

public float indentationRight()
Gets the indentation of this paragraph on the right side.
Returns:
the indentation

isAlignindent

public boolean isAlignindent()
Returns:
the alignindent

isLettered

public boolean isLettered()
Checks if the list is lettered.
Returns:
true if the list is lettered, false otherwise.

isLowerCase

public boolean isLowerCase()
Checks if the list lettering is lowercase.
Returns:
true if it is lowercase, false otherwise.

isNumbered

public boolean isNumbered()
Checks if the list is numbered.
Returns:
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.
Parameters:
tag - the given tag
Returns:
true if the tag corresponds

isTag

public static boolean isTag(String tag)
Checks if a given tag corresponds with this object.
Parameters:
tag - the given tag
Returns:
true if the tag corresponds

leading

public float leading()
Gets the leading of the first listitem.
Returns:
a leading

normalizeIndentation

public void normalizeIndentation()

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
Specified by:
process in interface Element
Parameters:
listener - an ElementListener
Returns:
true if the element was processed successfully

setAlignindent

public void setAlignindent(boolean alignindent)
Parameters:
alignindent - the alignindent to set

setAutoindent

public void setAutoindent(boolean autoindent)
Parameters:
autoindent - the autoindent to set

setFirst

public void setFirst(int first)
Sets the number that has to come first in the list.
Parameters:
first - a number

setIndentationLeft

public void setIndentationLeft(float indentation)
Sets the indentation of this paragraph on the left side.
Parameters:
indentation - the new indentation

setIndentationRight

public void setIndentationRight(float indentation)
Sets the indentation of this paragraph on the right side.
Parameters:
indentation - the new indentation

setListSymbol

public void setListSymbol(String symbol)
Sets the listsymbol.

This is a shortcut for setListSymbol(Chunk symbol).

Parameters:
symbol - a String

setListSymbol

public void setListSymbol(Chunk symbol)
Sets the listsymbol.
Parameters:
symbol - a Chunk

setLowerCase

public void setLowerCase(boolean uppercase)
Parameters:
uppercase - the uppercase to set

size

public int size()
Gets the size of the list.
Returns:
a size

symbol

public Chunk symbol()
Gets the Chunk containing the symbol.
Returns:
a Chunk with a symbol

symbolIndent

public float symbolIndent()
Gets the symbol indentation.
Returns:
the symbol indentation

type

public int type()
Gets the type of the text element.
Specified by:
type in interface Element
Returns:
a type