Interface ConnectionFigure
-
- All Superinterfaces:
- java.lang.Cloneable, Figure, java.io.Serializable
- All Known Implementing Classes:
- DependencyFigure, LabeledLineConnectionFigure, LineConnectionFigure
public interface ConnectionFigure extends Figure
A connection figure connects two figures with aBezierPath.The location of the start and end points of the bezier path is defined by
Connectorobjects, 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,
ConnectionFigurelistens tofigureRemovedevents sent by the two figures that it connects, and then fires arequestRemoveevent to get removed as well.The bezier path of the connection figure can be laid out using a
Liner.
Design PatternsFramework
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 byConnectors which are owned by the connected figures.
Context:Figure,ConnectionFigure; Strategy:Connector.
-
-
Field Summary
-
Fields inherited from interface org.jhotdraw.draw.Figure
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description booleancanConnect(Connector start)Checks if thisConnectionFigurecan be connect to the specifiedConnector.booleancanConnect(Connector start, Connector end)Returns true, if this ConnectionFigure can connect the specifiedConnectors.ConnectorgetEndConnector()Gets the end Connector.FiguregetEndFigure()Gets the end figure of the connection.java.awt.geom.Point2D.DoublegetEndPoint()Gets the end point.LinergetLiner()Get a Liner object which encapsulated a lineout algorithm for this figure.BezierPath.NodegetNode(int index)Returns the specified node.intgetNodeCount()Gets the node count.java.awt.geom.Point2D.DoublegetPoint(int index)Returns the specified point.ConnectorgetStartConnector()Gets the startConnector.FiguregetStartFigure()Gets the start figure of the connection.java.awt.geom.Point2D.DoublegetStartPoint()Gets the start point.voidlineout()A "lineout" algorithm is used to define how the child components should be laid out in relation to each other.voidsetEndConnector(Connector end)Sets the end Connector of the connection.voidsetEndPoint(java.awt.geom.Point2D.Double p)Sets the end point.voidsetLiner(Liner newValue)Set a Liner object which encapsulated a lineout algorithm for this figure.voidsetNode(int index, BezierPath.Node node)Sets the specified node.voidsetPoint(int index, java.awt.geom.Point2D.Double p)Sets the specified point.voidsetStartConnector(Connector start)Sets the startConnectorof the connection.voidsetStartPoint(java.awt.geom.Point2D.Double p)Sets the start point.voidupdateConnection()Updates the start and end point of the figure and fires figureChanged events.-
Methods inherited from interface org.jhotdraw.draw.Figure
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
-
-
-
-
Method Detail
-
setStartConnector
void setStartConnector(@Nullable Connector start)
Sets the startConnectorof the connection. Set this to null to disconnect the start connection.- Parameters:
start- the start Connector of the connection
-
getStartConnector
@Nullable Connector getStartConnector()
Gets the startConnector. Returns null, if there is no start connection.
-
setEndConnector
void setEndConnector(@Nullable 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
@Nullable 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 specifiedConnectors. Implement this method to constrain the allowed connections between figures.
-
canConnect
boolean canConnect(Connector start)
Checks if thisConnectionFigurecan be connect to the specifiedConnector. 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:
getStartPointin interfaceFigure- 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:
getEndPointin interfaceFigure- See Also:
Figure.setBounds(java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Double)
-
getStartFigure
@Nullable Figure getStartFigure()
Gets the start figure of the connection. This is a convenience method for doing getStartConnector().getOwner() and handling null cases.
-
getEndFigure
@Nullable Figure getEndFigure()
Gets the end figure of the connection. This is a convenience method for doing getEndConnector().getOwner() and handling null cases.
-
getLiner
@Nullable 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(@Nullable 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 layouting the child components for presentation is delegated to a Liner which can be plugged in at runtime.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG