Package diva.canvas
Interface Figure
-
- All Superinterfaces:
CanvasComponent
,UserObjectContainer
,VisibleComponent
- All Known Subinterfaces:
Connector
,GrabHandle
,ShapedFigure
,Terminal
- All Known Implementing Classes:
AbstractConnector
,AbstractFigure
,AbstractFigureContainer
,ArcConnector
,ArcManipulator
,AttributeBoundsManipulator
,BasicEdgeHighlighter
,BasicEllipse
,BasicFigure
,BasicGrabHandle
,BasicHighlighter
,BasicRectangle
,BoundsManipulator
,CircleManipulator
,CompositeFigure
,ConnectorManipulator
,ConnectorTutorial.SitedRectangle
,FigureDecorator
,FigureTutorial.CustomRectangle
,FigureWrapper
,IconFigure
,ImageFigure
,KielerLayoutArcConnector
,KielerLayoutConnector
,LabelFigure
,LabelWrapper
,LinkManhattanConnector
,ManhattanConnector
,Manipulator
,MoveHandle
,PaintedFigure
,PaneWrapper
,PathFigure
,PathManipulator
,PortTerminal
,RelativeLinkFigure
,RoundedRectangle
,ShadowHighlighter
,StateBubble
,StraightConnector
,StraightTerminal
,SwingWrapper
,TerminalFigure
,TransformedFigureTutorial.CloudFigure
,TypedDecorator
,VectorFigure
public interface Figure extends VisibleComponent, UserObjectContainer
A Figure is a persistent object drawn on the screen. This interface roots a small tree of interfaces that define various roles that different kinds of figures play. It is also implemented by the AbstractFigure class, which roots the tree of concrete figure classes.- Version:
- $Id$
- Author:
- John Reekie
- Pt.AcceptedRating:
- Yellow
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
contains(java.awt.geom.Point2D point)
Test whether this figure contains the point given.java.awt.geom.Rectangle2D
getBounds()
Get the bounding box of this figure.Interactor
getInteractor()
Return the interactor of this figure.CanvasLayer
getLayer()
Get the most immediate layer containing this figure.java.awt.geom.Point2D
getOrigin()
Return the origin of the figure in the enclosing transform context.CanvasComponent
getParent()
Return the parent of this figure.java.awt.Shape
getShape()
Get the outline shape of this figure.java.lang.String
getToolTipText()
Return the tooltip string for this figure, or null if the figure does not have a tooltip.boolean
hit(java.awt.geom.Rectangle2D rectangle)
Test if this figure is "hit" by the given rectangle.boolean
intersects(java.awt.geom.Rectangle2D rectangle)
Test if this figure intersects the given rectangle.void
setInteractor(Interactor interactor)
Set the interactor of this figure.void
setParent(CanvasComponent canvasComponent)
Set the parent of this figure.void
setToolTipText(java.lang.String toolTipText)
Set the tooltip string for this figure.void
transform(java.awt.geom.AffineTransform affineTransform)
Transform the figure with the supplied transform.void
translate(double x, double y)
Move the figure the indicated distance.-
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext, repaint, repaint
-
Methods inherited from interface diva.util.UserObjectContainer
getUserObject, setUserObject
-
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, paint, setVisible
-
-
-
-
Method Detail
-
contains
boolean contains(java.awt.geom.Point2D point)
Test whether this figure contains the point given. The point given is in the enclosing transform context.- Parameters:
point
- The given point- Returns:
- true if the point is contained by this figure.
-
getBounds
java.awt.geom.Rectangle2D getBounds()
Get the bounding box of this figure. The result rectangle is given in the enclosing transform context. The returned rectangle may be an internally cached shape, and should not be modified.- Returns:
- the bounding box of this figure.
-
getInteractor
Interactor getInteractor()
Return the interactor of this figure. Return null if there isn't one.- Returns:
- the interactor of this figure or null.
- See Also:
setInteractor(Interactor)
-
getLayer
CanvasLayer getLayer()
Get the most immediate layer containing this figure.- Returns:
- the most immediate layer containing this figure.
-
getOrigin
java.awt.geom.Point2D getOrigin()
Return the origin of the figure in the enclosing transform context. This might be, for example, the center of the figure, the upper left corner, or some other point with respect to which the pieces of the figure are defined.- Returns:
- The origin of the figure.
-
getParent
CanvasComponent getParent()
Return the parent of this figure. Return null if the figure does not have a parent. (Note that a figure with no parent can exist, but it will not be displayed, as it must be in a layer for the figure canvas to ever call its paint method.)- Specified by:
getParent
in interfaceCanvasComponent
- Returns:
- the parent of this figure.
- See Also:
setParent(CanvasComponent)
-
getShape
java.awt.Shape getShape()
Get the outline shape of this figure. The outline shape is used for things like highlighting. The result shape is given in the enclosing transform context.- Returns:
- the outline shape of this figure
-
getToolTipText
java.lang.String getToolTipText()
Return the tooltip string for this figure, or null if the figure does not have a tooltip.- Returns:
- the tooltip string for this figure.
- See Also:
setToolTipText(String)
-
hit
boolean hit(java.awt.geom.Rectangle2D rectangle)
Test if this figure is "hit" by the given rectangle. This is the same as intersects if the interior of the figure is not transparent. The rectangle is given in the enclosing transform context. If the figure is not visible, it must return false. The default implementation is the same as intersects if the figure is visible.(This method would be better named hits, but the name hit is consistent with java.awt.Graphics2D.)
- Parameters:
rectangle
- The rectangle to be checked.- Returns:
- true if the figure is hit by the given rectangle.
-
intersects
boolean intersects(java.awt.geom.Rectangle2D rectangle)
Test if this figure intersects the given rectangle. The rectangle is given in the enclosing transform context.- Parameters:
rectangle
- The rectangle to be checked.- Returns:
- truen if the figure intersects the given rectangle.
-
setInteractor
void setInteractor(Interactor interactor)
Set the interactor of this figure. Once a figure has an interactor given to it, it will respond to events on the canvas, in the ways determined by the interactor.- Parameters:
interactor
- The interactor.- See Also:
getInteractor()
-
setParent
void setParent(CanvasComponent canvasComponent)
Set the parent of this figure. A null argument means that the figure is being removed from its parent. No checks are performed to see if the figure already has a parent -- it is the responsibility of the caller to do this. This method is not intended for public use, and should never be called by client code.- Parameters:
canvasComponent
- The parent of the figure.- See Also:
getParent()
-
setToolTipText
void setToolTipText(java.lang.String toolTipText)
Set the tooltip string for this figure. If the string is null, then the figure will not have a tooltip.- Parameters:
toolTipText
- The tool tip text.- See Also:
getToolTipText()
-
transform
void transform(java.awt.geom.AffineTransform affineTransform)
Transform the figure with the supplied transform. This can be used to perform arbitrary translation, scaling, shearing, and rotation operations.- Parameters:
affineTransform
- The transform to be used.
-
translate
void translate(double x, double y)
Move the figure the indicated distance.- Parameters:
x
- The x value to be moved.y
- The y value to be moved.
-
-