Version: 1.1.1

org.biomoby.service.dashboard
Class GraphColours

java.lang.Object
  extended by org.biomoby.service.dashboard.GraphColours

public abstract class GraphColours
extends Object

This abstract class sets up and provides name-to-color and color-to-name mappings and some associated class methods.

Version:
1.2, 12 Jun 2001; Copyright 1996 - 2001 by AT&T Corp.
Author:
John Mocenigo , Research @ AT&T Labs

Field Summary
static Color defaultBackground
          The default background color (white).
static Color defaultColor
          The default color of last resort in all cases (black).
static Color defaultFontcolor
          The default font color (black).
static Color defaultForeground
          The default foreground color (black).
static Color defaultXOR
          The default XOR color (light gray).
 
Constructor Summary
GraphColours()
           
 
Method Summary
static void addColor(String name, Color color)
          Adds a color to the application color table.
static String getColorName(Color color)
          Return the name of the supplied color.
static Color getColour(String name, Color def)
          Return the color in the color table with the given name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultForeground

public static final Color defaultForeground
The default foreground color (black).


defaultBackground

public static final Color defaultBackground
The default background color (white).


defaultXOR

public static final Color defaultXOR
The default XOR color (light gray).


defaultFontcolor

public static final Color defaultFontcolor
The default font color (black).


defaultColor

public static final Color defaultColor
The default color of last resort in all cases (black).

Constructor Detail

GraphColours

public GraphColours()
Method Detail

addColor

public static void addColor(String name,
                            Color color)
                     throws IllegalArgumentException
Adds a color to the application color table. For search purposes, names are canonicalized by converting to lower case and stripping non-alphanumerics. A name must contains at least one alphabetic. Once in the table, colors can be set by name, and names can be retrieved by color (although a single color referred to by multiple names only causes the retrieval of the last name mapped to that color).

Parameters:
name - the name to be used to reference the color.
color - the Color value.
Throws:
IllegalArgumentException

getColour

public static Color getColour(String name,
                              Color def)
Return the color in the color table with the given name. If the name is parseable as a numeric color, use that Otherwise, If the color is not found, the supplied default is returned. If the supplied default is null, the class default is returned. The name search is case insensitive and looks at alphanumerics only.

Parameters:
name - the name of the color to be retrieved.
def - the color value to return if requested color is not found.
Returns:
the color matching the name or the default.

getColorName

public static String getColorName(Color color)
Return the name of the supplied color.

Parameters:
color - the color whose name is to be retrieved.
Returns:
the color's (most recently entered) name, if it is in the color table, or its HSB value string otherwise.

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010