Class 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.
    • Constructor Detail

      • SitedRectangle

        public 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
        Parameters:
        at - The transform to be used.
      • translate

        public void translate​(double x,
                              double y)
        Update the geometry
        Specified by:
        translate in interface Figure
        Overrides:
        translate in class BasicRectangle
        Parameters:
        x - The x value to be moved.
        y - The y value to be moved.