Class List
- java.lang.Object
-
- com.gitlab.pdftk_java.com.lowagie.text.List
-
- All Implemented Interfaces:
Element
,MarkupAttributes
,TextElementArray
public class List extends java.lang.Object implements TextElementArray, MarkupAttributes
AList
contains severalListItem
s.Example 1:
The result of this code looks like this: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"));
- 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
The result of this code looks like this:List overview = new List(false, 10); overview.add(new ListItem("This is an item")); overview.add("This is another item");
- This is an item
- This is another item
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
ALPHABETICAL
a possible value for the lettered parameterprotected int
first
This variable indicates the first number of a numbered list.protected char
firstCh
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 char
lastCh
protected boolean
lettered
protected java.util.ArrayList
list
This is theArrayList
containing the differentListItem
s.protected java.util.Properties
markupAttributes
Contains extra markupAttributesprotected boolean
numbered
This variable indicates if the list has to be numbered.static boolean
NUMBERICAL
a possible value for the lettered parameterstatic boolean
ORDERED
a possible value for the numbered parameterprotected Chunk
symbol
This is the listsymbol of a list that is not numbered.protected float
symbolIndent
The indentation of the listitems.static boolean
UNORDERED
a possible value for the numbered parameter-
Fields inherited from interface com.gitlab.pdftk_java.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, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, GRAPHIC, HEADER, IMGRAW, IMGTEMPLATE, JPEG, KEYWORDS, LIST, LISTITEM, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE
-
-
Constructor Summary
Constructors Constructor Description List(boolean numbered, boolean lettered, float symbolIndent)
Creates a listList(boolean numbered, float symbolIndent)
Constructs aList
.List(java.util.Properties attributes)
Returns aList
that has been constructed taking in account the value of some attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(java.lang.Object o)
Adds anObject
to theList
.int
first()
Gets the first number .java.util.ArrayList
getChunks()
Gets all the chunks in this element.java.util.ArrayList
getItems()
Gets all the items in the list.java.lang.String
getMarkupAttribute(java.lang.String name)
Returns the value of the specified attribute.java.util.Set
getMarkupAttributeNames()
Returns aSet
ofString
attribute names for theMarkupAttributes
implementor.java.util.Properties
getMarkupAttributes()
Return aProperties
-object containing all the markupAttributes.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
isNumbered()
Checks if the list is numbered.static boolean
isSymbol(java.lang.String tag)
Checks if a given tag corresponds with the listsymbol tag of this object.static boolean
isTag(java.lang.String tag)
Checks if a given tag corresponds with this object.float
leading()
Gets the leading of the first listitem.private int
listItemsInList()
Counts the number of ListItems in the list ommiting nested listsprivate java.lang.String
nextLetter()
Retrieves the next letter in the sequenceboolean
process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.void
setFirst(char first)
Sets the Letter that has to come first in the list.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(Chunk symbol)
Sets the listsymbol.void
setListSymbol(java.lang.String symbol)
Sets the listsymbol.void
setMarkupAttribute(java.lang.String name, java.lang.String value)
Sets the specified attribute.void
setMarkupAttributes(java.util.Properties markupAttributes)
Sets the markupAttributes.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 Detail
-
ORDERED
public static final boolean ORDERED
a possible value for the numbered parameter- See Also:
- Constant Field Values
-
UNORDERED
public static final boolean UNORDERED
a possible value for the numbered parameter- See Also:
- Constant Field Values
-
NUMBERICAL
public static final boolean NUMBERICAL
a possible value for the lettered parameter- See Also:
- Constant Field Values
-
ALPHABETICAL
public static final boolean ALPHABETICAL
a possible value for the lettered parameter- See Also:
- Constant Field Values
-
list
protected java.util.ArrayList list
This is theArrayList
containing the differentListItem
s.
-
numbered
protected boolean numbered
This variable indicates if the list has to be numbered.
-
lettered
protected boolean lettered
-
first
protected int first
This variable indicates the first number of a numbered list.
-
firstCh
protected char firstCh
-
lastCh
protected char lastCh
-
symbol
protected Chunk symbol
This is the listsymbol of a list that is not numbered.
-
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.
-
symbolIndent
protected float symbolIndent
The indentation of the listitems.
-
markupAttributes
protected java.util.Properties markupAttributes
Contains extra markupAttributes
-
-
Constructor Detail
-
List
public List(boolean numbered, float symbolIndent)
Constructs aList
.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 booleansymbolIndent
- 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 letterssymbolIndent
- the indentation of the symbol
-
List
public List(java.util.Properties attributes)
Returns aList
that has been constructed taking in account the value of some attributes.- Parameters:
attributes
- Some attributes
-
-
Method Detail
-
process
public boolean process(ElementListener listener)
Processes the element by adding it (or the different parts) to anElementListener
.
-
type
public int type()
Gets the type of the text element.
-
getChunks
public java.util.ArrayList getChunks()
Gets all the chunks in this element.
-
add
public boolean add(java.lang.Object o)
Adds anObject
to theList
.- Specified by:
add
in interfaceTextElementArray
- Parameters:
o
- the object to add.- Returns:
- true if adding the object succeeded
-
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
-
setFirst
public void setFirst(int first)
Sets the number that has to come first in the list.- Parameters:
first
- a number
-
setFirst
public void setFirst(char first)
Sets the Letter that has to come first in the list.- Parameters:
first
- a letter
-
setListSymbol
public void setListSymbol(Chunk symbol)
Sets the listsymbol.- Parameters:
symbol
- aChunk
-
setListSymbol
public void setListSymbol(java.lang.String symbol)
Sets the listsymbol.This is a shortcut for
setListSymbol(Chunk symbol)
.- Parameters:
symbol
- aString
-
getItems
public java.util.ArrayList getItems()
Gets all the items in the list.- Returns:
- an
ArrayList
containingListItem
s.
-
size
public int size()
Gets the size of the list.- Returns:
- a
size
-
leading
public float leading()
Gets the leading of the first listitem.- Returns:
- a
leading
-
isNumbered
public boolean isNumbered()
Checks if the list is numbered.- Returns:
true
if the list is numbered,false
otherwise.
-
symbolIndent
public float symbolIndent()
Gets the symbol indentation.- Returns:
- the symbol indentation
-
symbol
public Chunk symbol()
Gets the Chunk containing the symbol.- Returns:
- a Chunk with a symbol
-
first
public int first()
Gets the first number .- Returns:
- a number
-
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
-
isSymbol
public static boolean isSymbol(java.lang.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(java.lang.String tag)
Checks if a given tag corresponds with this object.- Parameters:
tag
- the given tag- Returns:
- true if the tag corresponds
-
nextLetter
private java.lang.String nextLetter()
Retrieves the next letter in the sequence- Returns:
- String contains the next character (A-Z or a-z)
-
listItemsInList
private int listItemsInList()
Counts the number of ListItems in the list ommiting nested lists- Returns:
- Integer number of ListItems in the list
-
setMarkupAttribute
public void setMarkupAttribute(java.lang.String name, java.lang.String value)
Description copied from interface:MarkupAttributes
Sets the specified attribute.- Specified by:
setMarkupAttribute
in interfaceMarkupAttributes
- Parameters:
name
-String
attribute name.value
-String
attribute value.- See Also:
MarkupAttributes.setMarkupAttribute(java.lang.String, java.lang.String)
-
setMarkupAttributes
public void setMarkupAttributes(java.util.Properties markupAttributes)
Description copied from interface:MarkupAttributes
Sets the markupAttributes.- Specified by:
setMarkupAttributes
in interfaceMarkupAttributes
- Parameters:
markupAttributes
- aProperties
-object containing markupattributes- See Also:
MarkupAttributes.setMarkupAttributes(java.util.Properties)
-
getMarkupAttribute
public java.lang.String getMarkupAttribute(java.lang.String name)
Description copied from interface:MarkupAttributes
Returns the value of the specified attribute.- Specified by:
getMarkupAttribute
in interfaceMarkupAttributes
- Parameters:
name
-String
attribute name.- Returns:
String
.- See Also:
MarkupAttributes.getMarkupAttribute(java.lang.String)
-
getMarkupAttributeNames
public java.util.Set getMarkupAttributeNames()
Description copied from interface:MarkupAttributes
Returns aSet
ofString
attribute names for theMarkupAttributes
implementor.- Specified by:
getMarkupAttributeNames
in interfaceMarkupAttributes
- Returns:
Set
.- See Also:
MarkupAttributes.getMarkupAttributeNames()
-
getMarkupAttributes
public java.util.Properties getMarkupAttributes()
Description copied from interface:MarkupAttributes
Return aProperties
-object containing all the markupAttributes.- Specified by:
getMarkupAttributes
in interfaceMarkupAttributes
- Returns:
Properties
- See Also:
MarkupAttributes.getMarkupAttributes()
-
-