ru.novosoft.dc.rtf.dom
Class ColorTable

java.lang.Object
  |
  +--ru.novosoft.dc.rtf.dom.ColorTable

public class ColorTable
extends java.lang.Object

RTF color table. Contains a table of colors and the boolean tag marking the case when 0th color is the "auto" color.


Field Summary
static RTFColor black
          Black color
static RTFColor white
          White color
 
Constructor Summary
ColorTable(int initialCapacity)
          Construct an empty color table of the specified initial capacity.
 
Method Summary
 void addColor(RTFColor color)
          Add a new color to the end of the color table.
 RTFColor color(int index)
          Return a color at the specified position of color table.
 void exportTo(org.w3c.dom.Element elem)
          Export the contents of this object to the specified DOM element.
 boolean hasAutoColor()
          Return true, if the color table has an auto color of 0th index.
 void setAutoColor(boolean value)
          Set "auto" tag value.
 int size()
          Return a number of colors in the color table.
 java.lang.String toString()
          Return representation of the color table as ANSI string.
 void trimToSize()
          Trim the color table to its size (remove unused entries).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

black

public static final RTFColor black
Black color

white

public static final RTFColor white
White color
Constructor Detail

ColorTable

public ColorTable(int initialCapacity)
Construct an empty color table of the specified initial capacity. The "auto" tag is set to false.
Method Detail

addColor

public final void addColor(RTFColor color)
Add a new color to the end of the color table.

color

public final RTFColor color(int index)
Return a color at the specified position of color table. Throws ArrayIndexOutOfBoundsException if the index points to unspecified color (index<0 or index>=size()).

setAutoColor

public final void setAutoColor(boolean value)
Set "auto" tag value.

hasAutoColor

public final boolean hasAutoColor()
Return true, if the color table has an auto color of 0th index.

size

public final int size()
Return a number of colors in the color table.

trimToSize

public final void trimToSize()
Trim the color table to its size (remove unused entries).

toString

public java.lang.String toString()
Return representation of the color table as ANSI string.
Overrides:
toString in class java.lang.Object

exportTo

public void exportTo(org.w3c.dom.Element elem)
Export the contents of this object to the specified DOM element.