com.sas.models
Class ColorNameList

com.sas.models.ColorNameList
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, AssociationListInterface, CollectionInterface, com.sas.collection.ContentsChangedSource, DictionaryInterface, OrderedCollectionInterface, Sortable, StaticCollectionInterface, StaticDictionaryInterface, StaticOrderedCollectionInterface, ComponentInterface, com.sas.DeepClonable, LinkPropertiesInterface, ModelInterface, com.sas.PublicClonable, com.sas.util.Countable, com.sas.util.Enumerable, com.sas.util.EventGateInterface, IndexedGetInterface, IndexedSetInterface, ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class ColorNameList
implements com.sas.PublicClonable

An associationlist of java.awt.SystemColor and com.sas.awt.Color objects as keys and name as values.


 

See Also:
Serialized Form

Field Summary
protected  boolean showSystemColors
           
 
Fields inherited from class com.sas.collection.AssociationList
items, keys
 
Fields inherited from class com.sas.collection.BaseCollection
allContentsChangedListeners, mappingObject
 
Constructor Summary
ColorNameList()
          The default constructor which fills the list with java defined com.sas.awt.Color and java.awt.SystemColor objects.
ColorNameList(boolean showSystemColors)
          This constructor fills the list with com.sas.awt.Color objects.
ColorNameList(boolean showColors, boolean showSystemColors)
          This constructor fills the list com.sas.awt.Color objects if showColors is true and adds java.awt.SystemColor objects if showSystemColors is true.
ColorNameList(java.util.Enumeration e)
          A constructor that takes enumeration of java.awt.Color or com.sas.awt.Color objects and creates a list based on that.
 
Method Summary
 void add(int hexValue)
          Add a Color object to this list only if the object does not exist.
 void add(java.lang.Object c)
          Add a color or system color object into this list only if the name is not in the list.
 void add(java.lang.String name, java.awt.Color c)
          Add a color name and a color object to this list only if the color is not in the list.
 void add(java.lang.String name, int hexValue)
          Add a color name and a color object to this list only if the color is not in the list.
 java.lang.Object clone()
          Create a copy of the current model
 java.awt.Color getColor(java.lang.String colorName)
          Return the Color corresponding to the name provided.
 java.lang.String getColorName(java.awt.Color color)
          Return the color name corresponding to the Color provided.
 java.util.Enumeration getColors()
          Returns an enumeration of com.sas.awt.Color and java.awt.SystemColor objects.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
 boolean getShowSystemColors()
          get the value of showSystemColors
 void setShowSystemColors(boolean bool)
          Flag indicating whether to include the java.awt.SystemColors in the list or not.
 
Methods inherited from class com.sas.collection.AssociationList
add, add, addItems, addItems, apply, applyToPairs, clone, contains, containsKey, count, count, countKey, dumpComponent, equals, equals, equals, fireContentsChanged, get, get, get, getIndex, getItems, getItems, getKey, getKey, getKey, getKeys, getKeys, getLastIndex, getPairs, getPairs, remove, removeAll, removeAll, removeAllAt, removeAt, removeAt, removeAt, set, set, set, setKey, setSize, sort, sort, toString, toString
 
Methods inherited from class com.sas.collection.BaseCollection
addContentsChangedListener, anyContentsChangedListeners, disableEvents, enableEvents, enableEvents, fireContentsChanged, map, removeContentsChangedListener, unmap
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, detachModel, detachView, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getRequiredInterfaces, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 
Methods inherited from interface com.sas.collection.ContentsChangedSource
addContentsChangedListener, removeContentsChangedListener
 
Methods inherited from interface com.sas.beans.PropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

showSystemColors

protected boolean showSystemColors
Constructor Detail

ColorNameList

public ColorNameList()
The default constructor which fills the list with java defined com.sas.awt.Color and java.awt.SystemColor objects.


ColorNameList

public ColorNameList(boolean showSystemColors)
This constructor fills the list with com.sas.awt.Color objects. The java.awt.SystemColor objects are added if the passed in flag is true.

Parameters:
showSystemColors - adds the java.awt.SystemColor if true.

ColorNameList

public ColorNameList(boolean showColors,
                     boolean showSystemColors)
This constructor fills the list com.sas.awt.Color objects if showColors is true and adds java.awt.SystemColor objects if showSystemColors is true.

Parameters:
showSystemColors - adds the java.awt.SystemColor if true.

ColorNameList

public ColorNameList(java.util.Enumeration e)
A constructor that takes enumeration of java.awt.Color or com.sas.awt.Color objects and creates a list based on that. If the enumeration is empty, an empty list is created. If the enumeration does not contain java.awt.Colors or com.sas.awt.Colors then creates an empty list.

Parameters:
Enumeration - of color and Systemcolor objects
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

add

public void add(java.lang.String name,
                int hexValue)
Add a color name and a color object to this list only if the color is not in the list.

Parameters:
name - Name of the color to be added.
hexValue - int referring to RGB value of the color

add

public void add(java.lang.String name,
                java.awt.Color c)
Add a color name and a color object to this list only if the color is not in the list.

Parameters:
name - Name of the color to be added.
c - java.awt.Color object

add

public void add(int hexValue)
Add a Color object to this list only if the object does not exist. It puts the RGB value as a default name.

Parameters:
hexValue - RGB value of the color to be added.

add

public void add(java.lang.Object c)
Add a color or system color object into this list only if the name is not in the list.

Specified by:
add in interface CollectionInterface
Overrides:
add in class AssociationList
Parameters:
Color - or system color object to be added.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a copy of the current model

Specified by:
clone in interface AssociationListInterface
Specified by:
clone in interface CollectionInterface
Specified by:
clone in interface DictionaryInterface
Specified by:
clone in interface OrderedCollectionInterface
Specified by:
clone in interface StaticCollectionInterface
Specified by:
clone in interface StaticDictionaryInterface
Specified by:
clone in interface StaticOrderedCollectionInterface
Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class AssociationList
Returns:
a clone of this association list.
Throws:
java.lang.CloneNotSupportedException - if the clone fails.

setShowSystemColors

public void setShowSystemColors(boolean bool)
Flag indicating whether to include the java.awt.SystemColors in the list or not.

Parameters:
boolean - indicating true or fals

getShowSystemColors

public boolean getShowSystemColors()
get the value of showSystemColors

Returns:
value of the show systemcolors attribute

getColor

public java.awt.Color getColor(java.lang.String colorName)
Return the Color corresponding to the name provided.

Parameters:
colorName - a String corresponding to an item in the hashtable. The String must be one of the items in this list. Otherwise, the color corresponding to "black" is returned as a default value.
Returns:
Color com.sas.awt.Color or java.awt.Systemcolor associated with colorName.
Throws:
java.util.NoSuchElementException - when there is no matching name in this list.

getColorName

public java.lang.String getColorName(java.awt.Color color)
Return the color name corresponding to the Color provided.

Returns:
String corresponding to an item in the hashtable. The String must be one of the items in this list.
Throws:
java.util.NoSuchElementException - when there is no matching Color in this list.

getColors

public java.util.Enumeration getColors()
Returns an enumeration of com.sas.awt.Color and java.awt.SystemColor objects.

Returns:
enumeration of com.sas.awt.Color and java.awt.systemcolor objects.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.