org.apache.poi.hssf.util
Class HSSFColor

java.lang.Object
  extended by org.apache.poi.hssf.util.HSSFColor
All Implemented Interfaces:
Color
Direct Known Subclasses:
HSSFColor.AQUA, HSSFColor.AUTOMATIC, HSSFColor.BLACK, HSSFColor.BLUE, HSSFColor.BLUE_GREY, HSSFColor.BRIGHT_GREEN, HSSFColor.BROWN, HSSFColor.CORAL, HSSFColor.CORNFLOWER_BLUE, HSSFColor.DARK_BLUE, HSSFColor.DARK_GREEN, HSSFColor.DARK_RED, HSSFColor.DARK_TEAL, HSSFColor.DARK_YELLOW, HSSFColor.GOLD, HSSFColor.GREEN, HSSFColor.GREY_25_PERCENT, HSSFColor.GREY_40_PERCENT, HSSFColor.GREY_50_PERCENT, HSSFColor.GREY_80_PERCENT, HSSFColor.INDIGO, HSSFColor.LAVENDER, HSSFColor.LEMON_CHIFFON, HSSFColor.LIGHT_BLUE, HSSFColor.LIGHT_CORNFLOWER_BLUE, HSSFColor.LIGHT_GREEN, HSSFColor.LIGHT_ORANGE, HSSFColor.LIGHT_TURQUOISE, HSSFColor.LIGHT_YELLOW, HSSFColor.LIME, HSSFColor.MAROON, HSSFColor.OLIVE_GREEN, HSSFColor.ORANGE, HSSFColor.ORCHID, HSSFColor.PALE_BLUE, HSSFColor.PINK, HSSFColor.PLUM, HSSFColor.RED, HSSFColor.ROSE, HSSFColor.ROYAL_BLUE, HSSFColor.SEA_GREEN, HSSFColor.SKY_BLUE, HSSFColor.TAN, HSSFColor.TEAL, HSSFColor.TURQUOISE, HSSFColor.VIOLET, HSSFColor.WHITE, HSSFColor.YELLOW

public class HSSFColor
extends java.lang.Object
implements Color

Intends to provide support for the very evil index to triplet issue and will likely replace the color constants interface for HSSF 2.0. This class contains static inner class members for representing colors. Each color has an index (for the standard palette in Excel (tm) ), native (RGB) triplet and string triplet. The string triplet is as the color would be represented by Gnumeric. Having (string) this here is a bit of a collision of function between HSSF and the HSSFSerializer but I think its a reasonable one in this case.


Nested Class Summary
static class HSSFColor.AQUA
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.AUTOMATIC
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.BLACK
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.BLUE_GREY
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.BRIGHT_GREEN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.BROWN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.CORAL
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.CORNFLOWER_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.DARK_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.DARK_GREEN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.DARK_RED
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.DARK_TEAL
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.DARK_YELLOW
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.GOLD
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.GREEN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.GREY_25_PERCENT
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.GREY_40_PERCENT
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.GREY_50_PERCENT
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.GREY_80_PERCENT
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.HSSFColorPredefined
          Predefined HSSFColors with their given palette index (and an optional 2nd index)
static class HSSFColor.INDIGO
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LAVENDER
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LEMON_CHIFFON
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIGHT_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIGHT_CORNFLOWER_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIGHT_GREEN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIGHT_ORANGE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIGHT_TURQUOISE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIGHT_YELLOW
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.LIME
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.MAROON
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.OLIVE_GREEN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.ORANGE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.ORCHID
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.PALE_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.PINK
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.PLUM
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.RED
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.ROSE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.ROYAL_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.SEA_GREEN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.SKY_BLUE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.TAN
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.TEAL
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.TURQUOISE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.VIOLET
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.WHITE
          Deprecated. use HSSFColor.HSSFColorPredefined instead
static class HSSFColor.YELLOW
          Deprecated. use HSSFColor.HSSFColorPredefined instead
 
Constructor Summary
HSSFColor()
          Creates a new instance of HSSFColor
HSSFColor(int index, int index2, java.awt.Color color)
           
 
Method Summary
 java.lang.String getHexString()
          returns colon-delimited hex string "0:0:0"
 short getIndex()
          returns color standard palette index
 short getIndex2()
          returns alternative color standard palette index
static java.util.Map<java.lang.Integer,HSSFColor> getIndexHash()
          This function returns all the colours in an unmodifiable Map.
static java.util.Map<java.lang.Integer,HSSFColor> getMutableIndexHash()
          This function returns all the Colours, stored in a Map that can be edited.
 short[] getTriplet()
          returns RGB triplet (0, 0, 0)
static java.util.Map<java.lang.String,HSSFColor> getTripletHash()
          this function returns all colors in a hastable.
static HSSFColor toHSSFColor(Color color)
          Checked type cast color to an HSSFColor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HSSFColor

public HSSFColor()
Creates a new instance of HSSFColor


HSSFColor

public HSSFColor(int index,
                 int index2,
                 java.awt.Color color)
Method Detail

getIndexHash

public static final java.util.Map<java.lang.Integer,HSSFColor> getIndexHash()
This function returns all the colours in an unmodifiable Map. The map is cached on first use.

Returns:
a Map containing all colours keyed by Integer excel-style palette indexes

getMutableIndexHash

public static final java.util.Map<java.lang.Integer,HSSFColor> getMutableIndexHash()
This function returns all the Colours, stored in a Map that can be edited. No caching is performed. If you don't need to edit the table, then call getIndexHash() which returns a statically cached imuatable map of colours.


getTripletHash

public static java.util.Map<java.lang.String,HSSFColor> getTripletHash()
this function returns all colors in a hastable. Its not implemented as a static member/staticly initialized because that would be dirty in a server environment as it is intended. This means you'll eat the time it takes to create it once per request but you will not hold onto it if you have none of those requests.

Returns:
a Map containing all colors keyed by String gnumeric-like triplets

getIndex

public short getIndex()
returns color standard palette index

Returns:
index to the standard palette

getIndex2

public short getIndex2()
returns alternative color standard palette index

Returns:
alternative index to the standard palette, if -1 this index is not defined

getTriplet

public short[] getTriplet()
returns RGB triplet (0, 0, 0)

Returns:
triplet representation like that in Excel

getHexString

public java.lang.String getHexString()
returns colon-delimited hex string "0:0:0"

Returns:
a hex string exactly like a gnumeric triplet

toHSSFColor

public static HSSFColor toHSSFColor(Color color)
Checked type cast color to an HSSFColor.

Parameters:
color - the color to type cast
Returns:
the type casted color
Throws:
java.lang.IllegalArgumentException - if color is null or is not an instance of HSSFColor