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, LabelFigure, LabelWrapper, LinkManhattanConnector, ManhattanConnector, Manipulator, MoveHandle, PaintedFigure, PaneWrapper, PathFigure, PathManipulator, PortTerminal, RoundedRectangle, 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: Figure.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie
Accepted Rating:
Yellow

Method Summary
 boolean contains(java.awt.geom.Point2D p)
          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 r)
          Test if this figure is "hit" by the given rectangle.
 boolean intersects(java.awt.geom.Rectangle2D r)
          Test if this figure intersects the given rectangle.
 void setInteractor(Interactor interactor)
          Set the interactor of this figure.
 void setParent(CanvasComponent fc)
          Set the parent of this figure.
 void setToolTipText(java.lang.String s)
          Set the tooltip string for this figure.
 void transform(java.awt.geom.AffineTransform at)
          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.VisibleComponent
isVisible, paint, paint, setVisible
 
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext, repaint, repaint
 
Methods inherited from interface diva.util.UserObjectContainer
getUserObject, setUserObject
 

Method Detail

contains

boolean contains(java.awt.geom.Point2D p)
Test whether this figure contains the point given. The point given is in the enclosing transform context.


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.


getInteractor

Interactor getInteractor()
Return the interactor of this figure. Return null if there isn't one.


getLayer

CanvasLayer getLayer()
Get 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 interface 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.


getToolTipText

java.lang.String getToolTipText()
Return the tooltip string for this figure, or null if the figure does not have a tooltip.


hit

boolean hit(java.awt.geom.Rectangle2D r)
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.)


intersects

boolean intersects(java.awt.geom.Rectangle2D r)
Test if this figure intersects the given rectangle. The rectangle is given in the enclosing transform context.


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.


setParent

void setParent(CanvasComponent fc)
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.


setToolTipText

void setToolTipText(java.lang.String s)
Set the tooltip string for this figure. If the string is null, then the figure will not have a tooltip.


transform

void transform(java.awt.geom.AffineTransform at)
Transform the figure with the supplied transform. This can be used to perform arbitrary translation, scaling, shearing, and rotation operations.


translate

void translate(double x,
               double y)
Move the figure the indicated distance.