JHotDraw 7.0.6

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

Figures to connect Connectors provided by Figures. A ConnectionFigure knows its start and end Connector. It uses the Connectors to locate its connection points.

A ConnectionFigure can have multiple bezier segments. It provides operations to split and join bezier segments.


Method Summary
 boolean canConnect(Figure start)
          Checks if this ConnectionFigure can be attached to the provided start figure.
 boolean canConnect(Figure start, Figure end)
          Checks if two figures can be connected using this ConnectionFigure.
 boolean connectsSame(ConnectionFigure other)
          Checks if the ConnectionFigure connects the same figures.
 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.
 java.awt.geom.Point2D.Double getPoint(int index)
          Returns the specified point.
 int getPointCount()
          Gets the point count.
 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 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 connection.
 
Methods inherited from interface org.jhotdraw.draw.Figure
addFigureListener, addNotify, addUndoableEditListener, basicSetAttribute, basicSetBounds, basicTransform, canConnect, changed, clone, contains, createHandles, draw, findCompatibleConnector, findConnector, findFigureInside, getActions, getAttribute, getAttributes, getBounds, getCursor, getDecomposition, getDecorator, getDrawBounds, getLayer, getPreferredSize, getRestoreData, getTool, getTooltip, handleDrop, handleMouseClick, includes, invalidate, isConnectorsVisible, isInteractive, isVisible, remap, removeFigureListener, removeNotify, removeUndoableEditListener, requestRemove, restoreTo, setAttribute, setConnectorsVisible, setDecorator, setVisible, 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 figure 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 figure of the connection

getEndConnector

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


updateConnection

void updateConnection()
Updates the connection. FIXME - What das this do?


canConnect

boolean canConnect(Figure start,
                   Figure end)
Checks if two figures can be connected using this ConnectionFigure. Implement this method to constrain the allowed connections between figures.


canConnect

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


connectsSame

boolean connectsSame(ConnectionFigure other)
Checks if the ConnectionFigure connects the same figures. FIXME - What do we need this for?


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.


getPointCount

int getPointCount()
Gets the point count.


getPoint

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


getStartPoint

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

Specified by:
getStartPoint in interface Figure
See Also:
Figure.basicSetBounds(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.basicSetBounds(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

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.


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. It is a good idea to set the Liner in the protected initialize() method so it can be recreated if a GraphicalCompositeFigure is read and restored from a StorableInput stream.

Parameters:
newValue - encapsulation of a lineout algorithm.

Copyright 1996-2006 © JHotDraw.org