com.lowagie.text

Class List

public class List extends 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 booleanALPHABETICAL
a possible value for the lettered parameter
protected booleanalignindent
Indicates if the indentation of all the items has to be aligned.
protected booleanautoindent
Indicates if the indentation has to be set automatically.
protected intfirst
This variable indicates the first number of a numbered list.
protected floatindentationLeft
The indentation of this list on the left side.
protected floatindentationRight
The indentation of this list on the right side.
protected booleanlettered
Indicates if the listsymbols are numerical or alphabetical.
protected ArrayListlist
This is the ArrayList containing the different ListItems.
protected booleanlowercase
Indicates if the listsymbols are lowercase or uppercase.
static booleanLOWERCASE
a possible value for the lettered parameter
protected booleannumbered
Indicates if the list has to be numbered.
static booleanNUMERICAL
a possible value for the lettered parameter
static booleanORDERED
a possible value for the numbered parameter
protected Chunksymbol
This is the listsymbol of a list that is not numbered.
protected floatsymbolIndent
The indentation of the listitems.
static booleanUNORDERED
a possible value for the numbered parameter
static booleanUPPERCASE
a possible value for the lettered parameter
Constructor Summary
List()
Constructs a List.
List(boolean numbered)
Constructs a List.
List(boolean numbered, boolean lettered)
Constructs a List.
List(boolean numbered, float symbolIndent)
Constructs a List.
List(boolean numbered, boolean lettered, float symbolIndent)
Creates a list
List(Properties attributes)
Returns a List that has been constructed taking in account the value of some attributes.
Method Summary
booleanadd(Object o)
Adds an Object to the List.
intfirst()
Gets the first number .
ArrayListgetChunks()
Gets all the chunks in this element.
intgetFirst()
Gets the first number .
floatgetIndentationLeft()
Gets the indentation of this paragraph on the left side.
floatgetIndentationRight()
Gets the indentation of this paragraph on the right side.
ArrayListgetItems()
Gets all the items in the list.
ChunkgetSymbol()
Gets the Chunk containing the symbol.
floatgetSymbolIndent()
Gets the symbol indentation.
floatgetTotalLeading()
Gets the leading of the first listitem.
floatindentationLeft()
Gets the indentation of this paragraph on the left side.
floatindentationRight()
Gets the indentation of this paragraph on the right side.
booleanisAlignindent()
Checks if all the listitems should be aligned.
booleanisAutoindent()
Checks if the indentation of list items is done automatically.
booleanisEmpty()
Returns true if the list is empty.
booleanisLettered()
Checks if the list is lettered.
booleanisLowercase()
Checks if the list lettering is lowercase.
booleanisLowerCase()
Checks if the list lettering is lowercase.
booleanisNumbered()
Checks if the list is numbered.
voidnormalizeIndentation()
Makes sure all the items in the list have the same indentation.
booleanprocess(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.
voidsetAlignindent(boolean alignindent)
voidsetAutoindent(boolean autoindent)
voidsetFirst(int first)
Sets the number that has to come first in the list.
voidsetIndentationLeft(float indentation)
Sets the indentation of this paragraph on the left side.
voidsetIndentationRight(float indentation)
Sets the indentation of this paragraph on the right side.
voidsetLettered(boolean lettered)
voidsetListSymbol(Chunk symbol)
Sets the listsymbol.
voidsetListSymbol(String symbol)
Sets the listsymbol.
voidsetLowercase(boolean uppercase)
voidsetNumbered(boolean numbered)
voidsetSymbolIndent(float symbolIndent)
intsize()
Gets the size of the list.
Chunksymbol()
Gets the Chunk containing the symbol.
floatsymbolIndent()
Gets the symbol indentation.
inttype()
Gets the type of the text element.

Field Detail

ALPHABETICAL

public static final boolean ALPHABETICAL
a possible value for the lettered parameter

alignindent

protected boolean alignindent
Indicates if the indentation of all the items has to be aligned.

autoindent

protected boolean autoindent
Indicates if the indentation has to be set automatically.

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
Indicates if the listsymbols are numerical or alphabetical.

list

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

lowercase

protected boolean lowercase
Indicates if the listsymbols are lowercase or uppercase.

LOWERCASE

public static final boolean LOWERCASE
a possible value for the lettered parameter

numbered

protected boolean numbered
Indicates if the list has to be numbered.

NUMERICAL

public static final boolean NUMERICAL
a possible value for the lettered parameter

ORDERED

public static final boolean ORDERED
a possible value for the numbered parameter

symbol

protected Chunk symbol
This is the listsymbol of a list that is not numbered.

symbolIndent

protected float symbolIndent
The indentation of the listitems.

UNORDERED

public static final boolean UNORDERED
a possible value for the numbered parameter

UPPERCASE

public static final boolean UPPERCASE
a possible value for the lettered parameter

Constructor Detail

List

public List()
Constructs a List.

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

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(Properties attributes)

Deprecated: use ElementFactory.getList(attributes);

Returns a List that has been constructed taking in account the value of some attributes.

Parameters: attributes Some attributes

Method Detail

add

public boolean add(Object o)
Adds an Object to the List.

Parameters: o the object to add.

Returns: true if adding the object succeeded

first

public int first()

Deprecated: use getFirst();

Gets the first number .

Returns: a number

getChunks

public ArrayList getChunks()
Gets all the chunks in this element.

Returns: an ArrayList

getFirst

public int getFirst()
Gets the first number .

Returns: a number

getIndentationLeft

public float getIndentationLeft()
Gets the indentation of this paragraph on the left side.

Returns: the indentation

getIndentationRight

public float getIndentationRight()
Gets the indentation of this paragraph on the right side.

Returns: the indentation

getItems

public ArrayList getItems()
Gets all the items in the list.

Returns: an ArrayList containing ListItems.

getSymbol

public Chunk getSymbol()
Gets the Chunk containing the symbol.

Returns: a Chunk with a symbol

getSymbolIndent

public float getSymbolIndent()
Gets the symbol indentation.

Returns: the symbol indentation

getTotalLeading

public float getTotalLeading()
Gets the leading of the first listitem.

Returns: a leading

indentationLeft

public float indentationLeft()

Deprecated: use getIndentationLeft();

Gets the indentation of this paragraph on the left side.

Returns: the indentation

indentationRight

public float indentationRight()

Deprecated: use getIndentationRight();

Gets the indentation of this paragraph on the right side.

Returns: the indentation

isAlignindent

public boolean isAlignindent()
Checks if all the listitems should be aligned.

Returns: the alignindent

isAutoindent

public boolean isAutoindent()
Checks if the indentation of list items is done automatically.

Returns: the autoindent

isEmpty

public boolean isEmpty()
Returns true if the list is empty.

Returns: true if the list is empty

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.

isLowerCase

public boolean isLowerCase()

Deprecated: use 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.

normalizeIndentation

public void normalizeIndentation()
Makes sure all the items in the list have the same indentation.

process

public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener.

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

setLettered

public void setLettered(boolean lettered)

Parameters: lettered the lettered to set

setListSymbol

public void setListSymbol(Chunk symbol)
Sets the listsymbol.

Parameters: symbol a Chunk

setListSymbol

public void setListSymbol(String symbol)
Sets the listsymbol.

This is a shortcut for setListSymbol(Chunk symbol).

Parameters: symbol a String

setLowercase

public void setLowercase(boolean uppercase)

Parameters: uppercase the uppercase to set

setNumbered

public void setNumbered(boolean numbered)

Parameters: numbered the numbered to set

setSymbolIndent

public void setSymbolIndent(float symbolIndent)

Parameters: symbolIndent the symbolIndent to set

size

public int size()
Gets the size of the list.

Returns: a size

symbol

public Chunk symbol()

Deprecated: use getSymbol();

Gets the Chunk containing the symbol.

Returns: a Chunk with a symbol

symbolIndent

public float symbolIndent()

Deprecated: use getSymbolIndent();

Gets the symbol indentation.

Returns: the symbol indentation

type

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

Returns: a type