org.jhotdraw.draw
Class LineConnectionFigure
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.draw.AbstractFigure
-
- org.jhotdraw.draw.AbstractAttributedFigure
-
- org.jhotdraw.draw.BezierFigure
-
- org.jhotdraw.draw.LineFigure
-
- org.jhotdraw.draw.LineConnectionFigure
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, ConnectionFigure, Figure, DOMStorable
- Direct Known Subclasses:
- DependencyFigure, LabeledLineConnectionFigure
public class LineConnectionFigure extends LineFigure implements ConnectionFigure
AConnectionFigurewhich 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
Linerwhich can be set using the JavaBeans propertyliner.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringLINER_PROPERTYThe name of the JaveBeans propertyliner.-
Fields inherited from interface org.jhotdraw.draw.Figure
CONNECTABLE_PROPERTY, REMOVABLE_PROPERTY, SELECTABLE_PROPERTY, TRANSFORMABLE_PROPERTY
-
-
Constructor Summary
Constructors Constructor and Description LineConnectionFigure()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddNotify(Drawing drawing)This method is invoked, when the Figure is being removed from a Drawing.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.LineConnectionFigureclone()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.BezierPathgetBezierPath()FIXME - Liner must work with API of LineConnection!ConnectorgetEndConnector()Gets the end Connector.FiguregetEndFigure()Gets the end figure of the connection.LinergetLiner()Get a Liner object which encapsulated a lineout algorithm for this figure.ConnectorgetStartConnector()Gets the startConnector.FiguregetStartFigure()Gets the start figure of the connection.booleanhandleMouseClick(java.awt.geom.Point2D.Double p, java.awt.event.MouseEvent evt, DrawingView view)Handles a mouse click.voidlineout()A "lineout" algorithm is used to define how the child components should be laid out in relation to each other.voidread(DOMInput in)voidremap(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.voidremoveNotify(Drawing drawing)This method is invoked, when the Figure is being removed from a Drawing.voidreverseConnection()voidsetConnectable(boolean newValue)ConnectionFigures cannot be connected and always sets connectable to false.voidsetEndConnector(Connector newEnd)Sets the end Connector of the connection.voidsetEndPoint(java.awt.geom.Point2D.Double p)Convenience method for setting the point coordinate of the end point.voidsetLiner(Liner newValue)Set a Liner object which encapsulated a lineout algorithm for this figure.voidsetNode(int index, BezierPath.Node p)Sets a control point.voidsetPoint(int index, java.awt.geom.Point2D.Double p)Sets the point coordinate of control point 0 at the specified node.voidsetStartConnector(Connector newStart)Sets the startConnectorof the connection.voidsetStartPoint(java.awt.geom.Point2D.Double p)Convenience method for setting the point coordinate of the start point.voidtransform(java.awt.geom.AffineTransform tx)Ensures that a connection is updated if the connection was moved.voidupdateConnection()Updates the start and end point of the figure and fires figureChanged events.voidvalidate()voidwrite(DOMOutput out)-
Methods inherited from class org.jhotdraw.draw.BezierFigure
addNode, addNode, chop, contains, findCompatibleConnector, findConnector, findNode, findSegment, getBounds, getCenter, getDrawingArea, getEndPoint, getNode, getNodeCount, getOutermostPoint, getPoint, getPoint, getPointOnPath, getStartPoint, getTransformRestoreData, invalidate, isClosed, joinSegments, joinSegments, layout, removeNode, restoreTransformTo, set, setBezierPath, setBounds, setClosed, setPoint, splitSegment, splitSegment
-
Methods inherited from class org.jhotdraw.draw.AbstractAttributedFigure
draw, get, getAttributes, getAttributesRestoreData, getStroke, getStrokeMiterLimitFactor, hasAttribute, isAttributeEnabled, removeAttribute, restoreAttributesTo, setAttributeEnabled, setAttributes
-
Methods inherited from class org.jhotdraw.draw.AbstractFigure
addFigureListener, changed, findFigureInside, fireAreaInvalidated, fireFigureChanged, getActions, getConnectors, getCursor, getDecomposition, getLayer, getPreferredSize, getTool, getToolTipText, handleDrop, includes, isConnectable, isRemovable, isSelectable, isTransformable, isVisible, removeFigureListener, requestRemove, setBounds, setRemovable, setSelectable, setTransformable, setVisible, toString, willChange
-
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jhotdraw.draw.ConnectionFigure
getEndPoint, getNode, getNodeCount, getPoint, getStartPoint
-
Methods inherited from interface org.jhotdraw.draw.Figure
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
-
-
-
-
Field Detail
-
LINER_PROPERTY
public static final java.lang.String LINER_PROPERTY
The name of the JaveBeans propertyliner.- See Also:
- Constant Field Values
-
-
Method Detail
-
transform
public void transform(java.awt.geom.AffineTransform tx)
Ensures that a connection is updated if the connection was moved.- Specified by:
transformin interfaceFigure- Overrides:
transformin classBezierFigure- Parameters:
tx- The transformation.- See Also:
Figure.getTransformRestoreData(),Figure.restoreTransformTo(java.lang.Object)
-
createHandles
public java.util.Collection<Handle> createHandles(int detailLevel)
Gets the handles of the figure. It returns the normal PolylineHandles but adds ChangeConnectionHandles at the start and end.- Specified by:
createHandlesin interfaceFigure- Overrides:
createHandlesin classLineFigure- Parameters:
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.- Returns:
- a Collection of handles
- See Also:
Handle
-
setConnectable
public void setConnectable(boolean newValue)
ConnectionFigures cannot be connected and always sets connectable to false.- Overrides:
setConnectablein classAbstractFigure
-
updateConnection
public void updateConnection()
Description copied from interface:ConnectionFigureUpdates the start and end point of the figure and fires figureChanged events.- Specified by:
updateConnectionin interfaceConnectionFigure
-
validate
public void validate()
-
canConnect
public boolean canConnect(Connector start, Connector end)
Description copied from interface:ConnectionFigureReturns true, if this ConnectionFigure can connect the specifiedConnectors. Implement this method to constrain the allowed connections between figures.- Specified by:
canConnectin interfaceConnectionFigure
-
getEndConnector
public Connector getEndConnector()
Description copied from interface:ConnectionFigureGets the end Connector. Returns null, if there is no end connection.- Specified by:
getEndConnectorin interfaceConnectionFigure
-
getEndFigure
public Figure getEndFigure()
Description copied from interface:ConnectionFigureGets the end figure of the connection. This is a convenience method for doing getEndConnector().getOwner() and handling null cases.- Specified by:
getEndFigurein interfaceConnectionFigure
-
getStartConnector
public Connector getStartConnector()
Description copied from interface:ConnectionFigureGets the startConnector. Returns null, if there is no start connection.- Specified by:
getStartConnectorin interfaceConnectionFigure
-
getStartFigure
public Figure getStartFigure()
Description copied from interface:ConnectionFigureGets the start figure of the connection. This is a convenience method for doing getStartConnector().getOwner() and handling null cases.- Specified by:
getStartFigurein interfaceConnectionFigure
-
setEndConnector
public void setEndConnector(Connector newEnd)
Description copied from interface:ConnectionFigureSets the end Connector of the connection. Set this to null to disconnect the end connection.- Specified by:
setEndConnectorin interfaceConnectionFigure- Parameters:
newEnd- the end Connector of the connection
-
setStartConnector
public void setStartConnector(Connector newStart)
Description copied from interface:ConnectionFigureSets the startConnectorof the connection. Set this to null to disconnect the start connection.- Specified by:
setStartConnectorin interfaceConnectionFigure- Parameters:
newStart- the start Connector of the connection
-
addNotify
public void addNotify(Drawing drawing)
This method is invoked, when the Figure is being removed from a Drawing. This method invokes handleConnect, if the Figure is connected.- Specified by:
addNotifyin interfaceFigure- Overrides:
addNotifyin classAbstractFigure- See Also:
handleConnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)
-
removeNotify
public void removeNotify(Drawing drawing)
This method is invoked, when the Figure is being removed from a Drawing. This method invokes handleDisconnect, if the Figure is connected.- Specified by:
removeNotifyin interfaceFigure- Overrides:
removeNotifyin classAbstractFigure- See Also:
handleDisconnect(org.jhotdraw.draw.connector.Connector, org.jhotdraw.draw.connector.Connector)
-
clone
public LineConnectionFigure clone()
Description copied from interface:FigureReturns a clone of the figure, with clones of all aggregated figures, such as children and decorators. The cloned figure does not clone the list of FigureListeners from its original.- Specified by:
clonein interfaceFigure- Overrides:
clonein classBezierFigure
-
remap
public void remap(java.util.Map<Figure,Figure> oldToNew, boolean disconnectIfNotInMap)
Description copied from interface:FigureAfter cloning a collection of figures, the ConnectionFigures contained in this collection still connect to the original figures instead of to the clones. Using This operation and providing a map, which maps from the original collection of figures to the new collection, connections can be remapped to the new figures.- Specified by:
remapin interfaceFigure- Overrides:
remapin classAbstractFigure
-
canConnect
public boolean canConnect(Connector start)
Description copied from interface:ConnectionFigureChecks 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.- Specified by:
canConnectin interfaceConnectionFigure
-
handleMouseClick
public boolean handleMouseClick(java.awt.geom.Point2D.Double p, java.awt.event.MouseEvent evt, DrawingView view)Handles a mouse click.- Specified by:
handleMouseClickin interfaceFigure- Overrides:
handleMouseClickin classLineFigure- Parameters:
p- The location of the mouse event.evt- The mouse event.view- The drawing view which is the source of the mouse event.- Returns:
- Returns true, if the event was consumed.
-
read
public void read(DOMInput in) throws java.io.IOException
- Specified by:
readin interfaceDOMStorable- Overrides:
readin classBezierFigure- Throws:
java.io.IOException
-
write
public void write(DOMOutput out) throws java.io.IOException
- Specified by:
writein interfaceDOMStorable- Overrides:
writein classBezierFigure- Throws:
java.io.IOException
-
setLiner
public void setLiner(Liner newValue)
Description copied from interface:ConnectionFigureSet 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.- Specified by:
setLinerin interfaceConnectionFigure- Parameters:
newValue- encapsulation of a lineout algorithm.
-
setNode
public void setNode(int index, BezierPath.Node p)Description copied from class:BezierFigureSets a control point.- Specified by:
setNodein interfaceConnectionFigure- Overrides:
setNodein classBezierFigure
-
lineout
public void lineout()
Description copied from interface:ConnectionFigureA "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.- Specified by:
lineoutin interfaceConnectionFigure
-
getBezierPath
public BezierPath getBezierPath()
FIXME - Liner must work with API of LineConnection!- Overrides:
getBezierPathin classBezierFigure
-
getLiner
public Liner getLiner()
Description copied from interface:ConnectionFigureGet 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.- Specified by:
getLinerin interfaceConnectionFigure- Returns:
- lineout strategy used by this figure
-
setStartPoint
public void setStartPoint(java.awt.geom.Point2D.Double p)
Description copied from class:BezierFigureConvenience method for setting the point coordinate of the start point. If the BezierFigure has not at least two nodes, nodes are added to the figure until the BezierFigure has at least two nodes.- Specified by:
setStartPointin interfaceConnectionFigure- Overrides:
setStartPointin classBezierFigure
-
setPoint
public void setPoint(int index, java.awt.geom.Point2D.Double p)Description copied from class:BezierFigureSets the point coordinate of control point 0 at the specified node.- Specified by:
setPointin interfaceConnectionFigure- Overrides:
setPointin classBezierFigure
-
setEndPoint
public void setEndPoint(java.awt.geom.Point2D.Double p)
Description copied from class:BezierFigureConvenience method for setting the point coordinate of the end point. If the BezierFigure has not at least two nodes, nodes are added to the figure until the BezierFigure has at least two nodes.- Specified by:
setEndPointin interfaceConnectionFigure- Overrides:
setEndPointin classBezierFigure
-
reverseConnection
public void reverseConnection()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG