public interface ConnectionFigure extends Figure
BezierPath
.
The location of the start and end points of the bezier path is defined by
Connector
objects, which are supplied by the connected figures.
If a connected figure is removed, the connection figure needs to be
removed as well. To achieve this, ConnectionFigure
listens to
figureRemoved
events sent by the two figures that it connects, and
then fires a requestRemove
event to get removed as well.
The bezier path of the connection figure can be laid out using a Liner
.
Framework
Two figures can be connected using a connection figure. The location of
the start or end point of the connection is handled by a connector object
at each connected figure.
Contract: Figure
,
ConnectionFigure
,
Connector
.
Strategy
The control points of the bezier path of a connection figure can be laid out
using different layout algorithms which are implemented by a liner object.
Context: ConnectionFigure
; Strategy: Liner
.
Strategy
The location of the start and end points of a connection figure are determined
by Connector
s which are owned by the connected figures.
Context: Figure
, ConnectionFigure
; Strategy: Connector
.
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
Modifier and Type | Method and Description |
---|---|
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
Connector s. |
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.
|
addFigureListener, addNotify, addPropertyChangeListener, changed, clone, contains, createHandles, draw, findCompatibleConnector, findConnector, findFigureInside, get, getActions, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getDrawingArea, getLayer, getPreferredSize, getTool, getToolTipText, getTransformRestoreData, handleDrop, handleMouseClick, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, remap, removeFigureListener, removeNotify, removePropertyChangeListener, requestRemove, restoreAttributesTo, restoreTransformTo, set, setBounds, transform, willChange
void setStartConnector(Connector start)
Connector
of the connection.
Set this to null to disconnect the start connection.start
- the start Connector of the connectionConnector getStartConnector()
Connector
.
Returns null, if there is no start connection.void setEndConnector(Connector end)
end
- the end Connector of the connectionConnector getEndConnector()
void updateConnection()
boolean canConnect(Connector start, Connector end)
Connector
s.
Implement this method to constrain the allowed connections between figures.boolean canConnect(Connector start)
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.void setStartPoint(java.awt.geom.Point2D.Double p)
void setEndPoint(java.awt.geom.Point2D.Double p)
void setPoint(int index, java.awt.geom.Point2D.Double p)
int getNodeCount()
java.awt.geom.Point2D.Double getPoint(int index)
BezierPath.Node getNode(int index)
void setNode(int index, BezierPath.Node node)
java.awt.geom.Point2D.Double getStartPoint()
getStartPoint
in interface Figure
Figure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)
java.awt.geom.Point2D.Double getEndPoint()
getEndPoint
in interface Figure
Figure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)
Figure getStartFigure()
Figure getEndFigure()
Liner getLiner()
void setLiner(Liner newValue)
newValue
- encapsulation of a lineout algorithm.void lineout()