public class List extends java.lang.Object implements TextElementArray, MarkupAttributes
List
contains several ListItem
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"));
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");
Modifier and Type | Field and Description |
---|---|
static boolean |
ALPHABETICAL
a possible value for the lettered parameter
|
protected 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 the
ArrayList containing the different ListItem s. |
protected java.util.Properties |
markupAttributes
Contains extra markupAttributes
|
protected boolean |
numbered
This variable indicates if the list has to be numbered.
|
static boolean |
NUMBERICAL
a possible value for the lettered parameter
|
static boolean |
ORDERED
a possible value for the numbered parameter
|
protected 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
|
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 and Description |
---|
List(boolean numbered,
boolean lettered,
float symbolIndent)
Creates a list
|
List(boolean numbered,
float symbolIndent)
Constructs a
List . |
List(java.util.Properties attributes)
Returns a
List that has been constructed taking in account
the value of some attributes. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object o)
Adds an
Object to the List . |
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 a
Set of String attribute names for the
MarkupAttributes implementor. |
java.util.Properties |
getMarkupAttributes()
Return a
Properties -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 lists
|
private java.lang.String |
nextLetter()
Retrieves the next letter in the sequence
|
boolean |
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an
ElementListener . |
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.
|
public static final boolean ORDERED
public static final boolean UNORDERED
public static final boolean NUMBERICAL
public static final boolean ALPHABETICAL
protected java.util.ArrayList list
ArrayList
containing the different ListItem
s.protected boolean numbered
protected boolean lettered
protected int first
protected char firstCh
protected char lastCh
protected Chunk symbol
protected float indentationLeft
protected float indentationRight
protected float symbolIndent
protected java.util.Properties markupAttributes
public List(boolean numbered, float symbolIndent)
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 listsymbolpublic List(boolean numbered, boolean lettered, float symbolIndent)
numbered
- has the list to be numbered?lettered
- has the list to be 'numbered' with letterssymbolIndent
- the indentation of the symbolpublic List(java.util.Properties attributes)
List
that has been constructed taking in account
the value of some attributes.attributes
- Some attributespublic boolean process(ElementListener listener)
ElementListener
.public int type()
public java.util.ArrayList getChunks()
public boolean add(java.lang.Object o)
Object
to the List
.add
in interface TextElementArray
o
- the object to add.public void setIndentationLeft(float indentation)
indentation
- the new indentationpublic void setIndentationRight(float indentation)
indentation
- the new indentationpublic void setFirst(int first)
first
- a numberpublic void setFirst(char first)
first
- a letterpublic void setListSymbol(Chunk symbol)
symbol
- a Chunk
public void setListSymbol(java.lang.String symbol)
This is a shortcut for setListSymbol(Chunk symbol)
.
symbol
- a String
public java.util.ArrayList getItems()
ArrayList
containing ListItem
s.public int size()
size
public float leading()
leading
public boolean isNumbered()
true
if the list is numbered, false
otherwise.public float symbolIndent()
public Chunk symbol()
public int first()
public float indentationLeft()
public float indentationRight()
public static boolean isSymbol(java.lang.String tag)
tag
- the given tagpublic static boolean isTag(java.lang.String tag)
tag
- the given tagprivate java.lang.String nextLetter()
private int listItemsInList()
public void setMarkupAttribute(java.lang.String name, java.lang.String value)
MarkupAttributes
setMarkupAttribute
in interface MarkupAttributes
name
- String
attribute name.value
- String
attribute value.MarkupAttributes.setMarkupAttribute(java.lang.String, java.lang.String)
public void setMarkupAttributes(java.util.Properties markupAttributes)
MarkupAttributes
setMarkupAttributes
in interface MarkupAttributes
markupAttributes
- a Properties
-object containing markupattributesMarkupAttributes.setMarkupAttributes(java.util.Properties)
public java.lang.String getMarkupAttribute(java.lang.String name)
MarkupAttributes
getMarkupAttribute
in interface MarkupAttributes
name
- String
attribute name.String
.MarkupAttributes.getMarkupAttribute(java.lang.String)
public java.util.Set getMarkupAttributeNames()
MarkupAttributes
Set
of String
attribute names for the
MarkupAttributes
implementor.getMarkupAttributeNames
in interface MarkupAttributes
Set
.MarkupAttributes.getMarkupAttributeNames()
public java.util.Properties getMarkupAttributes()
MarkupAttributes
Properties
-object containing all the markupAttributes.getMarkupAttributes
in interface MarkupAttributes
Properties
MarkupAttributes.getMarkupAttributes()