org.jhotdraw.figures
Class FigureAttributes

java.lang.Object
  extended by org.jhotdraw.figures.FigureAttributes
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class FigureAttributes
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A container for a figure's attributes. The attributes are stored as key/value pairs.

Version:
<$CURRENT_VERSION$>
See Also:
Figure, Serialized Form

Constructor Summary
FigureAttributes()
          Constructs the FigureAttributes.
 
Method Summary
 java.lang.Object clone()
          Clones the attributes.
 java.lang.Object get(FigureAttributeConstant attributeConstant)
          Gets the attribute with the given name.
 boolean hasDefined(FigureAttributeConstant attributeConstant)
          Tests if an attribute is defined.
 void read(StorableInput dr)
          Reads the attributes from a StorableInput.
static java.awt.Color readColor(StorableInput dr)
           
 void set(FigureAttributeConstant attributeConstant, java.lang.Object value)
          Sets the attribute with the given name and overwrites its previous value.
 void write(StorableOutput dw)
          Writes the attributes to a StorableInput.
static void writeColor(StorableOutput dw, java.lang.String colorName, java.awt.Color color)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FigureAttributes

public FigureAttributes()
Constructs the FigureAttributes.

Method Detail

get

public java.lang.Object get(FigureAttributeConstant attributeConstant)
Gets the attribute with the given name.

Returns:
attribute or null if the key is not defined

set

public void set(FigureAttributeConstant attributeConstant,
                java.lang.Object value)
Sets the attribute with the given name and overwrites its previous value.


hasDefined

public boolean hasDefined(FigureAttributeConstant attributeConstant)
Tests if an attribute is defined.


clone

public java.lang.Object clone()
Clones the attributes.

Overrides:
clone in class java.lang.Object

read

public void read(StorableInput dr)
          throws java.io.IOException
Reads the attributes from a StorableInput. FigureAttributes store the following types directly: Color, Boolean, String, Int. Other attribute types have to implement the Storable interface or they have to be wrapped by an object that implements Storable.

Throws:
java.io.IOException
See Also:
Storable, write(org.jhotdraw.util.StorableOutput)

write

public void write(StorableOutput dw)
Writes the attributes to a StorableInput. FigureAttributes store the following types directly: Color, Boolean, String, Int. Other attribute types have to implement the Storable interface or they have to be wrapped by an object that implements Storable.

See Also:
Storable, write(org.jhotdraw.util.StorableOutput)

writeColor

public static void writeColor(StorableOutput dw,
                              java.lang.String colorName,
                              java.awt.Color color)

readColor

public static java.awt.Color readColor(StorableInput dr)
                                throws java.io.IOException
Throws:
java.io.IOException