Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Member Functions | Package Functions | Package Attributes | Static Package Attributes | Private Member Functions
CH.ifa.draw.util.ColorMap Class Reference

A map that is filled with some standard colors. More...

Collaboration diagram for CH.ifa.draw.util.ColorMap:
Collaboration graph
[legend]

List of all members.

Public Member Functions

int size ()
void addColor (String name, Color colour)
Color color (int index)
Color color (String name)
String name (int index)
int colorIndex (Color color)
boolean isTransparent (Color color)

Static Public Member Functions

static void reset ()
static ColorMap getColorMap ()

Package Functions

 ColorMap ()

Package Attributes

Vector fMap = null

Static Package Attributes

static ColorEntry defaultMap []
static ColorMap colorMap = null

Private Member Functions

void addColor (ColorEntry color)

Detailed Description

A map that is filled with some standard colors.

The colors can be looked up by name or index.

Definition at line 27 of file ColorMap.java.


Constructor & Destructor Documentation

CH.ifa.draw.util.ColorMap.ColorMap ( ) [inline, package]

Definition at line 53 of file ColorMap.java.

               {
       fMap = new Vector();
       for (int i = 0; i < defaultMap.length; i++)
           addColor(defaultMap[i]);
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

void CH.ifa.draw.util.ColorMap.addColor ( ColorEntry  color) [inline, private]

Definition at line 73 of file ColorMap.java.

                                            {
       fMap.addElement(color);
    }

Here is the caller graph for this function:

void CH.ifa.draw.util.ColorMap.addColor ( String  name,
Color  colour 
) [inline]

Definition at line 77 of file ColorMap.java.

                                                    {
       addColor(new ColorEntry(name, colour));
    }

Here is the call graph for this function:

Color CH.ifa.draw.util.ColorMap.color ( int  index) [inline]

Definition at line 81 of file ColorMap.java.

                                  {
       if (index < size() && index >= 0)
           return ((ColorEntry)fMap.elementAt(index)).fColor;
       
       throw new ArrayIndexOutOfBoundsException("Color index: " + index);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Color CH.ifa.draw.util.ColorMap.color ( String  name) [inline]

Definition at line 88 of file ColorMap.java.

                                    {
       Enumeration e = fMap.elements();
       while (e.hasMoreElements()) {
           ColorEntry ce = (ColorEntry)e.nextElement();
            if (ce.fName.equals(name))
                return ce.fColor;
       }
       return Color.black;
    }
int CH.ifa.draw.util.ColorMap.colorIndex ( Color  color) [inline]

Definition at line 105 of file ColorMap.java.

                                       {
       Enumeration e = fMap.elements();
       int i = 0;
       while (e.hasMoreElements()) {
           ColorEntry ce = (ColorEntry)e.nextElement();
            if (ce.fColor.equals(color))
                return i;
           i++;
       }
        return 0;
    }
static ColorMap CH.ifa.draw.util.ColorMap.getColorMap ( ) [inline, static]

Definition at line 63 of file ColorMap.java.

                                         {
       if (colorMap == null)
           colorMap = new ColorMap();
       return colorMap;
    }

Here is the call graph for this function:

boolean CH.ifa.draw.util.ColorMap.isTransparent ( Color  color) [inline]

Definition at line 117 of file ColorMap.java.

                                              {
        return color.equals(color("None"));
    }

Here is the call graph for this function:

String CH.ifa.draw.util.ColorMap.name ( int  index) [inline]

Definition at line 98 of file ColorMap.java.

                                  {
       if (index < size() && index >= 0)
           return ((ColorEntry)fMap.elementAt(index)).fName;
       
       throw new ArrayIndexOutOfBoundsException("Color index: " + index);
    }

Here is the call graph for this function:

static void CH.ifa.draw.util.ColorMap.reset ( ) [inline, static]

Definition at line 59 of file ColorMap.java.

                               {
       colorMap = null;
    }

Here is the caller graph for this function:

Definition at line 69 of file ColorMap.java.

                      {
       return fMap.size();
    }

Here is the caller graph for this function:


Member Data Documentation

ColorMap CH.ifa.draw.util.ColorMap.colorMap = null [static, package]

Definition at line 49 of file ColorMap.java.

Initial value:
 {
       
       
       new ColorEntry("None",          new Color(0xFFC79E)),
       new ColorEntry("White",         Color.white),
       new ColorEntry("Light Gray",    Color.lightGray),
       new ColorEntry("Gray",          Color.gray),
       new ColorEntry("Dark Gray",     Color.darkGray),
       new ColorEntry("Black",         Color.black),
       new ColorEntry("Blue",          Color.blue),
       new ColorEntry("Cyan",             Color.cyan),
       new ColorEntry("Green",         Color.green),
       new ColorEntry("Magenta",       Color.magenta),
       new ColorEntry("Orange",        Color.orange),
       new ColorEntry("Pink",          Color.pink),
       new ColorEntry("Red",           Color.red),
       new ColorEntry("Yellow",        Color.yellow),
    }

Definition at line 30 of file ColorMap.java.

Vector CH.ifa.draw.util.ColorMap.fMap = null [package]

Definition at line 51 of file ColorMap.java.


The documentation for this class was generated from the following file: