org.odftoolkit.simple.text.list
public class List extends Object
Constructor and Description |
---|
List(ListContainer container)
Constructor with ListContainer only.
|
List(ListContainer container,
ListDecorator decorator)
Constructor with ListContainer and ListDecorator.
|
List(ListContainer container,
String header,
boolean isContinueNumbering,
ListDecorator decorator)
Constructor with ListContainer, ListDecorator, header and numbering setting.
|
List(ListContainer container,
String header,
ListDecorator decorator)
Constructor with ListContainer, ListDecorator and header.
|
List(ListContainer container,
String header,
List continueList,
ListDecorator decorator)
Constructor with ListContainer, ListDecorator, header and continued list
|
Modifier and Type | Method and Description |
---|---|
ListItem |
addItem(int location,
ListItem item)
Insert a ListItem at the specified location.
|
ListItem |
addItem(int location,
String itemContent)
Insert the specified ListItem at the specified location.
|
ListItem |
addItem(ListItem item)
Add the specified list item in ListItem object.
|
ListItem |
addItem(String itemContent)
Add a list item by specifying a string value.
|
List<ListItem> |
addItems(int location,
ListItem[] items)
Insert the list items at the certain location
by specifying an array of ListItem.
|
List<ListItem> |
addItems(int location,
String[] items)
Insert the list items at the specified location in this List
by giving an array of string values.
|
List<ListItem> |
addItems(ListItem[] items)
Add list items by specifying an array of ListItem.
|
List<ListItem> |
addItems(String[] items)
Add list items by specifying an array of string values.
|
void |
clear()
Remove all items from this List.
|
List |
getContinueList()
Get the preceding list whose numbering is continued by this list.
|
String |
getHeader()
Get the header of this list.
|
ListItem |
getItem(int location)
Return the item at the specified location in this List.
|
List<ListItem> |
getItems()
Get all of the list items.
|
int |
getLevel()
Get the level of this list.
|
TextListElement |
getOdfElement()
Get the instance of TextListElement which represents this list.
|
ListDecorator.ListType |
getType()
Get the type of this list.
|
boolean |
isContinueNumbering()
Return whether the numbering of this list is continuing,
or whether the numbering of the preceding list is continued or not.
|
void |
remove()
Remove this list from its container.
|
boolean |
removeItem(int location)
Remove the item at the specified location from this List.
|
boolean |
removeItem(ListItem item)
Remove the specified item from this List.
|
boolean |
removeItems(List<ListItem> items)
Remove all the items in the collection from this list
|
ListItem |
set(int location,
ListItem item)
Replace the item at the specified location in this List with the
specified item.
|
ListItem |
set(int location,
String itemContent)
Replace the item at the specified location in this List with the
specified item content.
|
void |
setContinueList(List continueList)
Set the list whose numbering is continued by this list.
|
void |
setContinueNumbering(boolean isContinueNumbering)
Set whether the numbering of the preceding list is continued or not.
|
void |
setDecorator(ListDecorator decorator)
Set the ListDecorator of this list.
|
void |
setHeader(String header)
Set the header of this list.
|
int |
size()
Return the number of direct child items in this List.
|
String |
toString() |
public List(ListContainer container)
container
- the container in where this list will be appended.public List(ListContainer container, ListDecorator decorator)
container
- the container in where this list will be appended.decorator
- the ListDecorator of this list.public List(ListContainer container, String header, ListDecorator decorator)
container
- the container in where this list will be appended.decorator
- the ListDecorator of this list.header
- the header of this list.public List(ListContainer container, String header, boolean isContinueNumbering, ListDecorator decorator)
container
- the container in where this list will be appended.decorator
- the ListDecorator of this list.isContinueNumbering
- If isContinueNumbering
is true, the numbering of this list is
continuing, otherwise the numbering of this list starts from the beginning.header
- the header of this list.public List(ListContainer container, String header, List continueList, ListDecorator decorator)
container
- the container in where this list will be appended.decorator
- the ListDecorator of this list.continueList
- the continued list of this list.header
- the header of this list.public ListDecorator.ListType getType()
public String getHeader()
public void setHeader(String header)
header
- the header to be set.public void setDecorator(ListDecorator decorator)
This is a useful method which can change the list type and style, even though it has been created.
decorator
- the ListDecorator to be used.public ListItem addItem(String itemContent)
itemContent
- the list item content to be added.public ListItem addItem(int location, String itemContent)
location
- the index to insert. The start number is 0.itemContent
- the list item content to be added.IndexOutOfBoundsException
- when the location
is out of the List range.public ListItem addItem(ListItem item)
item
- the list item to be added.public ListItem addItem(int location, ListItem item)
location
- the index to insert.item
- the list item to add.IndexOutOfBoundsException
- when the location
is out of the List range.public List<ListItem> addItems(String[] items)
items
- the list items to be added.public List<ListItem> addItems(int location, String[] items)
location
- the index to insert.items
- the collection of list item contents.IndexOutOfBoundsException
- when the location
is out of the List range.public List<ListItem> addItems(ListItem[] items)
items
- the list items to be added.public List<ListItem> addItems(int location, ListItem[] items)
location
- the index to insert.items
- the collection of items.IndexOutOfBoundsException
- when the location
is out of the List range.public ListItem getItem(int location)
location
- the index of the element to be returned.IndexOutOfBoundsException
- when the location
is out of the List range.public int size()
public ListItem set(int location, ListItem item)
location
- the index to put the specified item.item
- the new item to be added.IndexOutOfBoundsException
- when the location
is out of the List range.public ListItem set(int location, String itemContent)
location
- the index to insert. The start number is 0.itemContent
- the list item content to be added.IndexOutOfBoundsException
- when the location
is out of the List range.public boolean removeItem(int location)
location
- the index of the item to be removed.IndexOutOfBoundsException
- when the location
is out of the List range.public boolean removeItem(ListItem item)
item
- the item to be removed.public boolean removeItems(List<ListItem> items)
items
- the collection of items to be removed.public void clear()
public void remove()
public boolean isContinueNumbering()
public void setContinueNumbering(boolean isContinueNumbering)
setContinueList(List)
to set this attribute. This method is
a easy way to set a list continue numbering, while
setContinueList(List)
is an advance way to set a list
numbering. For example, there are three lists ListA, ListB and ListC in
order. If the user call set ListC.setContinueNumbering, the first list
item in ListC is the number of the last item in ListB incremented by one.
It easy, no need to get the reference of ListB. While if the user need
the first list item in ListC is the number of the last item in ListA
incremented by one, he must use ListC.setContinueList(ListA).isContinueNumbering
- If isContinueNumbering
is true, and
text:continue-list attribute is not present and the numbering
style of the preceding list is the same as the current list,
the number of the first list item in the current list is the
number of the last item in the preceding list incremented by
one.the list is continue numbering, otherwise if the
text:continue-list attribute is not present, the numbering of
the preceding list is not continued.setContinueList(List)
public List getContinueList()
Now only support to get the continued list reference in the same ListContainer and the same Level.
public void setContinueList(List continueList)
continueList
- the continued list of this list.setContinueNumbering(boolean)
public int getLevel()
Every list has a list level. If a list is not contained in another list, its list level is 1. If a list is contained within another list, the list level of the contained list is the list level of the list in which it is contained incremented by one. If a list is contained in a table cell or text box, its list level returns to 1, even though the table or text box may be nested in another list. Every list with a list level of 1 defines a list and the counter domain for its list items and any sub list of that list. Each sub list starts a counter for its list items and any sub list it may contain.
public TextListElement getOdfElement()
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.