public class List extends Object implements TextElementArray
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 |
---|---|
protected boolean |
alignindent
Indicates if the indentation of all the items has to be aligned.
|
static boolean |
ALPHABETICAL
a possible value for the lettered parameter
|
protected boolean |
autoindent
Indicates if the indentation has to be set automatically.
|
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
Indicates if the listsymbols are numerical or alphabetical.
|
protected ArrayList |
list
This is the
ArrayList containing the different ListItem s. |
protected boolean |
lowercase
Indicates if the listsymbols are lowercase or uppercase.
|
static boolean |
LOWERCASE
a possible value for the lettered parameter
|
protected boolean |
numbered
Indicates if the list has to be numbered.
|
static boolean |
NUMERICAL
a possible value for the lettered parameter
|
static boolean |
ORDERED
a possible value for the numbered parameter
|
protected String |
postSymbol
In case you are using numbered/lettered lists, this String is added after the number/letter.
|
protected String |
preSymbol
In case you are using numbered/lettered lists, this String is added before the number/letter.
|
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
|
static boolean |
UPPERCASE
a possible value for the lettered 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, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK
Constructor and Description |
---|
List()
Constructs a
List . |
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 . |
List(float symbolIndent)
Constructs a
List with a specific symbol indentation. |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object o)
Adds an
Object to the List . |
ArrayList |
getChunks()
Gets all the chunks in this element.
|
int |
getFirst()
Gets the first number .
|
float |
getIndentationLeft()
Gets the indentation of this paragraph on the left side.
|
float |
getIndentationRight()
Gets the indentation of this paragraph on the right side.
|
ArrayList |
getItems()
Gets all the items in the list.
|
String |
getPostSymbol()
Returns the String that is after a number or letter in the list symbol.
|
String |
getPreSymbol()
Returns the String that is before a number or letter in the list symbol.
|
Chunk |
getSymbol()
Gets the Chunk containing the symbol.
|
float |
getSymbolIndent()
Gets the symbol indentation.
|
float |
getTotalLeading()
Gets the leading of the first listitem.
|
boolean |
isAlignindent()
Checks if all the listitems should be aligned.
|
boolean |
isAutoindent()
Checks if the indentation of list items is done automatically.
|
boolean |
isContent()
Checks if this element is a content object.
|
boolean |
isEmpty()
Returns
true if the list is empty. |
boolean |
isLettered()
Checks if the list is lettered.
|
boolean |
isLowercase()
Checks if the list lettering is lowercase.
|
boolean |
isNestable()
Checks if this element is nestable.
|
boolean |
isNumbered()
Checks if the list is numbered.
|
void |
normalizeIndentation()
Makes sure all the items in the list have the same indentation.
|
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 |
setLettered(boolean lettered) |
void |
setListSymbol(Chunk symbol)
Sets the listsymbol.
|
void |
setListSymbol(String symbol)
Sets the listsymbol.
|
void |
setLowercase(boolean uppercase) |
void |
setNumbered(boolean numbered) |
void |
setPostSymbol(String postSymbol)
Sets the String that has to be added after a number or letter in the list symbol.
|
void |
setPreSymbol(String preSymbol)
Sets the String that has to be added before a number or letter in the list symbol.
|
void |
setSymbolIndent(float symbolIndent) |
int |
size()
Gets the size of the list.
|
int |
type()
Gets the type of the text element.
|
public static final boolean ORDERED
public static final boolean UNORDERED
public static final boolean NUMERICAL
public static final boolean ALPHABETICAL
public static final boolean UPPERCASE
public static final boolean LOWERCASE
protected ArrayList list
ArrayList
containing the different ListItem
s.protected boolean numbered
protected boolean lettered
protected boolean lowercase
protected boolean autoindent
protected boolean alignindent
protected int first
protected Chunk symbol
protected String preSymbol
protected String postSymbol
protected float indentationLeft
protected float indentationRight
protected float symbolIndent
public List()
List
.public List(float symbolIndent)
List
with a specific symbol indentation.symbolIndent
- the symbol indentationpublic List(boolean numbered)
List
.numbered
- a booleanpublic List(boolean numbered, boolean lettered)
List
.numbered
- a booleanlettered
- has the list to be 'numbered' with letterspublic 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 boolean process(ElementListener listener)
ElementListener
.public int type()
public ArrayList getChunks()
public boolean add(Object o)
Object
to the List
.add
in interface TextElementArray
o
- the object to add.public void normalizeIndentation()
public void setNumbered(boolean numbered)
numbered
- the numbered to setpublic void setLettered(boolean lettered)
lettered
- the lettered to setpublic void setLowercase(boolean uppercase)
uppercase
- the uppercase to setpublic void setAutoindent(boolean autoindent)
autoindent
- the autoindent to setpublic void setAlignindent(boolean alignindent)
alignindent
- the alignindent to setpublic void setFirst(int first)
first
- a numberpublic void setListSymbol(Chunk symbol)
symbol
- a Chunk
public void setListSymbol(String symbol)
This is a shortcut for setListSymbol(Chunk symbol)
.
symbol
- a String
public void setIndentationLeft(float indentation)
indentation
- the new indentationpublic void setIndentationRight(float indentation)
indentation
- the new indentationpublic void setSymbolIndent(float symbolIndent)
symbolIndent
- the symbolIndent to setpublic ArrayList getItems()
ArrayList
containing ListItem
s.public int size()
size
public boolean isEmpty()
true
if the list is empty.true
if the list is emptypublic float getTotalLeading()
leading
public boolean isNumbered()
true
if the list is numbered, false
otherwise.public boolean isLettered()
true
if the list is lettered, false
otherwise.public boolean isLowercase()
true
if it is lowercase, false
otherwise.public boolean isAutoindent()
public boolean isAlignindent()
public int getFirst()
public Chunk getSymbol()
public float getIndentationLeft()
public float getIndentationRight()
public float getSymbolIndent()
public boolean isContent()
Element
isContent
in interface Element
Element.isContent()
public boolean isNestable()
Element
isNestable
in interface Element
Element.isNestable()
public String getPostSymbol()
public void setPostSymbol(String postSymbol)
postSymbol
- the String that has to be added after a number or letter in the list symbol.public String getPreSymbol()
public void setPreSymbol(String preSymbol)
preSymbol
- the String that has to be added before a number or letter in the list symbol.Copyright © 2018. All rights reserved.