public abstract class AbstractAttributedFigure extends AbstractFigure implements DOMStorable
Figure
which has its own attribute set.changingDepth, listenerListpropertySupportCONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY| Constructor and Description |
|---|
AbstractAttributedFigure()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyAttributesTo(Figure that)
Applies all attributes of this figure to that figure.
|
AbstractAttributedFigure |
clone()
Returns a clone of the figure, with clones of all aggregated figures,
such as children and decorators.
|
void |
draw(java.awt.Graphics2D g)
Draws the figure.
|
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) |
<T> T |
get(AttributeKey<T> 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 set has been applied to it.
|
java.awt.geom.Rectangle2D.Double |
getDrawingArea()
Returns the drawing area of the figure as a Rectangle.
|
java.awt.Stroke |
getStroke() |
double |
getStrokeMiterLimitFactor() |
boolean |
hasAttribute(AttributeKey key) |
boolean |
isAttributeEnabled(AttributeKey key) |
void |
read(DOMInput in) |
protected void |
readAttributes(DOMInput in) |
<T> void |
removeAttribute(AttributeKey<T> key) |
void |
restoreAttributesTo(java.lang.Object restoreData)
Restores the attributes of the figure to a previously stored state.
|
<T> void |
set(AttributeKey<T> key,
T newValue)
Sets an attribute of the figure.
|
void |
setAttributeEnabled(AttributeKey key,
boolean b) |
void |
setAttributes(java.util.Map<AttributeKey,java.lang.Object> map) |
void |
write(DOMOutput out) |
protected void |
writeAttributes(DOMOutput out) |
addFigureListener, addNotify, 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, willChangeaddPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddPropertyChangeListener, contains, getBounds, getTransformRestoreData, removePropertyChangeListener, restoreTransformTo, transformpublic AbstractAttributedFigure()
public void setAttributeEnabled(AttributeKey key, boolean b)
public boolean isAttributeEnabled(AttributeKey key)
public void setAttributes(java.util.Map<AttributeKey,java.lang.Object> map)
public java.util.Map<AttributeKey,java.lang.Object> getAttributes()
FiguregetAttributes in interface Figurepublic java.lang.Object getAttributesRestoreData()
FiguregetAttributesRestoreData in interface Figurepublic void restoreAttributesTo(java.lang.Object restoreData)
FigurerestoreAttributesTo in interface Figurepublic <T> void set(AttributeKey<T> key, T newValue)
set in interface FigureAttributeKey.set(org.jhotdraw.draw.Figure, T)public <T> T get(AttributeKey<T> key)
get in interface FigureAttributeKey.get(org.jhotdraw.draw.Figure)public void draw(java.awt.Graphics2D g)
Figurepublic java.awt.Stroke getStroke()
public double getStrokeMiterLimitFactor()
public java.awt.geom.Rectangle2D.Double getDrawingArea()
Figure
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.
getDrawingArea in interface Figureprotected abstract void drawFill(java.awt.Graphics2D g)
protected abstract void drawStroke(java.awt.Graphics2D g)
protected void drawText(java.awt.Graphics2D g)
public AbstractAttributedFigure clone()
Figureclone in interface Figureclone in class AbstractFigureprotected void writeAttributes(DOMOutput out) throws java.io.IOException
java.io.IOExceptionprotected void readAttributes(DOMInput in) throws java.io.IOException
java.io.IOExceptionprotected AttributeKey getAttributeKey(java.lang.String name)
protected void applyAttributesTo(Figure that)
public void write(DOMOutput out) throws java.io.IOException
write in interface DOMStorablejava.io.IOExceptionpublic void read(DOMInput in) throws java.io.IOException
read in interface DOMStorablejava.io.IOExceptionpublic <T> void removeAttribute(AttributeKey<T> key)
public boolean hasAttribute(AttributeKey key)