Class List
java.lang.Object
com.gitlab.pdftk_java.com.lowagie.text.List
- All Implemented Interfaces:
Element, MarkupAttributes, 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:
- 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
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
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleana possible value for the lettered parameterprotected intThis variable indicates the first number of a numbered list.protected charprotected floatThe indentation of this list on the left side.protected floatThe indentation of this list on the right side.protected charprotected booleanprotected ArrayListThis is theArrayListcontaining the differentListItems.protected PropertiesContains extra markupAttributesprotected booleanThis variable indicates if the list has to be numbered.static final booleana possible value for the lettered parameterstatic final booleana possible value for the numbered parameterprotected ChunkThis is the listsymbol of a list that is not numbered.protected floatThe indentation of the listitems.static final booleana possible value for the numbered parameterFields inherited from interface 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
ConstructorsConstructorDescriptionList(boolean numbered, boolean lettered, float symbolIndent) Creates a listList(boolean numbered, float symbolIndent) Constructs aList.List(Properties attributes) Returns aListthat has been constructed taking in account the value of some attributes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds anObjectto theList.intfirst()Gets the first number .Gets all the chunks in this element.getItems()Gets all the items in the list.getMarkupAttribute(String name) Returns the value of the specified attribute.Returns aSetofStringattribute names for theMarkupAttributesimplementor.Return aProperties-object containing all the markupAttributes.floatGets the indentation of this paragraph on the left side.floatGets the indentation of this paragraph on the right side.booleanChecks if the list is numbered.static booleanChecks if a given tag corresponds with the listsymbol tag of this object.static booleanChecks if a given tag corresponds with this object.floatleading()Gets the leading of the first listitem.private intCounts the number of ListItems in the list ommiting nested listsprivate StringRetrieves the next letter in the sequencebooleanprocess(ElementListener listener) Processes the element by adding it (or the different parts) to anElementListener.voidsetFirst(char first) Sets the Letter that has to come first in the list.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.voidsetListSymbol(Chunk symbol) Sets the listsymbol.voidsetListSymbol(String symbol) Sets the listsymbol.voidsetMarkupAttribute(String name, String value) Sets the specified attribute.voidsetMarkupAttributes(Properties markupAttributes) Sets the markupAttributes.intsize()Gets the size of the list.symbol()Gets the Chunk containing the symbol.floatGets the symbol indentation.inttype()Gets the type of the text element.
-
Field Details
-
ORDERED
public static final boolean ORDEREDa possible value for the numbered parameter- See Also:
-
UNORDERED
public static final boolean UNORDEREDa possible value for the numbered parameter- See Also:
-
NUMBERICAL
public static final boolean NUMBERICALa possible value for the lettered parameter- See Also:
-
ALPHABETICAL
public static final boolean ALPHABETICALa possible value for the lettered parameter- See Also:
-
list
This is theArrayListcontaining the differentListItems. -
numbered
protected boolean numberedThis variable indicates if the list has to be numbered. -
lettered
protected boolean lettered -
first
protected int firstThis variable indicates the first number of a numbered list. -
firstCh
protected char firstCh -
lastCh
protected char lastCh -
symbol
This is the listsymbol of a list that is not numbered. -
indentationLeft
protected float indentationLeftThe indentation of this list on the left side. -
indentationRight
protected float indentationRightThe indentation of this list on the right side. -
symbolIndent
protected float symbolIndentThe indentation of the listitems. -
markupAttributes
Contains extra markupAttributes
-
-
Constructor Details
-
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
Returns aListthat has been constructed taking in account the value of some attributes.- Parameters:
attributes- Some attributes
-
-
Method Details
-
process
Processes the element by adding it (or the different parts) to anElementListener. -
type
-
getChunks
-
add
Adds anObjectto theList.- Specified by:
addin 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
-
setListSymbol
Sets the listsymbol.This is a shortcut for
setListSymbol(Chunk symbol).- Parameters:
symbol- aString
-
getItems
Gets all the items in the list.- Returns:
- an
ArrayListcontainingListItems.
-
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:
trueif the list is numbered,falseotherwise.
-
symbolIndent
public float symbolIndent()Gets the symbol indentation.- Returns:
- the symbol indentation
-
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
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
Checks if a given tag corresponds with this object.- Parameters:
tag- the given tag- Returns:
- true if the tag corresponds
-
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
Description copied from interface:MarkupAttributesSets the specified attribute.- Specified by:
setMarkupAttributein interfaceMarkupAttributes- Parameters:
name-Stringattribute name.value-Stringattribute value.- See Also:
-
setMarkupAttributes
Description copied from interface:MarkupAttributesSets the markupAttributes.- Specified by:
setMarkupAttributesin interfaceMarkupAttributes- Parameters:
markupAttributes- aProperties-object containing markupattributes- See Also:
-
getMarkupAttribute
Description copied from interface:MarkupAttributesReturns the value of the specified attribute.- Specified by:
getMarkupAttributein interfaceMarkupAttributes- Parameters:
name-Stringattribute name.- Returns:
String.- See Also:
-
getMarkupAttributeNames
Description copied from interface:MarkupAttributesReturns aSetofStringattribute names for theMarkupAttributesimplementor.- Specified by:
getMarkupAttributeNamesin interfaceMarkupAttributes- Returns:
Set.- See Also:
-
getMarkupAttributes
Description copied from interface:MarkupAttributesReturn aProperties-object containing all the markupAttributes.- Specified by:
getMarkupAttributesin interfaceMarkupAttributes- Returns:
Properties- See Also:
-