|
JHotDraw 7.5.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jhotdraw.beans.AbstractBean
org.jhotdraw.draw.AbstractFigure
org.jhotdraw.draw.AbstractCompositeFigure
org.jhotdraw.draw.GraphicalCompositeFigure
public class GraphicalCompositeFigure
The GraphicalCompositeFigure fills in the gap between a CompositeFigure
and other figures which mainly have a presentation purpose. The
GraphicalCompositeFigure can be configured with any Figure which
takes over the task for rendering the graphical presentation for
a CompositeFigure. Therefore, the GraphicalCompositeFigure manages
contained figures like a CompositeFigure does, but delegates
its graphical presentation to another (graphical) figure which
purpose it is to draw the container for all contained figures.
The GraphicalCompositeFigure adds to the CompositeFigure
by containing a presentation figure by default which can not be removed. Normally,
the CompositeFigure can not be seen without containing a figure
because it has no mechanism to draw itself. It instead relies on its contained
figures to draw themselves thereby giving the CompositeFigure its
appearance. However, the GraphicalCompositeFigure's presentation figure
can draw itself even when the GraphicalCompositeFigure contains no other figures.
The GraphicalCompositeFigure also uses a
Layouter to lay out its child figures.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jhotdraw.draw.AbstractCompositeFigure |
|---|
AbstractCompositeFigure.EventHandler |
| Field Summary | |
|---|---|
protected java.util.HashMap<AttributeKey,java.lang.Object> |
attributes
|
| 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 |
| Fields inherited from interface org.jhotdraw.draw.Figure |
|---|
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY |
| Constructor Summary | |
|---|---|
GraphicalCompositeFigure()
Default constructor which uses nothing as presentation figure. |
|
GraphicalCompositeFigure(Figure newPresentationFigure)
Constructor which creates a GraphicalCompositeFigure with a given graphical figure for presenting it. |
|
| Method Summary | ||
|---|---|---|
void |
addNotify(Drawing drawing)
Informs a figure, that it has been added to a drawing. |
|
protected void |
applyAttributesTo(Figure that)
Applies all attributes of this figure to that figure. |
|
protected void |
basicSetPresentationFigureBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
|
|
java.awt.geom.Point2D.Double |
chop(java.awt.geom.Point2D.Double from)
This is a default implementation that chops the point at the rectangle returned by getBounds() of the figure. |
|
GraphicalCompositeFigure |
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. |
|
java.util.Collection<Handle> |
createHandles(int detailLevel)
Return default handles from the presentation figure. |
|
void |
draw(java.awt.Graphics2D g)
Draw the figure. |
|
protected void |
drawPresentationFigure(java.awt.Graphics2D g)
|
|
|
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.awt.geom.Rectangle2D.Double |
getBounds()
Return the logcal display area. |
|
java.awt.geom.Rectangle2D.Double |
getDrawingArea()
Return the draw area. |
|
Figure |
getPresentationFigure()
Get a figure which renders this BasicCompositeFigure. |
|
void |
read(DOMInput in)
|
|
protected void |
readAttributes(DOMInput in)
|
|
void |
remap(java.util.HashMap<Figure,Figure> oldToNew,
boolean disconnectIfNotInMap)
|
|
void |
removeNotify(Drawing drawing)
Informs a figure, that it has been removed from a drawing. |
|
|
set(AttributeKey<T> key,
T newValue)
Sets an attribute of the figure. |
|
void |
setAttributeEnabled(AttributeKey key,
boolean b)
|
|
void |
setBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
Moves the figure. |
|
void |
setPresentationFigure(Figure newPresentationFigure)
Set a figure which renders this BasicCompositeFigure. |
|
protected void |
superBasicSetBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
|
|
void |
transform(java.awt.geom.AffineTransform tx)
Standard presentation method which is delegated to the encapsulated presentation figure. |
|
void |
write(DOMOutput out)
|
|
protected void |
writeAttributes(DOMOutput out)
|
|
| 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, addPropertyChangeListener, findCompatibleConnector, findConnector, getActions, getConnectors, getCursor, getEndPoint, getLayer, getStartPoint, getTool, getToolTipText, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removePropertyChangeListener, requestRemove |
| Field Detail |
|---|
protected java.util.HashMap<AttributeKey,java.lang.Object> attributes
| Constructor Detail |
|---|
public GraphicalCompositeFigure()
public GraphicalCompositeFigure(Figure newPresentationFigure)
newPresentationFigure - figure which renders the container| Method Detail |
|---|
public java.awt.geom.Rectangle2D.Double getBounds()
getBounds in interface FiguregetBounds in class AbstractCompositeFigurepublic boolean contains(java.awt.geom.Point2D.Double p)
FigureThis is used for hit testing by Tool's.
contains in interface Figurecontains in class AbstractCompositeFigurepublic void addNotify(Drawing drawing)
Figure
addNotify in interface FigureaddNotify in class AbstractCompositeFigurepublic void removeNotify(Drawing drawing)
Figure
removeNotify in interface FigureremoveNotify in class AbstractCompositeFigurepublic java.awt.geom.Rectangle2D.Double getDrawingArea()
getDrawingArea in interface FiguregetDrawingArea in class AbstractCompositeFigure
public void setBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
setBounds in interface FiguresetBounds in class AbstractCompositeFigureanchor - the start point of the boundslead - the end point of the boundsFigure.getBounds()
protected void superBasicSetBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
protected void basicSetPresentationFigureBounds(java.awt.geom.Point2D.Double anchor,
java.awt.geom.Point2D.Double lead)
public void transform(java.awt.geom.AffineTransform tx)
transform in interface Figuretransform in class AbstractCompositeFiguretx - The transformation.Figure.getTransformRestoreData(),
Figure.restoreTransformTo(java.lang.Object)public void draw(java.awt.Graphics2D g)
draw in interface Figuredraw in class AbstractCompositeFigureg - The Graphics2D to draw to.protected void drawPresentationFigure(java.awt.Graphics2D g)
public java.util.Collection<Handle> createHandles(int detailLevel)
createHandles in interface FigurecreateHandles in class AbstractCompositeFiguredetailLevel - The detail level of the handles. Usually this is 0 for
bounding box handles and 1 for point handles. The value -1 is used
by the SelectAreaTracker and the HandleTracker to highlight figures, over which the mouse
pointer is hovering.
Handlepublic void setPresentationFigure(Figure newPresentationFigure)
newPresentationFigure - figure takes over the presentation taskspublic Figure getPresentationFigure()
public GraphicalCompositeFigure clone()
Figure
clone in interface Figureclone in class AbstractCompositeFigure
public void remap(java.util.HashMap<Figure,Figure> oldToNew,
boolean disconnectIfNotInMap)
public <T> void set(AttributeKey<T> key,
T newValue)
set in interface Figureset in class AbstractCompositeFigureAttributeKey.set(org.jhotdraw.draw.Figure, T)
public void setAttributeEnabled(AttributeKey key,
boolean b)
public <T> T get(AttributeKey<T> key)
get in interface Figureget in class AbstractCompositeFigureAttributeKey.get(org.jhotdraw.draw.Figure)protected void applyAttributesTo(Figure that)
protected void writeAttributes(DOMOutput out)
throws java.io.IOException
java.io.IOException
protected void readAttributes(DOMInput in)
throws java.io.IOException
java.io.IOException
public void read(DOMInput in)
throws java.io.IOException
read in interface DOMStorableread in class AbstractCompositeFigurejava.io.IOException
public void write(DOMOutput out)
throws java.io.IOException
write in interface DOMStorablewrite in class AbstractCompositeFigurejava.io.IOExceptionprotected AttributeKey getAttributeKey(java.lang.String name)
public java.util.Map<AttributeKey,java.lang.Object> getAttributes()
Figure
getAttributes in interface FiguregetAttributes in class AbstractCompositeFigurepublic java.awt.geom.Point2D.Double chop(java.awt.geom.Point2D.Double from)
Figures which have a non-rectangular shape need to override this method.
This method takes the following attributes into account: AttributeKeys.STROKE_COLOR, AttributeKeys.STROKE_PLACEMENT, and AttributeKeys.StrokeTotalWidth.
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||