fcmodeler.attributes
Class ColorValue

java.lang.Object
  |
  +--fcmodeler.attributes.ColorValue
All Implemented Interfaces:
EdgeVisualAttributeValue, NodeVisualAttributeValue, VisualAttributeValue

public final class ColorValue
extends java.lang.Object
implements VisualAttributeValue, EdgeVisualAttributeValue, NodeVisualAttributeValue

A specific value of the color attribute. This class can represent both the color of an edge figure and the outline color of a node figure.

Since:
JDK1.3
Version:
$Revision: 1.2 $
Author:
Zach Cox

Constructor Summary
ColorValue()
          Creates a new ColorValue representing the color black.
ColorValue(java.awt.Color color)
          Creates a new ColorValue using the specified color.
ColorValue(java.lang.String color)
          Creates a new ColorValue using the specified string description.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this color value for equality.
 VisualAttribute getAttribute()
           
 java.awt.Color getColor()
          Returns the color used in this color value.
 int hashCode()
          Returns the hash code for this color value.
 void setEdgeValue(EdgeFigure figure)
          Sets the color of the specified edge figure to the color contained in this color value.
 void setNodeValue(NodeFigure figure)
          Sets the outline color of the specified node figure to the color contained in this color value.
 void setPermanentEdgeValue(EdgeFigure figure)
          Sets the permanent color of the specified edge figure to the color contained in this color value.
 void setPermanentNodeValue(NodeFigure figure)
          Sets the permanent outline color of the specified node figure to the color contained in this color value.
 java.lang.String toString()
          Returns a string representation of this color value.
static ColorValue valueOf(java.lang.String value)
          Returns a new ColorValue instance, created using the specified string description.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColorValue

public ColorValue()
Creates a new ColorValue representing the color black.

ColorValue

public ColorValue(java.awt.Color color)
Creates a new ColorValue using the specified color.
Parameters:
color - the color to be used in this color value.

ColorValue

public ColorValue(java.lang.String color)
Creates a new ColorValue using the specified string description. The string must either be a color name contained in ColorFactory or the rgb values for a color specified as "[red, green, blue]".
Parameters:
color - the string description of this color value.
Method Detail

equals

public boolean equals(java.lang.Object o)
Compares the specified object with this color value for equality.
Specified by:
equals in interface VisualAttributeValue
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared for equality with this color value.
Returns:
true if the specified object is equal to this color value.

getAttribute

public VisualAttribute getAttribute()
Specified by:
getAttribute in interface VisualAttributeValue

getColor

public java.awt.Color getColor()
Returns the color used in this color value.
Returns:
the color used in this color value.

hashCode

public int hashCode()
Returns the hash code for this color value.
Specified by:
hashCode in interface VisualAttributeValue
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code for this color value.

setEdgeValue

public void setEdgeValue(EdgeFigure figure)
Sets the color of the specified edge figure to the color contained in this color value.
Specified by:
setEdgeValue in interface EdgeVisualAttributeValue
Parameters:
figure - the edge figure to update.

setNodeValue

public void setNodeValue(NodeFigure figure)
Sets the outline color of the specified node figure to the color contained in this color value.
Specified by:
setNodeValue in interface NodeVisualAttributeValue
Parameters:
figure - the node figure to update.

setPermanentEdgeValue

public void setPermanentEdgeValue(EdgeFigure figure)
Sets the permanent color of the specified edge figure to the color contained in this color value.
Specified by:
setPermanentEdgeValue in interface EdgeVisualAttributeValue
Parameters:
figure - the edge figure to update.

setPermanentNodeValue

public void setPermanentNodeValue(NodeFigure figure)
Sets the permanent outline color of the specified node figure to the color contained in this color value.
Specified by:
setPermanentNodeValue in interface NodeVisualAttributeValue
Parameters:
figure - the node figure to update.

toString

public java.lang.String toString()
Returns a string representation of this color value.
Specified by:
toString in interface VisualAttributeValue
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this color value.

valueOf

public static ColorValue valueOf(java.lang.String value)
Returns a new ColorValue instance, created using the specified string description.
Parameters:
value - the string description to be used in creating the new ColorValue instance.
Returns:
the new ColorValue instance.