org.jhotdraw.draw.connector
Class AbstractConnector
- java.lang.Object
-
- org.jhotdraw.draw.connector.AbstractConnector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Connector, DOMStorable
- Direct Known Subclasses:
- ChopRectangleConnector, LocatorConnector
public class AbstractConnector extends java.lang.Object implements Connector, DOMStorable
This abstract class can be extended to implement aConnector.- See Also:
Connector, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractConnector()Constructs a connector that has no owner.AbstractConnector(Figure owner)Constructs a connector with the given owner figure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.Objectclone()Returns a clone of the Connection.booleancontains(java.awt.geom.Point2D.Double p)Tests if a point is contained in the connector.voiddraw(java.awt.Graphics2D g)Draws the connector.java.awt.geom.Point2D.DoublefindEnd(ConnectionFigure connection)Finds the end point for the connection.java.awt.geom.Point2D.DoublefindStart(ConnectionFigure connection)Finds the start point for the connection.java.awt.geom.Point2D.DoublegetAnchor()Gets the anchor of the connector.java.awt.geom.Rectangle2D.DoublegetBounds()Gets the bounds of the connector.java.awt.geom.Rectangle2D.DoublegetDrawingArea()Gets the drawing area of the connector.FiguregetOwner()Gets the connector's owner.booleanisConnectToDecorator()voidread(DOMInput in)voidsetConnectToDecorator(boolean newValue)voidupdateAnchor(java.awt.geom.Point2D.Double p)Updates the anchor of the connector.voidupdateEndLocation(java.awt.geom.Point2D.Double p)This is called, when the end location of the connection has been moved by the user.voidupdateStartLocation(java.awt.geom.Point2D.Double p)This is called, when the start location of the connection has been moved by the user.voidwrite(DOMOutput out)
-
-
-
Constructor Detail
-
AbstractConnector
public AbstractConnector()
Constructs a connector that has no owner. It is only used internally to resurrect a connectors from a StorableOutput. It should never be called directly.
-
AbstractConnector
public AbstractConnector(Figure owner)
Constructs a connector with the given owner figure.
-
-
Method Detail
-
setConnectToDecorator
public void setConnectToDecorator(boolean newValue)
-
isConnectToDecorator
public boolean isConnectToDecorator()
-
contains
public boolean contains(java.awt.geom.Point2D.Double p)
Tests if a point is contained in the connector.
-
findStart
public java.awt.geom.Point2D.Double findStart(ConnectionFigure connection)
Description copied from interface:ConnectorFinds the start point for the connection.
-
findEnd
public java.awt.geom.Point2D.Double findEnd(ConnectionFigure connection)
Description copied from interface:ConnectorFinds the end point for the connection.
-
getOwner
public Figure getOwner()
Gets the connector's owner.
-
clone
public java.lang.Object clone()
Description copied from interface:ConnectorReturns a clone of the Connection.
-
updateStartLocation
public void updateStartLocation(java.awt.geom.Point2D.Double p)
This is called, when the start location of the connection has been moved by the user. The user has this probably done, to adjust the layout. The connector may use this as a hint to improve the results for the next call to findEnd.
-
updateEndLocation
public void updateEndLocation(java.awt.geom.Point2D.Double p)
This is called, when the end location of the connection has been moved by the user. The user has this probably done, to adjust the layout. The connector may use this as a hint to improve the results for the next call to findStart.
-
getAnchor
public java.awt.geom.Point2D.Double getAnchor()
Description copied from interface:ConnectorGets the anchor of the connector. This is a point at the center or at the bounds of the figure, where the start or the end point will most likely be attached. The purpose of this method is to give the user a hint, where the connector will most likely be attached to the owner of the connector.
-
updateAnchor
public void updateAnchor(java.awt.geom.Point2D.Double p)
Description copied from interface:ConnectorUpdates the anchor of the connector. This method is called when the user manually changes the end point of the ConnectionFigure. The Connector uses this as a hint for choosing a new anchor position.- Specified by:
updateAnchorin interfaceConnector
-
getBounds
public java.awt.geom.Rectangle2D.Double getBounds()
Description copied from interface:ConnectorGets the bounds of the connector. This usually are the bounds of the Figure which owns the Connector. The bounds can differ from the Figure bounds, if the Connector connects to a specific region of the Figure.
-
read
public void read(DOMInput in) throws java.io.IOException
- Specified by:
readin interfaceDOMStorable- Throws:
java.io.IOException
-
write
public void write(DOMOutput out) throws java.io.IOException
- Specified by:
writein interfaceDOMStorable- Throws:
java.io.IOException
-
getDrawingArea
public java.awt.geom.Rectangle2D.Double getDrawingArea()
Description copied from interface:ConnectorGets the drawing area of the connector.- Specified by:
getDrawingAreain interfaceConnector
-
-
DataMelt 3.0 © DataMelt by jWork.ORG