com.lowagie.text.rtf.list
Class RtfList

java.lang.Object
  extended by com.lowagie.text.rtf.RtfElement
      extended by com.lowagie.text.rtf.list.RtfList
All Implemented Interfaces:
RtfBasicElement, RtfExtendedElement

public class RtfList
extends RtfElement
implements RtfExtendedElement

The RtfList stores one List. It also provides the methods to write the list declaration and the list data.

Version:
$Id: RtfList.java 2825 2007-06-04 09:15:21Z blowagie $
Author:
Mark Hall (mhall@edu.uni-klu.ac.at), Thomas Bickel (tmb99@inode.at), Felix Satyaputra (f_satyaputra@yahoo.co.uk)

Field Summary
private  int alignment
          The alignment of this RtfList
private  java.lang.String bulletCharacter
          The text to use as the bullet character
private  int firstIndent
          The first indentation of this RtfList
private  RtfFont fontBullet
          The RtfFont for bulleted lists
private  RtfFont fontNumber
          The RtfFont for numbered lists
private  java.util.ArrayList items
          The subitems of this RtfList
private  int leftIndent
          The left indentation of this RtfList
private static byte[] LIST_BULLET
          Constant for the old bulleted list
private static byte[] LIST_LEVEL
          Constant for list level
private static byte[] LIST_LEVEL_ALIGNMENT
          Constant for list level alignment old
private static byte[] LIST_LEVEL_ALIGNMENT_NEW
          Constant for list level alignment new
private static byte[] LIST_LEVEL_FIRST_INDENT
          Constant for the first indentation
private static byte[] LIST_LEVEL_NUMBER
          Constant for the list level value
private static byte[] LIST_LEVEL_NUMBERS_BEGIN
          Constant for the beginning of the list level numbers
private static byte[] LIST_LEVEL_NUMBERS_END
          Constant for the end of the list level numbers
private static byte[] LIST_LEVEL_NUMBERS_NUMBERED
          Constant for the list level numbers
private static byte[] LIST_LEVEL_START_AT
          Constant for list level start at
private static byte[] LIST_LEVEL_STYLE_BULLETED_BEGIN
          Constant for the beginning of the list level bulleted style
private static byte[] LIST_LEVEL_STYLE_BULLETED_END
          Constant for the end of the list level bulleted style
private static byte[] LIST_LEVEL_STYLE_NUMBERED_BEGIN
          Constant for the beginning of the list level numbered style
private static byte[] LIST_LEVEL_STYLE_NUMBERED_END
          Constant for the end of the list level numbered style
private static byte[] LIST_LEVEL_SYMBOL_INDENT
          Constant for the symbol indentation
private static byte[] LIST_LEVEL_TEXT
          Constant for list level text
private static byte[] LIST_LEVEL_TYPE
          Constant for list level style old
private static byte[] LIST_LEVEL_TYPE_NEW
          Constant for list level style new
private static byte[] LIST_NUMBER_END
          Constant for the old list number end
private static byte[] LIST_TEXT
          Constant for the old list text
private static int LIST_TYPE_BULLET
           
private static int LIST_TYPE_LOWER_LETTERS
           
private static int LIST_TYPE_LOWER_ROMAN
           
private static int LIST_TYPE_NUMBERED
           
private static int LIST_TYPE_UPPER_LETTERS
           
private static int LIST_TYPE_UPPER_ROMAN
           
private  int listLevel
          The level of this RtfList
private  int listNumber
          The list number of this RtfList
private  int listType
          Whether this RtfList is numbered
private  RtfList parentList
          The parent List in multi-level lists.
private  int rightIndent
          The right indentation of this RtfList
private  int symbolIndent
          The symbol indentation of this RtfList
private static byte[] TAB
          Constant for a tab character
 
Fields inherited from class com.lowagie.text.rtf.RtfElement
document, inHeader, inTable
 
Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR
 
Constructor Summary
RtfList(RtfDocument doc, List list)
          Constructs a new RtfList for the specified List.
 
Method Summary
protected  void correctIndentation()
          Correct the indentation of this RtfList by adding left/first line indentation from the parent RtfList.
private  int getFirstIndent()
          Get the first line indentation of this RtfList.
private  int getLeftIndent()
          Get the left indentation of this RtfList.
 int getListLevel()
          Gets the list level of this RtfList
 int getListNumber()
          Gets the id of this list
 void setInHeader(boolean inHeader)
          Sets whether this RtfList is in a header.
 void setInTable(boolean inTable)
          Sets whether this RtfList is in a table.
 void setListLevel(int listLevel)
          Sets the list level of this RtfList.
 void setListNumber(int listNumber)
          Sets the id of this list
protected  void setParent(RtfList parent)
          Sets the parent RtfList of this RtfList
 byte[] write()
          Deprecated. replaced by writeContent(OutputStream)
 void writeContent(java.io.OutputStream result)
          Writes the content of the RtfList
 byte[] writeDefinition()
          Deprecated. replaced by writeDefinition(OutputStream)
 void writeDefinition(java.io.OutputStream result)
          Writes the definition part of this list level
private  byte[] writeIndentations()
          Deprecated.  
private  void writeIndentations(java.io.OutputStream result)
           
protected  byte[] writeListBeginning()
          Writes the initialisation part of the RtfList
protected  byte[] writeListNumbers()
          Writes only the list number and list level number.
 
Methods inherited from class com.lowagie.text.rtf.RtfElement
intToByteArray, isInTable, setRtfDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.lowagie.text.rtf.RtfBasicElement
setRtfDocument
 

Field Detail

LIST_LEVEL

private static final byte[] LIST_LEVEL
Constant for list level


LIST_LEVEL_TYPE

private static final byte[] LIST_LEVEL_TYPE
Constant for list level style old


LIST_LEVEL_TYPE_NEW

private static final byte[] LIST_LEVEL_TYPE_NEW
Constant for list level style new


LIST_LEVEL_ALIGNMENT

private static final byte[] LIST_LEVEL_ALIGNMENT
Constant for list level alignment old


LIST_LEVEL_ALIGNMENT_NEW

private static final byte[] LIST_LEVEL_ALIGNMENT_NEW
Constant for list level alignment new


LIST_LEVEL_START_AT

private static final byte[] LIST_LEVEL_START_AT
Constant for list level start at


LIST_LEVEL_TEXT

private static final byte[] LIST_LEVEL_TEXT
Constant for list level text


LIST_LEVEL_STYLE_NUMBERED_BEGIN

private static final byte[] LIST_LEVEL_STYLE_NUMBERED_BEGIN
Constant for the beginning of the list level numbered style


LIST_LEVEL_STYLE_NUMBERED_END

private static final byte[] LIST_LEVEL_STYLE_NUMBERED_END
Constant for the end of the list level numbered style


LIST_LEVEL_STYLE_BULLETED_BEGIN

private static final byte[] LIST_LEVEL_STYLE_BULLETED_BEGIN
Constant for the beginning of the list level bulleted style


LIST_LEVEL_STYLE_BULLETED_END

private static final byte[] LIST_LEVEL_STYLE_BULLETED_END
Constant for the end of the list level bulleted style


LIST_LEVEL_NUMBERS_BEGIN

private static final byte[] LIST_LEVEL_NUMBERS_BEGIN
Constant for the beginning of the list level numbers


LIST_LEVEL_NUMBERS_NUMBERED

private static final byte[] LIST_LEVEL_NUMBERS_NUMBERED
Constant for the list level numbers


LIST_LEVEL_NUMBERS_END

private static final byte[] LIST_LEVEL_NUMBERS_END
Constant for the end of the list level numbers


LIST_LEVEL_FIRST_INDENT

private static final byte[] LIST_LEVEL_FIRST_INDENT
Constant for the first indentation


LIST_LEVEL_SYMBOL_INDENT

private static final byte[] LIST_LEVEL_SYMBOL_INDENT
Constant for the symbol indentation


LIST_LEVEL_NUMBER

private static final byte[] LIST_LEVEL_NUMBER
Constant for the list level value


TAB

private static final byte[] TAB
Constant for a tab character


LIST_TEXT

private static final byte[] LIST_TEXT
Constant for the old list text


LIST_NUMBER_END

private static final byte[] LIST_NUMBER_END
Constant for the old list number end


LIST_BULLET

private static final byte[] LIST_BULLET
Constant for the old bulleted list


LIST_TYPE_BULLET

private static final int LIST_TYPE_BULLET
See Also:
Constant Field Values

LIST_TYPE_NUMBERED

private static final int LIST_TYPE_NUMBERED
See Also:
Constant Field Values

LIST_TYPE_UPPER_LETTERS

private static final int LIST_TYPE_UPPER_LETTERS
See Also:
Constant Field Values

LIST_TYPE_LOWER_LETTERS

private static final int LIST_TYPE_LOWER_LETTERS
See Also:
Constant Field Values

LIST_TYPE_UPPER_ROMAN

private static final int LIST_TYPE_UPPER_ROMAN
See Also:
Constant Field Values

LIST_TYPE_LOWER_ROMAN

private static final int LIST_TYPE_LOWER_ROMAN
See Also:
Constant Field Values

items

private java.util.ArrayList items
The subitems of this RtfList


listLevel

private int listLevel
The level of this RtfList


firstIndent

private int firstIndent
The first indentation of this RtfList


leftIndent

private int leftIndent
The left indentation of this RtfList


rightIndent

private int rightIndent
The right indentation of this RtfList


symbolIndent

private int symbolIndent
The symbol indentation of this RtfList


listNumber

private int listNumber
The list number of this RtfList


listType

private int listType
Whether this RtfList is numbered


fontNumber

private RtfFont fontNumber
The RtfFont for numbered lists


fontBullet

private RtfFont fontBullet
The RtfFont for bulleted lists


alignment

private int alignment
The alignment of this RtfList


parentList

private RtfList parentList
The parent List in multi-level lists.


bulletCharacter

private java.lang.String bulletCharacter
The text to use as the bullet character

Constructor Detail

RtfList

public RtfList(RtfDocument doc,
               List list)
Constructs a new RtfList for the specified List.

Parameters:
doc - The RtfDocument this RtfList belongs to
list - The List this RtfList is based on
Method Detail

writeIndentations

private byte[] writeIndentations()
Deprecated. 

Returns:
a byte array

writeIndentations

private void writeIndentations(java.io.OutputStream result)
                        throws java.io.IOException
Throws:
java.io.IOException

writeDefinition

public byte[] writeDefinition()
Deprecated. replaced by writeDefinition(OutputStream)

Writes the definition part of this list level

Specified by:
writeDefinition in interface RtfExtendedElement
Returns:
A byte array containing the definition of this list level

writeDefinition

public void writeDefinition(java.io.OutputStream result)
                     throws java.io.IOException
Writes the definition part of this list level

Specified by:
writeDefinition in interface RtfExtendedElement
Throws:
java.io.IOException

writeListBeginning

protected byte[] writeListBeginning()
Writes the initialisation part of the RtfList

Returns:
A byte array containing the initialisation part

writeListNumbers

protected byte[] writeListNumbers()
Writes only the list number and list level number.

Returns:
The list number and list level number of this RtfList.

write

public byte[] write()
Deprecated. replaced by writeContent(OutputStream)

Writes the content of the RtfList

Specified by:
write in interface RtfBasicElement
Specified by:
write in class RtfElement
Returns:
A byte array containing the actual content of the RtfList

writeContent

public void writeContent(java.io.OutputStream result)
                  throws java.io.IOException
Writes the content of the RtfList

Specified by:
writeContent in interface RtfBasicElement
Overrides:
writeContent in class RtfElement
Throws:
java.io.IOException

getListLevel

public int getListLevel()
Gets the list level of this RtfList

Returns:
Returns the list level.

setListLevel

public void setListLevel(int listLevel)
Sets the list level of this RtfList. A list level > 0 will unregister this RtfList from the RtfListTable

Parameters:
listLevel - The list level to set.

setParent

protected void setParent(RtfList parent)
Sets the parent RtfList of this RtfList

Parameters:
parent - The parent RtfList to use.

getListNumber

public int getListNumber()
Gets the id of this list

Returns:
Returns the list number.

setListNumber

public void setListNumber(int listNumber)
Sets the id of this list

Parameters:
listNumber - The list number to set.

setInTable

public void setInTable(boolean inTable)
Sets whether this RtfList is in a table. Sets the correct inTable setting for all child elements.

Specified by:
setInTable in interface RtfBasicElement
Overrides:
setInTable in class RtfElement
Parameters:
inTable - True if this RtfList is in a table, false otherwise

setInHeader

public void setInHeader(boolean inHeader)
Sets whether this RtfList is in a header. Sets the correct inTable setting for all child elements.

Specified by:
setInHeader in interface RtfBasicElement
Overrides:
setInHeader in class RtfElement
Parameters:
inHeader - True if this RtfList is in a header, false otherwise

correctIndentation

protected void correctIndentation()
Correct the indentation of this RtfList by adding left/first line indentation from the parent RtfList. Also calls correctIndentation on all child RtfLists.


getLeftIndent

private int getLeftIndent()
Get the left indentation of this RtfList.

Returns:
The left indentation.

getFirstIndent

private int getFirstIndent()
Get the first line indentation of this RtfList.

Returns:
The first line indentation.