infovis.column.format
Class ColorFormat

java.lang.Object
  extended by java.text.Format
      extended by infovis.column.format.ColorFormat
All Implemented Interfaces:
Serializable, Cloneable

public class ColorFormat
extends Format

Format for parsing color name.

Version:
$Revision: 1.4 $
Author:
Jean-Daniel Fekete
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.text.Format
Format.Field
 
Constructor Summary
ColorFormat()
          Constructor.
 
Method Summary
 void addColor(String name, Color color)
          Adds a new named color name.
 void addColor(String name, int r, int g, int b)
          Adds a new named color given its RGB values.
 StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
          
 Color getColor(String name)
          Returns a color given its name.
static ColorFormat getInstance()
          Returns the instance of that format.
 Object parseObject(String source, ParsePosition pos)
          
static void setInstance(ColorFormat format)
          Sets the instance of that format.
 
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorFormat

public ColorFormat()
Constructor.

Method Detail

getInstance

public static ColorFormat getInstance()
Returns the instance of that format.

Returns:
the instance of that format.

setInstance

public static void setInstance(ColorFormat format)
Sets the instance of that format.

Parameters:
format - the format

addColor

public void addColor(String name,
                     Color color)
Adds a new named color name.

Parameters:
name - the name
color - the color

addColor

public void addColor(String name,
                     int r,
                     int g,
                     int b)
Adds a new named color given its RGB values.

Parameters:
name - the name
r - the red value
g - the green value
b - the blue value

getColor

public Color getColor(String name)
Returns a color given its name.

Parameters:
name - the name
Returns:
the color or null

format

public StringBuffer format(Object obj,
                           StringBuffer toAppendTo,
                           FieldPosition pos)

Specified by:
format in class Format

parseObject

public Object parseObject(String source,
                          ParsePosition pos)

Specified by:
parseObject in class Format


Copyright 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.