JHotDraw 7.5.1

org.jhotdraw.draw
Class AbstractAttributedDecoratedFigure

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractFigure
          extended by org.jhotdraw.draw.AbstractAttributedFigure
              extended by org.jhotdraw.draw.AbstractAttributedDecoratedFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, DecoratedFigure, Figure, DOMStorable
Direct Known Subclasses:
ImageFigure, TextAreaFigure, TextFigure

public abstract class AbstractAttributedDecoratedFigure
extends AbstractAttributedFigure
implements DecoratedFigure, DOMStorable

This abstract class can be extended to implement a DecoratedFigure which has an attribute set.

Version:
$Id: AbstractAttributedDecoratedFigure.java 647 2010-01-24 22:52:59Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.draw.AbstractFigure
changingDepth, listenerList
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Fields inherited from interface org.jhotdraw.draw.Figure
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
 
Constructor Summary
AbstractAttributedDecoratedFigure()
           
 
Method Summary
 AbstractAttributedDecoratedFigure clone()
          Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators.
 boolean contains(java.awt.geom.Point2D.Double p)
          Checks if a point is contained by the figure.
 void draw(java.awt.Graphics2D g)
          Draws the figure.
protected  void drawDecorator(java.awt.Graphics2D g)
           
protected  void drawFigure(java.awt.Graphics2D g)
           
protected abstract  boolean figureContains(java.awt.geom.Point2D.Double p)
           
 Figure getDecorator()
          Gets the decorator for this figure.
 java.awt.geom.Rectangle2D.Double getDrawingArea()
          Returns the drawing area of the figure as a Rectangle.
protected  java.awt.geom.Rectangle2D.Double getFigureDrawingArea()
           
 void read(DOMInput in)
           
protected  void readDecorator(DOMInput in)
           
 void setDecorator(Figure newValue)
          Sets a decorator Figure, for example a visual adornment to this Figure.
protected  void updateDecoratorBounds()
           
 void write(DOMOutput out)
           
protected  void writeDecorator(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure
applyAttributesTo, drawFill, drawStroke, drawText, get, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, set, setAttributeEnabled, setAttributes, writeAttributes
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, addNotify, basicClone, changed, createHandles, findCompatibleConnector, findConnector, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDecomposition, getDrawing, getEndPoint, getFontRenderContext, getLayer, getLock, getPreferredSize, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, invalidate, isChanging, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, requestRemove, setBounds, setBounds, setConnectable, setRemovable, setSelectable, setTransformable, setVisible, toString, validate, willChange
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, addPropertyChangeListener, changed, createHandles, findCompatibleConnector, findConnector, findFigureInside, get, getActions, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getEndPoint, getLayer, getPreferredSize, getStartPoint, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, removePropertyChangeListener, requestRemove, restoreAttributesTo, restoreTransformTo, set, setBounds, transform, willChange
 

Constructor Detail

AbstractAttributedDecoratedFigure

public AbstractAttributedDecoratedFigure()
Method Detail

draw

public final void draw(java.awt.Graphics2D g)
Description copied from interface: Figure
Draws the figure.

Specified by:
draw in interface Figure
Overrides:
draw in class AbstractAttributedFigure
Parameters:
g - The Graphics2D to draw to.

drawFigure

protected void drawFigure(java.awt.Graphics2D g)

drawDecorator

protected void drawDecorator(java.awt.Graphics2D g)

getDrawingArea

public final java.awt.geom.Rectangle2D.Double getDrawingArea()
Description copied from interface: Figure
Returns the drawing area of the figure as a Rectangle.

The drawing area is used to inform DrawingView about the area that is needed to draw this figure.

The drawing area needs to be large enough, to take line width, line caps and other decorations into account that exceed the bounds of the Figure.

Specified by:
getDrawingArea in interface Figure
Overrides:
getDrawingArea in class AbstractAttributedFigure

getFigureDrawingArea

protected java.awt.geom.Rectangle2D.Double getFigureDrawingArea()

setDecorator

public void setDecorator(Figure newValue)
Description copied from interface: DecoratedFigure
Sets a decorator Figure, for example a visual adornment to this Figure. Set this to null, if no decorator is desired. The decorator uses the same logical bounds as this Figure plus AttributeKeys.DECORATOR_INSETS. The decorator does not handle events. The decorator is drawn when the figure is drawn.

Specified by:
setDecorator in interface DecoratedFigure

getDecorator

public Figure getDecorator()
Description copied from interface: DecoratedFigure
Gets the decorator for this figure.

Specified by:
getDecorator in interface DecoratedFigure

updateDecoratorBounds

protected void updateDecoratorBounds()

contains

public final boolean contains(java.awt.geom.Point2D.Double p)
Description copied from interface: Figure
Checks if a point is contained by the figure.

This is used for hit testing by Tool's.

Specified by:
contains in interface Figure

figureContains

protected abstract boolean figureContains(java.awt.geom.Point2D.Double p)

read

public void read(DOMInput in)
          throws java.io.IOException
Specified by:
read in interface DOMStorable
Overrides:
read in class AbstractAttributedFigure
Throws:
java.io.IOException

write

public void write(DOMOutput out)
           throws java.io.IOException
Specified by:
write in interface DOMStorable
Overrides:
write in class AbstractAttributedFigure
Throws:
java.io.IOException

writeDecorator

protected void writeDecorator(DOMOutput out)
                       throws java.io.IOException
Throws:
java.io.IOException

readDecorator

protected void readDecorator(DOMInput in)
                      throws java.io.IOException
Throws:
java.io.IOException

clone

public AbstractAttributedDecoratedFigure clone()
Description copied from interface: Figure
Returns a clone of the figure, with clones of all aggregated figures, such as children and decorators. The cloned figure does not clone the list of FigureListeners from its original.

Specified by:
clone in interface Figure
Overrides:
clone in class AbstractAttributedFigure

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.