JHotDraw 7.1

org.jhotdraw.draw
Class AbstractAttributedCompositeFigure

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.draw.AbstractFigure
          extended by org.jhotdraw.draw.AbstractCompositeFigure
              extended by org.jhotdraw.draw.AbstractAttributedCompositeFigure
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, CompositeFigure, Figure, DOMStorable
Direct Known Subclasses:
AbstractDrawing, ODGPathFigure, SVGPathFigure

public abstract class AbstractAttributedCompositeFigure
extends AbstractCompositeFigure

An AbstractAttributedCompositeFigure is a CompositeFigure which has its own attribute set.

Version:
2.0 2007-05-18 Changed due to changes in Figure interface.
1.0 July 9, 2006 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jhotdraw.draw.AbstractCompositeFigure
AbstractCompositeFigure.EventHandler
 
Field Summary
 
Fields inherited from class org.jhotdraw.draw.AbstractCompositeFigure
cachedBounds, cachedDrawingArea, children, eventHandler, layouter
 
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.CompositeFigure
LAYOUT_INSETS
 
Constructor Summary
AbstractAttributedCompositeFigure()
          Creates a new instance.
 
Method Summary
protected  void applyAttributesTo(Figure that)
          Applies all attributes of this figure to that figure.
 AbstractAttributedCompositeFigure clone()
          Returns a clone of the figure, with clones of all aggregated figures, such as chilrend and decorators.
protected  void drawChildren(java.awt.Graphics2D g)
           
 void drawFigure(java.awt.Graphics2D g)
           
protected abstract  void drawFill(java.awt.Graphics2D g)
          This method is called by method draw() to draw the fill area of the figure.
protected abstract  void drawStroke(java.awt.Graphics2D g)
          This method is called by method draw() to draw the text of the figure .
protected  void drawText(java.awt.Graphics2D g)
           
 java.lang.Object getAttribute(AttributeKey key)
          Gets an attribute from the figure.
protected  AttributeKey getAttributeKey(java.lang.String name)
           
 java.util.Map<AttributeKey,java.lang.Object> getAttributes()
          Returns a view to all attributes of this figure.
 java.lang.Object getAttributesRestoreData()
          Gets data which can be used to restore the attributes of the figure after a setAttribute has been applied to it.
 java.awt.geom.Rectangle2D.Double getFigureDrawBounds()
           
 java.awt.Stroke getStroke()
           
 double getStrokeMiterLimitFactor()
           
 boolean hasAttribute(AttributeKey key)
           
 boolean isAttributeEnabled(AttributeKey key)
           
 void read(DOMInput in)
           
protected  void readAttributes(DOMInput in)
           
 void removeAttribute(AttributeKey key)
           
 void restoreAttributesTo(java.lang.Object restoreData)
          Restores the attributes of the figure to a previously stored state.
 void setAttribute(AttributeKey key, java.lang.Object newValue)
          Sets an attribute of the figure.
 void setAttributeEnabled(AttributeKey key, boolean b)
           
protected  void setAttributeOnChildren(AttributeKey key, java.lang.Object newValue)
           
 void setAttributes(java.util.Map<AttributeKey,java.lang.Object> map)
           
 void write(DOMOutput out)
           
protected  void writeAttributes(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.AbstractCompositeFigure
add, add, addAll, addAll, addCompositeFigureListener, addNotify, basicAdd, basicAdd, basicAddAll, basicRemove, basicRemoveAll, basicRemoveAllChildren, basicRemoveChild, contains, contains, createEventHandler, createHandles, draw, findChild, findChildIndex, findFigureInside, fireFigureAdded, fireFigureRemoved, getBounds, getChild, getChildCount, getChildren, getChildrenFrontToBack, getDecomposition, getDrawingArea, getLayouter, getPreferredSize, getTransformRestoreData, indexOf, invalidate, layout, remove, removeAll, removeAllChildren, removeChild, removeCompositeFigureListener, removeNotify, restoreTransformTo, sendToBack, sendToFront, setBounds, setLayouter, transform, validate
 
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, basicClone, canConnect, changed, findCompatibleConnector, findConnector, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDrawing, getEndPoint, getFontRenderContext, getLayer, getLock, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isChanging, isRemovable, isSelectable, isTransformable, isVisible, remap, remap, removeFigureListener, requestRemove, setBounds, setRemovable, setSelectable, setTransformable, setVisible, toString, willChange
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, 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, canConnect, changed, findCompatibleConnector, findConnector, getActions, getConnectors, getCursor, getEndPoint, getLayer, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, requestRemove, willChange
 

Constructor Detail

AbstractAttributedCompositeFigure

public AbstractAttributedCompositeFigure()
Creates a new instance.

Method Detail

setAttributeEnabled

public void setAttributeEnabled(AttributeKey key,
                                boolean b)

isAttributeEnabled

public boolean isAttributeEnabled(AttributeKey key)

setAttributes

public void setAttributes(java.util.Map<AttributeKey,java.lang.Object> map)

getAttributes

public java.util.Map<AttributeKey,java.lang.Object> getAttributes()
Description copied from interface: Figure
Returns a view to all attributes of this figure. By convention, an unmodifiable map is returned.

Specified by:
getAttributes in interface Figure
Overrides:
getAttributes in class AbstractCompositeFigure

setAttribute

public void setAttribute(AttributeKey key,
                         java.lang.Object newValue)
Sets an attribute of the figure. AttributeKey name and semantics are defined by the class implementing the figure interface.

Specified by:
setAttribute in interface Figure
Overrides:
setAttribute in class AbstractCompositeFigure
See Also:
AttributeKey.set(org.jhotdraw.draw.Figure, T)

setAttributeOnChildren

protected void setAttributeOnChildren(AttributeKey key,
                                      java.lang.Object newValue)

getAttribute

public java.lang.Object getAttribute(AttributeKey key)
Gets an attribute from the figure.

Specified by:
getAttribute in interface Figure
Overrides:
getAttribute in class AbstractCompositeFigure
Returns:
Returns the attribute value. If the Figure does not have an attribute with the specified key, returns key.getDefaultValue().
See Also:
AttributeKey.get(org.jhotdraw.draw.Figure)

getAttributesRestoreData

public java.lang.Object getAttributesRestoreData()
Description copied from interface: Figure
Gets data which can be used to restore the attributes of the figure after a setAttribute has been applied to it.

Specified by:
getAttributesRestoreData in interface Figure
Overrides:
getAttributesRestoreData in class AbstractCompositeFigure

restoreAttributesTo

public void restoreAttributesTo(java.lang.Object restoreData)
Description copied from interface: Figure
Restores the attributes of the figure to a previously stored state.

Specified by:
restoreAttributesTo in interface Figure
Overrides:
restoreAttributesTo in class AbstractCompositeFigure

drawFigure

public void drawFigure(java.awt.Graphics2D g)

drawChildren

protected void drawChildren(java.awt.Graphics2D g)

getStroke

public java.awt.Stroke getStroke()

getStrokeMiterLimitFactor

public double getStrokeMiterLimitFactor()

getFigureDrawBounds

public java.awt.geom.Rectangle2D.Double getFigureDrawBounds()

drawFill

protected abstract void drawFill(java.awt.Graphics2D g)
This method is called by method draw() to draw the fill area of the figure. AttributedFigure configures the Graphics2D object with the FILL_COLOR attribute before calling this method. If the FILL_COLOR attribute is null, this method is not called.


drawStroke

protected abstract void drawStroke(java.awt.Graphics2D g)
This method is called by method draw() to draw the text of the figure . AttributedFigure configures the Graphics2D object with the TEXT_COLOR attribute before calling this method. If the TEXT_COLOR attribute is null, this method is not called.


drawText

protected void drawText(java.awt.Graphics2D g)

clone

public AbstractAttributedCompositeFigure clone()
Description copied from interface: Figure
Returns a clone of the figure, with clones of all aggregated figures, such as chilrend 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 AbstractCompositeFigure

writeAttributes

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

readAttributes

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

getAttributeKey

protected AttributeKey getAttributeKey(java.lang.String name)

applyAttributesTo

protected void applyAttributesTo(Figure that)
Applies all attributes of this figure to that figure.


write

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

read

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

removeAttribute

public void removeAttribute(AttributeKey key)

hasAttribute

public boolean hasAttribute(AttributeKey key)

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.