CH.ifa.draw.figures
Class AttributeFigure

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractFigure
      extended by CH.ifa.draw.figures.AttributeFigure
All Implemented Interfaces:
Figure, Storable, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
EllipseFigure, ImageFigure, PolygonFigure, RectangleFigure, RoundRectangleFigure, TextFigure

public abstract class AttributeFigure
extends AbstractFigure

A figure that can keep track of an open ended set of attributes. The attributes are stored in a dictionary implemented by FigureAttributes.

See Also:
Figure, Handle, FigureAttributes, Serialized Form

Field Summary
 
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
 
Constructor Summary
protected AttributeFigure()
           
 
Method Summary
 void draw(java.awt.Graphics g)
          Draws the figure in the given graphics.
protected  void drawBackground(java.awt.Graphics g)
          Draws the background of the figure.
protected  void drawFrame(java.awt.Graphics g)
          Draws the frame of the figure.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the named attribute or null if a a figure doesn't have an attribute.
static java.lang.Object getDefaultAttribute(java.lang.String name)
          Gets a the default value for a named attribute
 java.awt.Color getFillColor()
          Gets the fill color of a figure.
 java.awt.Color getFrameColor()
          Gets the frame color of a figure.
 void read(StorableInput dr)
          Reads the Figure from a StorableInput.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Sets the named attribute to the new value
 void write(StorableOutput dw)
          Stores the Figure to a StorableOutput.
 
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, basicDisplayBox, basicMoveBy, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, displayBox, figures, findFigureInside, handles, includes, invalidate, isEmpty, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, size, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeFigure

protected AttributeFigure()
Method Detail

draw

public void draw(java.awt.Graphics g)
Draws the figure in the given graphics. Draw is a template method calling drawBackground followed by drawFrame.

Parameters:
g - the Graphics to draw into

drawBackground

protected void drawBackground(java.awt.Graphics g)
Draws the background of the figure.

See Also:
draw(java.awt.Graphics)

drawFrame

protected void drawFrame(java.awt.Graphics g)
Draws the frame of the figure.

See Also:
draw(java.awt.Graphics)

getFillColor

public java.awt.Color getFillColor()
Gets the fill color of a figure. This is a convenience method.

See Also:
getAttribute(java.lang.String)

getFrameColor

public java.awt.Color getFrameColor()
Gets the frame color of a figure. This is a convenience method.

See Also:
getAttribute(java.lang.String)

getDefaultAttribute

public static java.lang.Object getDefaultAttribute(java.lang.String name)
Gets a the default value for a named attribute

See Also:
getAttribute(java.lang.String)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the named attribute or null if a a figure doesn't have an attribute. All figures support the attribute names FillColor and FrameColor

Specified by:
getAttribute in interface Figure
Overrides:
getAttribute in class AbstractFigure

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Sets the named attribute to the new value

Specified by:
setAttribute in interface Figure
Overrides:
setAttribute in class AbstractFigure

write

public void write(StorableOutput dw)
Stores the Figure to a StorableOutput.

Specified by:
write in interface Storable
Overrides:
write in class AbstractFigure

read

public void read(StorableInput dr)
          throws java.io.IOException
Reads the Figure from a StorableInput.

Specified by:
read in interface Storable
Overrides:
read in class AbstractFigure
Throws:
java.io.IOException