Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jfor.jfor.rtflib.rtfdoc
Class RtfColorTable  view RtfColorTable download RtfColorTable.java

java.lang.Object
  extended byorg.jfor.jfor.rtflib.rtfdoc.RtfColorTable

public class RtfColorTable
extends java.lang.Object

Singelton of the RTF color table. This class was created for tag processing.


Field Summary
private static int BLUE
           
private  java.util.Hashtable colorIndex
          Index table for the colors
private  java.util.Vector colorTable
          Used colors to this vector
private static int GREEN
           
private static RtfColorTable instance
          Singelton instance
private  java.util.Hashtable namedColors
          Map of color names to color numbers
private static int RED
           
 
Constructor Summary
private RtfColorTable()
          Constructor.
 
Method Summary
private  void addColor(java.lang.Integer i)
          Adds a color to the table.
private  void addNamedColor(java.lang.String name, int colorNumber)
          define a named color for getColorNumber(String)
private  int determineColorLevel(int identifier, int color)
          Determines the color level from the identifier.
private  int determineIdentifier(int red, int green, int blue)
          Determines a identifier for the color.
 int getColorNumber(int red, int green, int blue)
          Gets the number of color in the color table
 java.lang.Integer getColorNumber(java.lang.String name)
          get the RTF number of a named color
static RtfColorTable getInstance()
          Singelton.
private  void init()
          Initialize the color table.
 void writeColors(RtfHeader header)
          Writes the color table in the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RED

private static int RED

GREEN

private static int GREEN

BLUE

private static int BLUE

instance

private static RtfColorTable instance
Singelton instance


colorIndex

private java.util.Hashtable colorIndex
Index table for the colors


colorTable

private java.util.Vector colorTable
Used colors to this vector


namedColors

private java.util.Hashtable namedColors
Map of color names to color numbers

Constructor Detail

RtfColorTable

private RtfColorTable()
Constructor.

Method Detail

getInstance

public static RtfColorTable getInstance()
Singelton.


init

private void init()
Initialize the color table.


addNamedColor

private void addNamedColor(java.lang.String name,
                           int colorNumber)
define a named color for getColorNumber(String)


getColorNumber

public java.lang.Integer getColorNumber(java.lang.String name)
get the RTF number of a named color


getColorNumber

public int getColorNumber(int red,
                          int green,
                          int blue)
Gets the number of color in the color table


writeColors

public void writeColors(RtfHeader header)
                 throws java.io.IOException
Writes the color table in the header.


addColor

private void addColor(java.lang.Integer i)
Adds a color to the table.


determineIdentifier

private int determineIdentifier(int red,
                                int green,
                                int blue)
Determines a identifier for the color.


determineColorLevel

private int determineColorLevel(int identifier,
                                int color)
Determines the color level from the identifier.