Package diva.canvas
Interface FigureContainer
-
- All Superinterfaces:
CanvasComponent
,FigureSet
,VisibleComponent
- All Known Implementing Classes:
AbstractFigureContainer
,ArcManipulator
,AttributeBoundsManipulator
,BasicEdgeHighlighter
,BasicHighlighter
,BoundsManipulator
,CircleManipulator
,CompositeFigure
,ConnectorManipulator
,FigureDecorator
,FigureLayer
,Manipulator
,PathManipulator
,ShadowHighlighter
,TypedDecorator
public interface FigureContainer extends FigureSet, VisibleComponent
The FigureContainer interface is implemented by any visible component that can contain figures. It includes all of the methods in VisibleComponent and FigureSet, and adds methods related to containment of a known and finite set of figures.- Version:
- $Id$
- Author:
- John Reekie
- Pt.AcceptedRating:
- Yellow
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(Figure f)
Add a figure to this container.boolean
contains(Figure f)
Test if this container contains the given figure.void
decorate(Figure f, FigureDecorator d)
Decorate a child figure, replacing the child figure with the decorator.int
getFigureCount()
Return the number of figures in this container.Figure
pick(java.awt.geom.Rectangle2D region)
Given a rectangle, return the top-most descendent figure that hits it.Figure
pick(java.awt.geom.Rectangle2D region, Filter f)
Given a rectangle, return the top-most descendent figure that hits it, and is accepted by the given filter.void
remove(Figure f)
Remove the given figure from this container.void
undecorate(FigureDecorator d)
Remove a figure from the given decorator and add it back into this container.-
Methods inherited from interface diva.canvas.CanvasComponent
getParent, getTransformContext, repaint, repaint
-
Methods inherited from interface diva.canvas.FigureSet
figures, figuresFromBack, figuresFromFront
-
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, paint, setVisible
-
-
-
-
Method Detail
-
add
void add(Figure f)
Add a figure to this container. The figure should be added so that it always displays above existing figures.- Parameters:
f
- The figure to be added.
-
contains
boolean contains(Figure f)
Test if this container contains the given figure. As a general rule, the implementation of this method is not required to be efficient -- O(n) in the length of the list is acceptable. Clients should note that, in general, a much better way of making this same test is to check if the parent of the figure is the same object as this container.
-
decorate
void decorate(Figure f, FigureDecorator d)
Decorate a child figure, replacing the child figure with the decorator.- Parameters:
f
- The child figure.d
- The decorator.
-
getFigureCount
int getFigureCount()
Return the number of figures in this container.- Returns:
- The number of figures.
-
pick
Figure pick(java.awt.geom.Rectangle2D region)
Given a rectangle, return the top-most descendent figure that hits it. Otherwise, return null. Implementors should not call their own hit() method, but only those of their children.Note that a region is given instead of a point so that "pick halo" can be implemented. The region should not have zero size, or no figure will be hit.
- Parameters:
region
- The rectangle- Returns:
- The figure
-
pick
Figure pick(java.awt.geom.Rectangle2D region, Filter f)
Given a rectangle, return the top-most descendent figure that hits it, and is accepted by the given filter. Otherwise, return null. Implementors should not call their own hit() method, but only those of their children.Note that a region is given instead of a point so that "pick halo" can be implemented. The region should not have zero size, or no figure will be hit.
- Parameters:
region
- The rectanglef
- The filter- Returns:
- the Figure or null.
-
remove
void remove(Figure f)
Remove the given figure from this container.- Parameters:
f
- The figure to be removed
-
undecorate
void undecorate(FigureDecorator d)
Remove a figure from the given decorator and add it back into this container.- Parameters:
d
- The decorator
-
-