gishur.gui2.adapter
Class ColorNameAdapter

java.lang.Object
  |
  +--gishur.gui2.SourcePropertyAdapter
        |
        +--gishur.gui2.adapter.ObjectAdapter
              |
              +--gishur.gui2.adapter.ColorNameAdapter

public class ColorNameAdapter
extends ObjectAdapter

A SourcePropertyAdapter, that maps a palette of colors to specified names. The colors are read via another SourcePropertyAdapter.

Version:
1.0
Author:
Thomas Wolf

Constructor Summary
ColorNameAdapter(SourcePropertyAdapter source)
          Constructs a new ColorNameAdapter, which gets its colors from the given SourcePropertyAdapter.
ColorNameAdapter(SourcePropertyAdapter source, ColorNameAdapter base)
          Constructs a new ColorNameAdapter, which gets its colors from the given SourcePropertyAdapter.
 
Method Summary
 void add(java.awt.Color color, java.lang.String name)
          Maps the given Color to its name.
 void addDefaultColorPalette()
          Adds the default color palette.
 java.lang.Object getProperty(java.lang.String key, java.lang.Object source, PropertyStatusReader prop)
          Returns a property value with a given key using the source-object (and perhaps the given PropertyStatusReader).
 
Methods inherited from class gishur.gui2.adapter.ObjectAdapter
add, nullValue, setNullValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColorNameAdapter

public ColorNameAdapter(SourcePropertyAdapter source,
                        ColorNameAdapter base)
Constructs a new ColorNameAdapter, which gets its colors from the given SourcePropertyAdapter.
Parameters:
source - SourcePropertyAdapter to get colors
base - the ColorNameAdapter, which color table to share

ColorNameAdapter

public ColorNameAdapter(SourcePropertyAdapter source)
Constructs a new ColorNameAdapter, which gets its colors from the given SourcePropertyAdapter.
Parameters:
source - SourcePropertyAdapter to get colors
Method Detail

add

public void add(java.awt.Color color,
                java.lang.String name)
Maps the given Color to its name.
Parameters:
color - the Color
name - the name of the Color

addDefaultColorPalette

public void addDefaultColorPalette()
Adds the default color palette.

getProperty

public java.lang.Object getProperty(java.lang.String key,
                                    java.lang.Object source,
                                    PropertyStatusReader prop)
Returns a property value with a given key using the source-object (and perhaps the given PropertyStatusReader).
Overrides:
getProperty in class ObjectAdapter
Parameters:
key - the property name
source - the source object to use
prop - the PropertyStatusReader
Returns:
property value