public class LineConnectionFigure extends LineFigure implements ConnectionFigure
ConnectionFigure which connects two figures using a bezier path.
The bezier path can be laid out manually using bezier handles provided
by this figure, or automatically using a Liner which can be
set using the JavaBeans property liner.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LINER_PROPERTY
The name of the JaveBeans property
liner. |
pathchangingDepth, listenerListpropertySupportCONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY| Constructor and Description |
|---|
LineConnectionFigure()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNotify(Drawing drawing)
This method is invoked, when the Figure is being removed from a Drawing.
|
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. |
LineConnectionFigure |
clone()
Returns a clone of the figure, with clones of all aggregated figures,
such as children and decorators.
|
java.util.Collection<Handle> |
createHandles(int detailLevel)
Gets the handles of the figure.
|
BezierPath |
getBezierPath()
FIXME - Liner must work with API of LineConnection!
|
Connector |
getEndConnector()
Gets the end Connector.
|
Figure |
getEndFigure()
Gets the end figure of the connection.
|
Liner |
getLiner()
Get a Liner object which encapsulated a lineout
algorithm for this figure.
|
Connector |
getStartConnector()
Gets the start
Connector. |
Figure |
getStartFigure()
Gets the start figure of the connection.
|
protected void |
handleConnect(Connector start,
Connector end)
Handles the connection of a connection.
|
protected void |
handleDisconnect(Connector start,
Connector end)
Handles the disconnection of a connection.
|
boolean |
handleMouseClick(java.awt.geom.Point2D.Double p,
java.awt.event.MouseEvent evt,
DrawingView view)
Handles a mouse click.
|
void |
lineout()
A "lineout" algorithm is used to define how the child components
should be laid out in relation to each other.
|
void |
read(DOMInput in) |
protected void |
readLiner(DOMInput in) |
protected void |
readPoints(DOMInput in) |
void |
remap(java.util.Map<Figure,Figure> oldToNew,
boolean disconnectIfNotInMap)
After cloning a collection of figures, the ConnectionFigures contained
in this collection still connect to the original figures instead of
to the clones.
|
void |
removeNotify(Drawing drawing)
This method is invoked, when the Figure is being removed from a Drawing.
|
void |
reverseConnection() |
void |
setConnectable(boolean newValue)
ConnectionFigures cannot be connected and always sets connectable to false.
|
void |
setEndConnector(Connector newEnd)
Sets the end Connector of the connection.
|
void |
setEndPoint(java.awt.geom.Point2D.Double p)
Convenience method for setting the point coordinate of 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 p)
Sets a control point.
|
void |
setPoint(int index,
java.awt.geom.Point2D.Double p)
Sets the point coordinate of control point 0 at the specified node.
|
void |
setStartConnector(Connector newStart)
Sets the start
Connector of the connection. |
void |
setStartPoint(java.awt.geom.Point2D.Double p)
Convenience method for setting the point coordinate of the start point.
|
void |
transform(java.awt.geom.AffineTransform tx)
Ensures that a connection is updated if the connection
was moved.
|
void |
updateConnection()
Updates the start and end point of the figure and fires figureChanged
events.
|
void |
validate() |
void |
write(DOMOutput out) |
protected void |
writeLiner(DOMOutput out) |
protected void |
writePoints(DOMOutput out) |
addNode, addNode, chop, contains, drawCaps, drawFill, drawStroke, findCompatibleConnector, findConnector, findNode, findSegment, getBounds, getCappedPath, getCenter, getDrawingArea, getEndPoint, getNode, getNodeCount, getOutermostPoint, getPoint, getPoint, getPointOnPath, getStartPoint, getTransformRestoreData, invalidate, isClosed, joinSegments, joinSegments, layout, removeAllNodes, removeNode, restoreTransformTo, set, setBezierPath, setBounds, setClosed, setPoint, splitSegment, splitSegmentapplyAttributesTo, draw, drawText, get, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes, writeAttributesaddFigureListener, changed, findFigureInside, fireAreaInvalidated, fireAreaInvalidated, fireAreaInvalidated, fireAttributeChanged, fireFigureAdded, fireFigureChanged, fireFigureChanged, fireFigureChanged, fireFigureHandlesChanged, fireFigureRemoved, fireFigureRequestRemove, fireUndoableEditHappened, getActions, getChangingDepth, getConnectors, getCursor, getDecomposition, getDrawing, getFontRenderContext, getLayer, getLock, getPreferredSize, getTool, getToolTipText, handleDrop, includes, isChanging, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, removeFigureListener, requestRemove, setBounds, setRemovable, setSelectable, setTransformable, setVisible, toString, willChangeaddPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetEndPoint, getNode, getNodeCount, getPoint, getStartPointaddFigureListener, addPropertyChangeListener, changed, contains, draw, findCompatibleConnector, findConnector, findFigureInside, get, getActions, getAttributes, getAttributesRestoreData, getBounds, getConnectors, getCursor, getDecomposition, getDrawingArea, getLayer, getPreferredSize, getTool, getToolTipText, getTransformRestoreData, handleDrop, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, removeFigureListener, removePropertyChangeListener, requestRemove, restoreAttributesTo, restoreTransformTo, set, setBounds, willChangepublic static final java.lang.String LINER_PROPERTY
liner.public void transform(java.awt.geom.AffineTransform tx)
transform in interface Figuretransform in class BezierFiguretx - The transformation.Figure.getTransformRestoreData(),
Figure.restoreTransformTo(java.lang.Object)public java.util.Collection<Handle> createHandles(int detailLevel)
createHandles in interface FigurecreateHandles in class LineFiguredetailLevel - The detail level of the handles. Usually this is 0 for
bounding box handles and 1 for point handles. The value -1 is used
by the SelectAreaTracker and the HandleTracker to highlight figures, over which the mouse
pointer is hovering.Handlepublic void setConnectable(boolean newValue)
setConnectable in class AbstractFigurepublic void updateConnection()
ConnectionFigureupdateConnection in interface ConnectionFigurepublic void validate()
validate in class BezierFigurepublic boolean canConnect(Connector start, Connector end)
ConnectionFigureConnectors.
Implement this method to constrain the allowed connections between figures.canConnect in interface ConnectionFigurepublic Connector getEndConnector()
ConnectionFiguregetEndConnector in interface ConnectionFigurepublic Figure getEndFigure()
ConnectionFiguregetEndFigure in interface ConnectionFigurepublic Connector getStartConnector()
ConnectionFigureConnector.
Returns null, if there is no start connection.getStartConnector in interface ConnectionFigurepublic Figure getStartFigure()
ConnectionFiguregetStartFigure in interface ConnectionFigurepublic void setEndConnector(Connector newEnd)
ConnectionFiguresetEndConnector in interface ConnectionFigurenewEnd - the end Connector of the connectionpublic void setStartConnector(Connector newStart)
ConnectionFigureConnector of the connection.
Set this to null to disconnect the start connection.setStartConnector in interface ConnectionFigurenewStart - the start Connector of the connectionpublic void addNotify(Drawing drawing)
addNotify in interface FigureaddNotify in class AbstractFigurehandleConnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)public void removeNotify(Drawing drawing)
removeNotify in interface FigureremoveNotify in class AbstractFigurehandleDisconnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)protected void handleDisconnect(Connector start, Connector end)
Note: This method is only invoked, when the Figure is part of a Drawing. If the Figure is removed from a Drawing, this method is invoked on behalf of the removeNotify call to the Figure.
removeNotify(org.jhotdraw.draw.Drawing)protected void handleConnect(Connector start, Connector end)
Note: This method is only invoked, when the Figure is part of a Drawing. If the Figure is added to a Drawing this method is invoked on behalf of the addNotify call to the Figure.
public LineConnectionFigure clone()
Figureclone in interface Figureclone in class BezierFigurepublic void remap(java.util.Map<Figure,Figure> oldToNew, boolean disconnectIfNotInMap)
Figureremap in interface Figureremap in class AbstractFigurepublic boolean canConnect(Connector start)
ConnectionFigureConnectionFigure 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.canConnect in interface ConnectionFigurepublic boolean handleMouseClick(java.awt.geom.Point2D.Double p,
java.awt.event.MouseEvent evt,
DrawingView view)
handleMouseClick in interface FigurehandleMouseClick in class LineFigurep - The location of the mouse event.evt - The mouse event.view - The drawing view which is the source of the mouse event.protected void readPoints(DOMInput in) throws java.io.IOException
readPoints in class BezierFigurejava.io.IOExceptionpublic void read(DOMInput in) throws java.io.IOException
read in interface DOMStorableread in class BezierFigurejava.io.IOExceptionprotected void readLiner(DOMInput in) throws java.io.IOException
java.io.IOExceptionpublic void write(DOMOutput out) throws java.io.IOException
write in interface DOMStorablewrite in class BezierFigurejava.io.IOExceptionprotected void writeLiner(DOMOutput out) throws java.io.IOException
java.io.IOExceptionprotected void writePoints(DOMOutput out) throws java.io.IOException
writePoints in class BezierFigurejava.io.IOExceptionpublic void setLiner(Liner newValue)
ConnectionFiguresetLiner in interface ConnectionFigurenewValue - encapsulation of a lineout algorithm.public void setNode(int index,
BezierPath.Node p)
BezierFiguresetNode in interface ConnectionFiguresetNode in class BezierFigurepublic void lineout()
ConnectionFigurelineout in interface ConnectionFigurepublic BezierPath getBezierPath()
getBezierPath in class BezierFigurepublic Liner getLiner()
ConnectionFiguregetLiner in interface ConnectionFigurepublic void setStartPoint(java.awt.geom.Point2D.Double p)
BezierFiguresetStartPoint in interface ConnectionFiguresetStartPoint in class BezierFigurepublic void setPoint(int index,
java.awt.geom.Point2D.Double p)
BezierFiguresetPoint in interface ConnectionFiguresetPoint in class BezierFigurepublic void setEndPoint(java.awt.geom.Point2D.Double p)
BezierFiguresetEndPoint in interface ConnectionFiguresetEndPoint in class BezierFigurepublic void reverseConnection()