JHotDraw 7.3.1

org.jhotdraw.draw
Interface Connector

All Superinterfaces:
java.lang.Cloneable, DOMStorable, java.io.Serializable
All Known Implementing Classes:
AbstractConnector, ChopBezierConnector, ChopDiamondConnector, ChopEllipseConnector, ChopRectangleConnector, ChopRoundRectangleConnector, ChopTriangleConnector, LocatorConnector, StickyRectangleConnector

public interface Connector
extends java.lang.Cloneable, java.io.Serializable, DOMStorable

A connector knows how to locate the start point or the end point of a ConnectionFigure on a connected figure.

A connector is owned by a Figure.

A connector knows its owning figure. A connector has bounds which describe the area of the figure it is responsible for. A connector can be drawn, so that users can see the bounds of the connector.


Design Patterns

Framework
The following interfaces define the contracts of a framework for structured drawing editors:
Contract: Drawing, Figure, CompositeFigure, ConnectionFigure, Connector, DrawingView, DrawingEditor, Handle and Tool.

Strategy
The location of the start and end points of a connection figure are determined by Connectors which are owned by the connected figures.
Context: Figure, ConnectionFigure; Strategy: Connector.


Version:
$Id: Connector.java 527 2009-06-07 14:28:19Z rawcoder $
Author:
Werner Randelshofer

Method Summary
 java.lang.Object clone()
          Returns a clone of the Connection.
 boolean contains(java.awt.geom.Point2D.Double p)
          Tests if a point is contained in the connector.
 void draw(java.awt.Graphics2D g)
          Draws the connector.
 java.awt.geom.Point2D.Double findEnd(ConnectionFigure connection)
          Finds the end point for the connection.
 java.awt.geom.Point2D.Double findStart(ConnectionFigure connection)
          Finds the start point for the connection.
 java.awt.geom.Point2D.Double getAnchor()
          Gets the anchor of the connector.
 java.awt.geom.Rectangle2D.Double getBounds()
          Gets the bounds of the connector.
 java.awt.geom.Rectangle2D.Double getDrawingArea()
          Gets the drawing area of the connector.
 Figure getOwner()
          Gets the connector's owner.
 void updateAnchor(java.awt.geom.Point2D.Double p)
          Updates the anchor of the connector.
 
Methods inherited from interface org.jhotdraw.xml.DOMStorable
read, write
 

Method Detail

findStart

java.awt.geom.Point2D.Double findStart(ConnectionFigure connection)
Finds the start point for the connection.


findEnd

java.awt.geom.Point2D.Double findEnd(ConnectionFigure connection)
Finds the end point for the connection.


getOwner

Figure getOwner()
Gets the connector's owner.


getAnchor

java.awt.geom.Point2D.Double getAnchor()
Gets the anchor of the connector. This is a point at the center or at the bounds of the figure, where the start or the end point will most likely be attached. The purpose of this method is to give the user a hint, where the connector will most likely be attached to the owner of the connector.


getBounds

java.awt.geom.Rectangle2D.Double getBounds()
Gets the bounds of the connector. This usually are the bounds of the Figure which owns the Connector. The bounds can differ from the Figure bounds, if the Connector connects to a specific region of the Figure.


updateAnchor

void updateAnchor(java.awt.geom.Point2D.Double p)
Updates the anchor of the connector. This method is called when the user manually changes the end point of the ConnectionFigure. The Connector uses this as a hint for choosing a new anchor position.


contains

boolean contains(java.awt.geom.Point2D.Double p)
Tests if a point is contained in the connector.


clone

java.lang.Object clone()
Returns a clone of the Connection.


getDrawingArea

java.awt.geom.Rectangle2D.Double getDrawingArea()
Gets the drawing area of the connector.


draw

void draw(java.awt.Graphics2D g)
Draws the connector.


Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.