public class CompositeFigure extends AbstractFigureContainer
Constructor and Description |
---|
CompositeFigure()
Create a new composite figure containing no figures.
|
CompositeFigure(Figure background)
Construct a composite figure with the given figure as its
background.
|
CompositeFigure(ZList zlist)
Create a new composite figure containing no figures,
that uses the given z-list for its storage.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Figure f)
Add a child figure to this composite.
|
void |
add(int index,
Figure f)
Insert a figure at the given position.
|
boolean |
contains(Figure f)
Test if the given figure is a child of this composite.
|
Iterator |
figures()
Return an iteration of the children, in an undefined order.
|
Iterator |
figuresFromBack()
Return an iteration of the children, from back to front.
|
Iterator |
figuresFromFront()
Return an iteration of the children, from front to back.
|
Figure |
get(int index)
Return the figure at the given index.
|
Figure |
getBackgroundFigure()
Get the background figure.
|
Rectangle2D |
getBounds()
Get the bounding box of this figure.
|
ZList |
getChildren()
Get the internal z-list.
|
int |
getFigureCount()
Return the number of elements in this container.
|
Point2D |
getOrigin()
Return the origin of the background figure in the enclosing
transform context.
|
Shape |
getShape()
Get the shape of this figure.
|
TransformContext |
getTransformContext()
Return the transform context of this figure.
|
int |
indexOf(Figure f)
Return the index of the given figure in the Z-list, or -1
if the figure is not in this list.
|
boolean |
intersects(Rectangle2D region)
Test if this figure intersects the given rectangle.
|
protected void |
invalidateCachedBounds() |
void |
paint(Graphics2D g)
Paint this composite figure onto a 2D graphics object.
|
void |
paint(Graphics2D g,
Rectangle2D region)
Paint this composite figure onto a 2D graphics object, within
the given region.
|
Figure |
pick(Rectangle2D region)
Get the picked figure.
|
Figure |
pick(Rectangle2D region,
Filter filter)
Given a rectangle, return the top-most descendent figure
that it hits that is accepted by the given filter.
|
void |
remove(Figure f)
Remove the given child from this composite.
|
void |
remove(int index)
Remove the figure at the given position in the list.
|
void |
repaint(DamageRegion d)
Accept notification that a repaint has occurred somewhere
in the hierarchy below this container.
|
protected void |
replaceChild(Figure child,
Figure replacement)
Replace the first figure, which must be a child, with the
second, which must not be a child.
|
void |
setBackgroundFigure(Figure background)
Set the background figure.
|
void |
setIndex(int index,
Figure f)
Set the index of the given figure.
|
String |
toString()
Return a string description of this figure
|
void |
transform(AffineTransform at)
Transform this figure with the supplied transform.
|
void |
translate(double x,
double y)
Translate this figure the given distance.
|
decorate, undecorate
contains, getInteractor, getLayer, getParent, getToolTipText, getUserObject, hit, isVisible, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isVisible, setVisible
getParent, repaint
public CompositeFigure()
public CompositeFigure(ZList zlist)
public CompositeFigure(Figure background)
public void add(Figure f)
public void add(int index, Figure f)
public boolean contains(Figure f)
contains
in interface FigureContainer
contains
in interface FigureSet
contains
in class AbstractFigureContainer
public Iterator figures()
figures
in interface FigureSet
figures
in class AbstractFigureContainer
public Iterator figuresFromBack()
figuresFromBack
in interface FigureSet
figuresFromBack
in class AbstractFigureContainer
public Iterator figuresFromFront()
figuresFromFront
in interface FigureSet
figuresFromFront
in class AbstractFigureContainer
public Figure get(int index)
IndexOutOfBoundsException
- The index is out of range.public Figure getBackgroundFigure()
public Rectangle2D getBounds()
getBounds
in interface Figure
getBounds
in class AbstractFigure
public ZList getChildren()
public int getFigureCount()
getFigureCount
in interface FigureContainer
getFigureCount
in class AbstractFigureContainer
public Point2D getOrigin()
getOrigin
in interface Figure
getOrigin
in class AbstractFigure
AbstractFigure.getBounds()
public Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public TransformContext getTransformContext()
getTransformContext
in interface CanvasComponent
getTransformContext
in class AbstractFigure
public int indexOf(Figure f)
public boolean intersects(Rectangle2D region)
intersects
in interface Figure
intersects
in class AbstractFigure
protected void invalidateCachedBounds()
public void paint(Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigureContainer
public void paint(Graphics2D g, Rectangle2D region)
paint
in interface VisibleComponent
paint
in class AbstractFigure
public Figure pick(Rectangle2D region)
pick
in interface FigureContainer
pick
in class AbstractFigureContainer
public Figure pick(Rectangle2D region, Filter filter)
pick
in interface FigureContainer
pick
in class AbstractFigureContainer
public void remove(Figure f)
public void remove(int index)
IndexOutOfBoundsException
- The index is out of range.public void repaint(DamageRegion d)
repaint
in interface CanvasComponent
repaint
in class AbstractFigureContainer
public void setBackgroundFigure(Figure background)
public void setIndex(int index, Figure f)
IndexOutOfBoundsException
- The new index is out of range.protected void replaceChild(Figure child, Figure replacement)
replaceChild
in class AbstractFigureContainer
public String toString()
public void transform(AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigureContainer
public void translate(double x, double y)
translate
in interface Figure
translate
in class AbstractFigureContainer
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.