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 . |
path
changingDepth, listenerList
propertySupport
CONNECTABLE_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
Connector s. |
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, splitSegment
applyAttributesTo, draw, drawText, get, getAttributeKey, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, readAttributes, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes, writeAttributes
addFigureListener, 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, willChange
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEndPoint, getNode, getNodeCount, getPoint, getStartPoint
addFigureListener, 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, willChange
public static final java.lang.String LINER_PROPERTY
liner
.public void transform(java.awt.geom.AffineTransform tx)
transform
in interface Figure
transform
in class BezierFigure
tx
- The transformation.Figure.getTransformRestoreData()
,
Figure.restoreTransformTo(java.lang.Object)
public java.util.Collection<Handle> createHandles(int detailLevel)
createHandles
in interface Figure
createHandles
in class LineFigure
detailLevel
- 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.Handle
public void setConnectable(boolean newValue)
setConnectable
in class AbstractFigure
public void updateConnection()
ConnectionFigure
updateConnection
in interface ConnectionFigure
public void validate()
validate
in class BezierFigure
public boolean canConnect(Connector start, Connector end)
ConnectionFigure
Connector
s.
Implement this method to constrain the allowed connections between figures.canConnect
in interface ConnectionFigure
public Connector getEndConnector()
ConnectionFigure
getEndConnector
in interface ConnectionFigure
public Figure getEndFigure()
ConnectionFigure
getEndFigure
in interface ConnectionFigure
public Connector getStartConnector()
ConnectionFigure
Connector
.
Returns null, if there is no start connection.getStartConnector
in interface ConnectionFigure
public Figure getStartFigure()
ConnectionFigure
getStartFigure
in interface ConnectionFigure
public void setEndConnector(Connector newEnd)
ConnectionFigure
setEndConnector
in interface ConnectionFigure
newEnd
- the end Connector of the connectionpublic void setStartConnector(Connector newStart)
ConnectionFigure
Connector
of the connection.
Set this to null to disconnect the start connection.setStartConnector
in interface ConnectionFigure
newStart
- the start Connector of the connectionpublic void addNotify(Drawing drawing)
addNotify
in interface Figure
addNotify
in class AbstractFigure
handleConnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)
public void removeNotify(Drawing drawing)
removeNotify
in interface Figure
removeNotify
in class AbstractFigure
handleDisconnect(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()
Figure
clone
in interface Figure
clone
in class BezierFigure
public void remap(java.util.Map<Figure,Figure> oldToNew, boolean disconnectIfNotInMap)
Figure
remap
in interface Figure
remap
in class AbstractFigure
public boolean canConnect(Connector start)
ConnectionFigure
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.canConnect
in interface ConnectionFigure
public boolean handleMouseClick(java.awt.geom.Point2D.Double p, java.awt.event.MouseEvent evt, DrawingView view)
handleMouseClick
in interface Figure
handleMouseClick
in class LineFigure
p
- 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 BezierFigure
java.io.IOException
public void read(DOMInput in) throws java.io.IOException
read
in interface DOMStorable
read
in class BezierFigure
java.io.IOException
protected void readLiner(DOMInput in) throws java.io.IOException
java.io.IOException
public void write(DOMOutput out) throws java.io.IOException
write
in interface DOMStorable
write
in class BezierFigure
java.io.IOException
protected void writeLiner(DOMOutput out) throws java.io.IOException
java.io.IOException
protected void writePoints(DOMOutput out) throws java.io.IOException
writePoints
in class BezierFigure
java.io.IOException
public void setLiner(Liner newValue)
ConnectionFigure
setLiner
in interface ConnectionFigure
newValue
- encapsulation of a lineout algorithm.public void setNode(int index, BezierPath.Node p)
BezierFigure
setNode
in interface ConnectionFigure
setNode
in class BezierFigure
public void lineout()
ConnectionFigure
lineout
in interface ConnectionFigure
public BezierPath getBezierPath()
getBezierPath
in class BezierFigure
public Liner getLiner()
ConnectionFigure
getLiner
in interface ConnectionFigure
public void setStartPoint(java.awt.geom.Point2D.Double p)
BezierFigure
setStartPoint
in interface ConnectionFigure
setStartPoint
in class BezierFigure
public void setPoint(int index, java.awt.geom.Point2D.Double p)
BezierFigure
setPoint
in interface ConnectionFigure
setPoint
in class BezierFigure
public void setEndPoint(java.awt.geom.Point2D.Double p)
BezierFigure
setEndPoint
in interface ConnectionFigure
setEndPoint
in class BezierFigure
public void reverseConnection()