JHotDraw 6.0b1

org.jhotdraw.contrib.html
Class ColorContentProducer

java.lang.Object
  extended by org.jhotdraw.contrib.html.AbstractContentProducer
      extended by org.jhotdraw.contrib.html.FigureDataContentProducer
          extended by org.jhotdraw.contrib.html.ColorContentProducer
All Implemented Interfaces:
java.io.Serializable, ContentProducer, Storable
Direct Known Subclasses:
HTMLColorContentProducer

public class ColorContentProducer
extends FigureDataContentProducer
implements java.io.Serializable

ColorContentProducer produces RGB color encoded hexadecimal strings.
Ex: Color.blue ==> 0x0000FF
Color.red ==> 0xFF00FF
It can either be specific if set for a specific color, or generic, encoding any color passed to the getContents method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jhotdraw.contrib.html.ContentProducer
ENTITY_ARROW_MODE, ENTITY_FIGURE_HEIGHT, ENTITY_FIGURE_POSX, ENTITY_FIGURE_POSY, ENTITY_FIGURE_WIDTH, ENTITY_FILL_COLOR, ENTITY_FONT_NAME, ENTITY_FONT_SIZE, ENTITY_FONT_STYLE, ENTITY_FRAME_COLOR
 
Constructor Summary
ColorContentProducer()
          Constructor for the ColorContentProducer object
ColorContentProducer(java.awt.Color color)
          Constructor for the ColorContentProducer object
 
Method Summary
 java.awt.Color getColor()
          Gets the color attribute of the ColorContentProducer object
 java.lang.Object getContent(ContentProducerContext context, java.lang.String ctxAttrName, java.lang.Object ctxAttrValue)
          Produces the contents for the color
 void read(StorableInput dr)
          Reads the storable
 void setColor(java.awt.Color color)
          Sets the color attribute of the ColorContentProducer object
 void write(StorableOutput dw)
          Writes the storable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorContentProducer

public ColorContentProducer()
Constructor for the ColorContentProducer object


ColorContentProducer

public ColorContentProducer(java.awt.Color color)
Constructor for the ColorContentProducer object

Parameters:
color - the specific color to use
Method Detail

getContent

public java.lang.Object getContent(ContentProducerContext context,
                                   java.lang.String ctxAttrName,
                                   java.lang.Object ctxAttrValue)
Produces the contents for the color

Specified by:
getContent in interface ContentProducer
Overrides:
getContent in class FigureDataContentProducer
Parameters:
context - the calling client context
ctxAttrName - the color attribute name (FrameColor, TextColor, etc)
ctxAttrValue - the color
Returns:
The string RBG value for the color

setColor

public void setColor(java.awt.Color color)
Sets the color attribute of the ColorContentProducer object

Parameters:
color - The new color value

getColor

public java.awt.Color getColor()
Gets the color attribute of the ColorContentProducer object

Returns:
The color value

write

public void write(StorableOutput dw)
Writes the storable

Specified by:
write in interface Storable
Overrides:
write in class FigureDataContentProducer
Parameters:
dw - the storable output

read

public void read(StorableInput dr)
          throws java.io.IOException
Reads the storable

Specified by:
read in interface Storable
Overrides:
read in class FigureDataContentProducer
Parameters:
dr - the storable input
Throws:
java.io.IOException - thrown by called methods

JHotDraw 6.0b1