JHotDraw 7.2

org.jhotdraw.draw
Interface ConnectionFigure

All Superinterfaces:
java.lang.Cloneable, DOMStorable, Figure, java.io.Serializable
All Known Implementing Classes:
DependencyFigure, LabeledLineConnectionFigure, LineConnectionFigure

public interface ConnectionFigure
extends Figure

A ConnectionFigure draws a connection between two Connectors. A ConnectionFigure knows its start and end Connector. A ConnectionFigure can be laid out using a Liner.

Design pattern:
Name: Strategy.
Role: Context.
Partners: Liner as Strategy.

Version:
3.0 2007-05-18 Methods canConnect use now Connector objects as parameters instead of Figure objects. Removed method connectsSame. Added support for BezierPath.Node's.
2.1 2007-02-09 Method setLiner renamed.
2.0 2006-01-14 Changed to support double precision coordinates.
1.0 2003-12-01 Derived from JHotDraw 5.4b1.
Author:
Werner Randelshofer
See Also:
Connector, Liner

Method Summary
 boolean canConnect(Connector start)
          Checks if this ConnectionFigure can be connect to the specified Connector.
 boolean canConnect(Connector start, Connector end)
          Returns true, if this ConnectionFigure can connect the specified Connectors.
 Connector getEndConnector()
          Gets the end Connector.
 Figure getEndFigure()
          Gets the end figure of the connection.
 java.awt.geom.Point2D.Double getEndPoint()
          Gets the end point.
 Liner getLiner()
          Get a Liner object which encapsulated a lineout algorithm for this figure.
 BezierPath.Node getNode(int index)
          Returns the specified node.
 int getNodeCount()
          Gets the node count.
 java.awt.geom.Point2D.Double getPoint(int index)
          Returns the specified point.
 Connector getStartConnector()
          Gets the start Connector.
 Figure getStartFigure()
          Gets the start figure of the connection.
 java.awt.geom.Point2D.Double getStartPoint()
          Gets the start point.
 void lineout()
          A lineout algorithm is used to define how the child components should be laid out in relation to each other.
 void setEndConnector(Connector end)
          Sets the end Connector of the connection.
 void setEndPoint(java.awt.geom.Point2D.Double p)
          Sets the end point.
 void setLiner(Liner newValue)
          Set a Liner object which encapsulated a lineout algorithm for this figure.
 void setNode(int index, BezierPath.Node node)
          Sets the specified node.
 void setPoint(int index, java.awt.geom.Point2D.Double p)
          Sets the specified point.
 void setStartConnector(Connector start)
          Sets the start Connector of the connection.
 void setStartPoint(java.awt.geom.Point2D.Double p)
          Sets the start point.
 void updateConnection()
          Updates the start and end point of the figure and fires figureChanged events.
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, canConnect, changed, clone, contains, createHandles, draw, findCompatibleConnector, findConnector, findFigureInside, getActions, getAttribute, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getDrawingArea, getLayer, getPreferredSize, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, requestRemove, restoreAttributesTo, restoreTransformTo, setAttribute, setBounds, transform, willChange
 
Methods inherited from interface org.jhotdraw.xml.DOMStorable
read, write
 

Method Detail

setStartConnector

void setStartConnector(Connector start)
Sets the start Connector of the connection. Set this to null to disconnect the start connection.

Parameters:
start - the start Connector of the connection

getStartConnector

Connector getStartConnector()
Gets the start Connector. Returns null, if there is no start connection.


setEndConnector

void setEndConnector(Connector end)
Sets the end Connector of the connection. Set this to null to disconnect the end connection.

Parameters:
end - the end Connector of the connection

getEndConnector

Connector getEndConnector()
Gets the end Connector. Returns null, if there is no end connection.


updateConnection

void updateConnection()
Updates the start and end point of the figure and fires figureChanged events.


canConnect

boolean canConnect(Connector start,
                   Connector end)
Returns true, if this ConnectionFigure can connect the specified Connectors. Implement this method to constrain the allowed connections between figures.


canConnect

boolean canConnect(Connector start)
Checks if this ConnectionFigure can be connect to the specified Connector. This is used to provide an early feedback to the user, when he/she creates a new connection.


setStartPoint

void setStartPoint(java.awt.geom.Point2D.Double p)
Sets the start point.


setEndPoint

void setEndPoint(java.awt.geom.Point2D.Double p)
Sets the end point.


setPoint

void setPoint(int index,
              java.awt.geom.Point2D.Double p)
Sets the specified point.


getNodeCount

int getNodeCount()
Gets the node count.


getPoint

java.awt.geom.Point2D.Double getPoint(int index)
Returns the specified point.


getNode

BezierPath.Node getNode(int index)
Returns the specified node.


setNode

void setNode(int index,
             BezierPath.Node node)
Sets the specified node.


getStartPoint

java.awt.geom.Point2D.Double getStartPoint()
Gets the start point.

Specified by:
getStartPoint in interface Figure
See Also:
Figure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)

getEndPoint

java.awt.geom.Point2D.Double getEndPoint()
Gets the end point.

Specified by:
getEndPoint in interface Figure
See Also:
Figure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)

getStartFigure

Figure getStartFigure()
Gets the start figure of the connection. This is a convenience method for doing getStartConnector().getOwner() and handling null cases.


getEndFigure

Figure getEndFigure()
Gets the end figure of the connection. This is a convenience method for doing getEndConnector().getOwner() and handling null cases.


getLiner

Liner getLiner()
Get a Liner object which encapsulated a lineout algorithm for this figure. Typically, a Liner accesses the child components of this figure and arranges their graphical presentation.

Returns:
lineout strategy used by this figure

setLiner

void setLiner(Liner newValue)
Set a Liner object which encapsulated a lineout algorithm for this figure. Typically, a Liner accesses the child components of this figure and arranges their graphical presentation.

Parameters:
newValue - encapsulation of a lineout algorithm.

lineout

void lineout()
A lineout algorithm is used to define how the child components should be laid out in relation to each other. The task for lineouting the child components for presentation is delegated to a Liner which can be plugged in at runtime.


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