Package diva.canvas
Class FigureWrapper
- java.lang.Object
-
- diva.canvas.AbstractFigure
-
- diva.canvas.FigureWrapper
-
- All Implemented Interfaces:
CanvasComponent
,Figure
,VisibleComponent
,UserObjectContainer
public abstract class FigureWrapper extends AbstractFigure
A FigureWrapper is a figure container that contains a single child figure. The purpose of a FigureWrapper is to provide an abstract superclass for application-specific figures, that need to implement certain behaviour but don't particularly care about their appearance.- Version:
- $Id$
- Author:
- John Reekie
- Pt.AcceptedRating:
- Yellow
-
-
Constructor Summary
Constructors Constructor Description FigureWrapper(Figure f)
Construct a new figure with the given child figure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Rectangle2D
getBounds()
Get the bounds of the child figure.Figure
getChild()
Get the child figure, or null if there isn't one.java.awt.Shape
getShape()
Get the outline shape of the child figure.void
paint(java.awt.Graphics2D g)
Paint the child if this figure is visible.void
setChild(Figure f)
Set the child figure.void
transform(java.awt.geom.AffineTransform at)
Transform the child figure with the supplied transform.-
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
-
-
-
-
Constructor Detail
-
FigureWrapper
public FigureWrapper(Figure f)
Construct a new figure with the given child figure.- Parameters:
f
- The figure
-
-
Method Detail
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Get the bounds of the child figure.- Specified by:
getBounds
in interfaceFigure
- Overrides:
getBounds
in classAbstractFigure
- Returns:
- The bounds
-
getChild
public Figure getChild()
Get the child figure, or null if there isn't one.- Returns:
- the child figure
- See Also:
setChild(Figure)
-
getShape
public java.awt.Shape getShape()
Get the outline shape of the child figure.- Specified by:
getShape
in interfaceFigure
- Specified by:
getShape
in classAbstractFigure
- Returns:
- The shape.
-
paint
public void paint(java.awt.Graphics2D g)
Paint the child if this figure is visible.- Specified by:
paint
in interfaceVisibleComponent
- Specified by:
paint
in classAbstractFigure
- Parameters:
g
- The graphics context
-
setChild
public void setChild(Figure f)
Set the child figure. If there is already a child figure, remove it from this container.- Parameters:
f
- The child figure- See Also:
getChild()
-
transform
public void transform(java.awt.geom.AffineTransform at)
Transform the child figure with the supplied transform.- Specified by:
transform
in interfaceFigure
- Specified by:
transform
in classAbstractFigure
- Parameters:
at
- The transform
-
-