org.odftoolkit.simple.text.list
Class ListItem

java.lang.Object
  extended by org.odftoolkit.simple.text.list.ListItem
All Implemented Interfaces:
ListContainer

public class ListItem
extends Object
implements ListContainer

ListItem represents an item in a list. ListItem can have text content or sub List.

Since:
0.4

Method Summary
 List addList()
          Add a new List to this container.
 List addList(ListDecorator decorator)
          Add a List with specified ListDecorator to this container.
 void clearList()
          Remove all Lists from this container.
 int getIndex()
          Answers the index of the item in its owner list.
 OdfElement getListContainerElement()
          Get the ODF element which can have as child element directly according to ODF specification.
 Iterator<List> getListIterator()
          Return an Iterator of the Lists in this ListContainer.
 String getNumberFormat()
          Get the number format of this item.
 TextListItemElement getOdfElement()
          Get the instance of TextListItemElement which represents this list item.
 List getOwnerList()
          Get the List which contains this ListItem.
 Integer getStartNumber()
          Get the start number of this item.
 String getTextContent()
          Get item text content.
 void remove()
          Remove this item from its owner list.
 boolean removeList(List list)
          Remove the existing List from this container.
 void setNumberFormat(String format)
          Set the number format of this item.
 void setStartNumber(Integer number)
          Set the start number of this item.
 void setTextContent(String content)
          Set item text content.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getOdfElement

public TextListItemElement getOdfElement()
Get the instance of TextListItemElement which represents this list item.

Returns:
the instance of TextListItemElement

getTextContent

public String getTextContent()
Get item text content. If this item has a List, its content is not included.

Returns:
the text content of this item

setTextContent

public void setTextContent(String content)
Set item text content.

Parameters:
content - item text content.

remove

public void remove()
Remove this item from its owner list.


getStartNumber

public Integer getStartNumber()
Get the start number of this item.

A value can be specified that restarts numbering of a list at the current item. This feature can only be applied to items in a list with a numbering list style.

Returns:
the start number of this item. If there is no start number setting on this item or the owner list is not a numbering list, null will be returned.

setStartNumber

public void setStartNumber(Integer number)
Set the start number of this item.

A value can be specified that restarts numbering of a list at the current item. This feature can only be applied to items in a list with a numbering list style.

Parameters:
number - the start number to be set.
Throws:
IllegalArgumentException - if number < 0.

getNumberFormat

public String getNumberFormat()
Get the number format of this item.

List item can contain the text of a formatted number which is present when a list style is applied to an element whose corresponding list level style specifies that the list label is a number. This text may be used by consumers that do not support the automatic generation of numbering but should be ignored by consumers that do support it.


setNumberFormat

public void setNumberFormat(String format)
Set the number format of this item.

List item can contain the text of a formatted number which is present when a list style is applied to an element whose corresponding list level style specifies that the list label is a number. This text may be used by consumers that do not support the automatic generation of numbering but should be ignored by consumers that do support it.

Parameters:
format - the number format to be set.

getIndex

public int getIndex()
Answers the index of the item in its owner list.

Returns:
index of the item.

getOwnerList

public List getOwnerList()
Get the List which contains this ListItem.


toString

public String toString()
Overrides:
toString in class Object

getListContainerElement

public OdfElement getListContainerElement()
Description copied from interface: ListContainer
Get the ODF element which can have as child element directly according to ODF specification. This Element will help to find the position to insert a new List. For example, element is usable with element, so TextDocument will return OfficeTextElement. While Presentation Notes is an indirectly ListContainer, which holds List with the help of its grand-child element , so for Notes, DrawTextBoxElement should be return.

Specified by:
getListContainerElement in interface ListContainer
Returns:
container element which can hold .

addList

public List addList()
Description copied from interface: ListContainer
Add a new List to this container.

Specified by:
addList in interface ListContainer
Returns:
added list.

addList

public List addList(ListDecorator decorator)
Description copied from interface: ListContainer
Add a List with specified ListDecorator to this container.

Specified by:
addList in interface ListContainer
Parameters:
decorator - the specified ListDecorator
Returns:
added list.

clearList

public void clearList()
Description copied from interface: ListContainer
Remove all Lists from this container.

Specified by:
clearList in interface ListContainer

getListIterator

public Iterator<List> getListIterator()
Description copied from interface: ListContainer
Return an Iterator of the Lists in this ListContainer. The Lists are iterated in the same order that they occur in the ListContainer.

Specified by:
getListIterator in interface ListContainer
Returns:
an Iterator of the Lists in this ListContainer
See Also:
Iterator

removeList

public boolean removeList(List list)
Description copied from interface: ListContainer
Remove the existing List from this container.

Specified by:
removeList in interface ListContainer
Returns:
true, if the container contains this List.


Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.