ucar.unidata.ui.symbol
Class ColorMap

java.lang.Object
  extended by ucar.unidata.ui.symbol.ColorMap
Direct Known Subclasses:
ShapeMap

public class ColorMap
extends Object

This defines a mapping from a pattern to a color. The pattern is the value of a text point obs field.

Version:
$Revision: 1.6 $
Author:
Metapps development team

Constructor Summary
ColorMap()
          Default ctor
ColorMap(String pattern, Color c)
          ctor
 
Method Summary
 void applyProperties()
          Apply the properties
static List applyProperties(List mappings)
          Utility to call apply properties to a list of ColorMap-s This will return the ones that actually have a pattern.
 Color getColor()
          Get the Color property.
 JComponent getColorWidget()
          Make the color widget
 Real[] getNumericRange()
          tokenize the pattern string as a numeric range
 String getPattern()
          Get the Pattern property.
 JTextField getPatternWidget()
          Pattern widget
 JComponent[] getSwatchComps()
          Get the color swatch components
 boolean hasPattern()
          Do we have a non-zero length, non-null pattern
 boolean isNumericRange()
          is the pattern string actually a numeric range of the form min,max
 boolean match(Data value)
          Does the pattern match the given value
 void setColor(Color value)
          Set the Color property.
 void setPattern(String value)
          Set the Pattern property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorMap

public ColorMap()
Default ctor


ColorMap

public ColorMap(String pattern,
                Color c)
ctor

Parameters:
pattern - The pattern
c - The color
Method Detail

applyProperties

public static List applyProperties(List mappings)
Utility to call apply properties to a list of ColorMap-s This will return the ones that actually have a pattern. This way the properties dialog for the symbol can prune out the ones that the user removed.

Parameters:
mappings - List of ColorMap-s
Returns:
The list of ColorMaps-s that actually have a pattern.

applyProperties

public void applyProperties()
Apply the properties


getSwatchComps

public JComponent[] getSwatchComps()
Get the color swatch components

Returns:
color swatch components

getColorWidget

public JComponent getColorWidget()
Make the color widget

Returns:
color widget

getPatternWidget

public JTextField getPatternWidget()
Pattern widget

Returns:
Pattern widget

hasPattern

public boolean hasPattern()
Do we have a non-zero length, non-null pattern

Returns:
Has a pattern

isNumericRange

public boolean isNumericRange()
is the pattern string actually a numeric range of the form min,max

Returns:
is numeric range

getNumericRange

public Real[] getNumericRange()
                       throws Exception
tokenize the pattern string as a numeric range

Returns:
min max range values
Throws:
Exception - On badness

match

public boolean match(Data value)
              throws Exception
Does the pattern match the given value

Parameters:
value - value to check
Returns:
Pattern matches value
Throws:
Exception

setPattern

public void setPattern(String value)
Set the Pattern property.

Parameters:
value - The new value for Pattern

getPattern

public String getPattern()
Get the Pattern property.

Returns:
The Pattern

setColor

public void setColor(Color value)
Set the Color property.

Parameters:
value - The new value for Color

getColor

public Color getColor()
Get the Color property.

Returns:
The Color