public class List extends Object implements TextElementArray, Indentable, IAccessibleElement
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 HashMap<PdfName,PdfObject> |
accessibleAttributes |
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<Element> |
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 PdfName |
role |
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, BODY, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CHAPTER, CHUNK, CREATIONDATE, CREATOR, DIV, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LANGUAGE, LIST, LISTITEM, MARKED, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, SECTION, SUBJECT, TITLE, WRITABLE_DIRECT, 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(Element o)
Adds an Element to the List .
|
boolean |
add(String s)
Adds a String to the List .
|
List |
cloneShallow() |
PdfObject |
getAccessibleAttribute(PdfName key)
Get the attribute of accessible element (everything in A dictionary + Lang , Alt , ActualText , E ).
|
HashMap<PdfName,PdfObject> |
getAccessibleAttributes()
Gets all the properties of accessible element.
|
List<Chunk> |
getChunks()
Gets all the chunks in this element.
|
int |
getFirst()
Gets the first number .
|
ListItem |
getFirstItem() |
AccessibleElementId |
getId() |
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<Element> |
getItems()
Gets all the items in the list.
|
ListItem |
getLastItem() |
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.
|
PdfName |
getRole()
Gets the role of the accessible element.
|
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 |
isInline() |
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.
|
protected void |
populateProperties(List clone) |
boolean |
process(ElementListener listener)
Processes the element by adding it (or the different parts) to an ElementListener .
|
void |
setAccessibleAttribute(PdfName key, PdfObject value)
Set the attribute of accessible element (everything in A dictionary + Lang , Alt , ActualText , E ).
|
void |
setAlignindent(boolean alignindent) |
void |
setAutoindent(boolean autoindent) |
void |
setFirst(int first)
Sets the number that has to come first in the list.
|
void |
setId(AccessibleElementId id) |
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 |
setRole(PdfName role)
Sets the role of the accessiblee element.
|
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 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
protected PdfName role
public List()
List
.
public List(float symbolIndent)
List
with a specific symbol indentation.
symbolIndent
- the symbol indentation
public List(boolean numbered)
List
.
numbered
- a boolean
public List(boolean numbered, boolean lettered)
List
.
numbered
- a boolean
lettered
- has the list to be 'numbered' with letters
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 boolean
symbolIndent
- the indentation that has to be used for the listsymbol
public List(boolean numbered, boolean lettered, float symbolIndent)
numbered
- has the list to be numbered?
lettered
- has the list to be 'numbered' with letters
symbolIndent
- the indentation of the symbol
public boolean process(ElementListener listener)
ElementListener
.
public int type()
public boolean add(String s)
String
to the List
.
s
- the element to add.
public boolean add(Element o)
Element
to the List
.
add
in interface TextElementArray
o
- the element to add.
public List cloneShallow()
protected void populateProperties(List clone)
public void normalizeIndentation()
public void setNumbered(boolean numbered)
numbered
- the numbered to set
public void setLettered(boolean lettered)
lettered
- the lettered to set
public void setLowercase(boolean uppercase)
uppercase
- the uppercase to set
public void setAutoindent(boolean autoindent)
autoindent
- the autoindent to set
public void setAlignindent(boolean alignindent)
alignindent
- the alignindent to set
public void setFirst(int first)
first
- a number
public 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)
setIndentationLeft
in interface Indentable
indentation
- the new indentation
public void setIndentationRight(float indentation)
setIndentationRight
in interface Indentable
indentation
- the new indentation
public void setSymbolIndent(float symbolIndent)
symbolIndent
- the symbolIndent to set
public ArrayList<Element> getItems()
ArrayList
containing ListItem
s.
public int size()
size
public boolean isEmpty()
true
if the list is empty.
true
if the list is empty
public 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()
getIndentationLeft
in interface Indentable
public float getIndentationRight()
getIndentationRight
in interface Indentable
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.
public ListItem getFirstItem()
public ListItem getLastItem()
public PdfObject getAccessibleAttribute(PdfName key)
IAccessibleElement
A
dictionary + Lang
, Alt
, ActualText
, E
).
getAccessibleAttribute
in interface IAccessibleElement
public void setAccessibleAttribute(PdfName key, PdfObject value)
IAccessibleElement
A
dictionary + Lang
, Alt
, ActualText
, E
).
setAccessibleAttribute
in interface IAccessibleElement
public HashMap<PdfName,PdfObject> getAccessibleAttributes()
IAccessibleElement
getAccessibleAttributes
in interface IAccessibleElement
public PdfName getRole()
IAccessibleElement
getRole
in interface IAccessibleElement
public void setRole(PdfName role)
IAccessibleElement
null
if you don't want to tag this element. Note that all child elements won't also be tagged.
setRole
in interface IAccessibleElement
public AccessibleElementId getId()
getId
in interface IAccessibleElement
public void setId(AccessibleElementId id)
setId
in interface IAccessibleElement
public boolean isInline()
isInline
in interface IAccessibleElement
Copyright © 1998–2019. All rights reserved.