JHotDraw 6.0b1

org.jhotdraw.framework
Interface Connector

All Superinterfaces:
java.io.Serializable, Storable
All Known Implementing Classes:
AbstractConnector, ChopBoxConnector, ChopDiamondConnector, ChopEllipseConnector, ChopPolygonConnector, LocatorConnector, NullConnector, OffsetConnector, PolyLineConnector, ShortestDistanceConnector

public interface Connector
extends java.io.Serializable, Storable

Connectors know how to locate a connection point on a figure. A Connector knows its owning figure and can determine either the start or the endpoint of a given connection figure. A connector has a display box that describes the area of a figure it is responsible for. A connector can be visible but it doesn't have to be.


Design Patterns

 o Strategy
Connector implements the strategy to determine the connections points.
 o Factory Method
Connectors are created by the Figure's factory method connectorAt.


See Also:
Figure.connectorAt(int, int), ConnectionFigure

Method Summary
 java.awt.Point connectorMovedTo(int x, int y)
          Supports connector dragging.
 void connectorVisibility(boolean isVisible, ConnectionFigure courtingConnection)
          Requests that the connector should show itself or hide itself.
 boolean containsPoint(int x, int y)
          Tests if a point is contained in the connector.
 java.awt.Rectangle displayBox()
          Gets the display box of the connector.
 void draw(java.awt.Graphics g)
          Draws this connector.
 Connector finalizeConnector(boolean start)
          Returns a 'finalized' connector.
 java.awt.Point findEnd(ConnectionFigure connection)
          Finds the end point for the connection.
 java.awt.Point findStart(ConnectionFigure connection)
          Finds the start point for the connection.
 Figure owner()
          Gets the connector's owner.
 
Methods inherited from interface org.jhotdraw.util.Storable
read, write
 

Method Detail

findStart

java.awt.Point findStart(ConnectionFigure connection)
Finds the start point for the connection.


findEnd

java.awt.Point findEnd(ConnectionFigure connection)
Finds the end point for the connection.


owner

Figure owner()
Gets the connector's owner.


displayBox

java.awt.Rectangle displayBox()
Gets the display box of the connector.


containsPoint

boolean containsPoint(int x,
                      int y)
Tests if a point is contained in the connector.


draw

void draw(java.awt.Graphics g)
Draws this connector. Connectors don't have to be visible and it is OK leave this method empty.


connectorVisibility

void connectorVisibility(boolean isVisible,
                         ConnectionFigure courtingConnection)
Requests that the connector should show itself or hide itself. The ConnectionFigure which desires to connect to this Connector is passed in. If a connector should show itself it should do so when draw is called, if so desired.


connectorMovedTo

java.awt.Point connectorMovedTo(int x,
                                int y)
Supports connector dragging.


finalizeConnector

Connector finalizeConnector(boolean start)
Returns a 'finalized' connector. Can be used to change Connector.

Parameters:
start - - true if a startConnector
Returns:
- final Connector

JHotDraw 6.0b1