diva.canvas.tutorial
Class ConnectorTutorial.SitedRectangle

java.lang.Object
  extended by diva.canvas.AbstractFigure
      extended by diva.canvas.toolbox.BasicFigure
          extended by diva.canvas.toolbox.BasicRectangle
              extended by diva.canvas.tutorial.ConnectorTutorial.SitedRectangle
All Implemented Interfaces:
CanvasComponent, Figure, ShapedFigure, VisibleComponent, UserObjectContainer
Enclosing class:
ConnectorTutorial

public static class ConnectorTutorial.SitedRectangle
extends BasicRectangle

SitedRectangle is a class that provides four sites that we use in the examples to attach connectors to. In this example, we make life easy by using an instance of the BoundsGeometry class, but in general, figures will want to define their own sites. One thing to note about this figure: it does not itself contain the code that re-routes the attached connectors. Although it could override transform() and translate, in general it is better for this kind of routing to be initiated by the interaction code.


Field Summary
private  BoundsGeometry _geometry
           
 
Constructor Summary
ConnectorTutorial.SitedRectangle(double x, double y, double width, double height, java.awt.Color color)
          Create a new instance of this figure.
 
Method Summary
 Site getE()
          Get the east site.
 Site getN()
          Get the north site.
 Site getS()
          Get the south site.
 Site getW()
          Get the west site.
 void transform(java.awt.geom.AffineTransform at)
          Update the geometry
 void translate(double x, double y)
          Update the geometry
 
Methods inherited from class diva.canvas.toolbox.BasicFigure
getBounds, getComposite, getDashArray, getFillPaint, getLineWidth, getOrigin, getShape, getStrokePaint, hit, isCentered, paint, setCentered, setComposite, setDashArray, setFillPaint, setLineWidth, setPrototypeShape, setShape, setStroke, setStrokePaint
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface diva.canvas.Figure
contains, getInteractor, getLayer, getParent, getToolTipText, intersects, setInteractor, setParent, setToolTipText
 
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, paint, setVisible
 
Methods inherited from interface diva.canvas.CanvasComponent
getTransformContext, repaint, repaint
 
Methods inherited from interface diva.util.UserObjectContainer
getUserObject, setUserObject
 

Field Detail

_geometry

private BoundsGeometry _geometry
Constructor Detail

ConnectorTutorial.SitedRectangle

public ConnectorTutorial.SitedRectangle(double x,
                                        double y,
                                        double width,
                                        double height,
                                        java.awt.Color color)
Create a new instance of this figure.

Method Detail

getN

public Site getN()
Get the north site.


getS

public Site getS()
Get the south site.


getE

public Site getE()
Get the east site.


getW

public Site getW()
Get the west site.


transform

public void transform(java.awt.geom.AffineTransform at)
Update the geometry

Specified by:
transform in interface Figure
Overrides:
transform in class BasicFigure

translate

public void translate(double x,
                      double y)
Update the geometry

Specified by:
translate in interface Figure
Overrides:
translate in class BasicRectangle