|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindfusion.diagramming.ConnectionPoint
public class ConnectionPoint
This class represents a connection between an edge and
a node in a graph. It decouples the DiagramLink
class from
the DiagramNode
class, allowing edges to connect different
types of nodes without knowing anything of their
implementation details. Each DiagramLink object contains
two ConnectionPoint instances describing the connections at both
ends of the link.
Field Summary | |
---|---|
protected DiagramNode |
node
|
Constructor Summary | |
---|---|
ConnectionPoint()
Initializes a new instance of the ConnectionPoint class. |
|
ConnectionPoint(DiagramNode node,
DiagramLink link,
boolean incoming)
Initializes a new instance of the ConnectionPoint class between the specified node and link. |
Method Summary | |
---|---|
void |
addLinkToNode()
Adds the link associated with this connection point to the associated node. |
boolean |
calculateIntersections()
Determines whether the end of a link should be aligned to the point where the node contour is intersected by the line connecting the centers of the connected nodes. |
boolean |
canMoveLink(java.awt.geom.Point2D.Float point)
Checks whether the specified point, expressed in document coordinates, is a valid location for this connection point. |
java.awt.geom.Point2D |
getAnchorPos(int anchor)
Returns the point from the node's associated anchor pattern (if any) with the specified index or the link's initial point. |
boolean |
getAnchorPos(int anchorIdx,
java.awt.geom.Point2D.Float point)
Returns the point from the node's associated anchor pattern (if any) with the specified index. |
java.awt.geom.Point2D |
getEndPoint()
Calculates the coordinates of the this connection point expressed in document coordinates. |
protected boolean |
getIncoming()
Gets a flag indicating whether this connection point is at the origin or the destination of the associated link. |
java.awt.geom.Point2D |
getInitialPoint()
Returns a point (usually the center of the bounding rectangle) contained within the associated node. |
java.awt.geom.Point2D |
getIntersection(java.awt.geom.Point2D pt1,
java.awt.geom.Point2D pt2)
Calculates the intersection point between the specified line segment and the contour of the node associated with this connection point. |
protected DiagramLink |
getLink()
Gets the link associated with this connection point. |
protected DiagramNode |
getNode()
Gets the node associated with this connection point. |
java.awt.geom.Rectangle2D |
getNodeRect(boolean rotated)
Returns the bounding rectangle of the node associated with this connection point. |
java.awt.geom.Point2D.Float |
getRelativePosition()
Gets the position of this connection point, relative to the associated node's bounding rectangle, expressed in percents. |
int |
getRow()
Gets the index of a constituent item within the associated node where the link represented by this connection point is connected, or -1, if the link is connected to the node itself. |
boolean |
linkChanges(DiagramNode node,
java.awt.geom.Point2D point)
Checks whether the relationship represented by the associated link would change if the link is attached to the specified node at the specified point. |
boolean |
nodesIntersect(ConnectionPoint connectionPoint)
Checks whether the node associated with the current connection point and the node associated with the specified connection point intersect. |
void |
readExternal(java.io.ObjectInput in)
Deserializes the connection point data. |
void |
removeLinkFromNode()
Removes the link associated with this connection point from the associated node. |
boolean |
sameNode(ConnectionPoint otherConnectionPoint)
Checks whether the current connection point and the specified connection point are associated with the same node. |
void |
saveEndRelative()
Updates the coordinates of the connection point represented by this link, relative to the bounding rectangle of the associated node. |
void |
setRelativePosition(java.awt.geom.Point2D.Float value)
Sets the position of this connection point, relative to the associated node's bounding rectangle, expressed in percents. |
protected void |
updateFromPoint(java.awt.geom.Point2D point)
Updates the connection state according to the specified point, without changing the related node. |
void |
writeExternal(java.io.ObjectOutput out)
Serializes the connection point data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DiagramNode node
Constructor Detail |
---|
public ConnectionPoint(DiagramNode node, DiagramLink link, boolean incoming)
node
- The node whose connection to a link is managed by this ConnectionPoint.link
- The link whose connection to a node is managed by this ConnectionPoint.incoming
- Specifies which end of the link is represented by this ConnectionPoint.public ConnectionPoint()
Method Detail |
---|
public boolean sameNode(ConnectionPoint otherConnectionPoint)
public boolean linkChanges(DiagramNode node, java.awt.geom.Point2D point)
protected void updateFromPoint(java.awt.geom.Point2D point)
public boolean nodesIntersect(ConnectionPoint connectionPoint)
public java.awt.geom.Point2D getIntersection(java.awt.geom.Point2D pt1, java.awt.geom.Point2D pt2)
public java.awt.geom.Rectangle2D getNodeRect(boolean rotated)
public void addLinkToNode()
public void removeLinkFromNode()
public void saveEndRelative()
public java.awt.geom.Point2D getEndPoint()
public java.awt.geom.Point2D getInitialPoint()
public boolean canMoveLink(java.awt.geom.Point2D.Float point)
public boolean calculateIntersections()
public java.awt.geom.Point2D getAnchorPos(int anchor)
public boolean getAnchorPos(int anchorIdx, java.awt.geom.Point2D.Float point)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
protected DiagramLink getLink()
protected DiagramNode getNode()
protected boolean getIncoming()
public java.awt.geom.Point2D.Float getRelativePosition()
public void setRelativePosition(java.awt.geom.Point2D.Float value)
public int getRow()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |