public class DiagramLink extends DiagramItem implements InplaceEditable, Routable
DiagramLink class. Links connect at most two nodes, which can be
accessed via the getOrigin() and getDestination() methods. If
linked to node anchor points, the point indices can be accessed using the
getOriginAnchor() and getDestinationAnchor() methods. To control
whether users are allowed to move link end points, call one or both of the
setAllowMoveStart(boolean) and setAllowMoveEnd(boolean).
Links are built of smaller parts, called segments, which can be straight
lines, cascading orthogonal lines or Bezier curves. The type of segments can
be set through the setShape(com.mindfusion.diagramming.LinkShape) method. The number of links segments
is specified via the setSegmentCount(int) method. Access to the control
point locations is provided via the getControlPoints() method.
Usually only the start and end segments of a link are updated if the nodes
it connects are moved around. Number, orientation and/or position of link
segments can change dynamically in various ways depending on the values set
through setAutoRoute(boolean), setDynamic(boolean) and setRetainForm(boolean).
The setCascadeOrientation(com.mindfusion.diagramming.Orientation) method lets you specify the orientation
of the first segment of a link of style Cascading.
If setAutoSnapToNode(boolean) is enabled, a link automatically aligns
its end points to the border of the origin or destination nodes when a user
moves the first or last control points. This has a higher priority than
aligning to the grid, but a lower priority than aligning to an anchor point.
Links can display distinct arrowhead shapes at their ends. These shapes can
be set via the setHeadShape(java.lang.String) and setBaseShape(java.lang.String) methods. The
size of the arrowhead and base images can be specified respectively via the
setHeadShapeSize(float) and setBaseShapeSize(float) methods. Arrowhead
shapes can be displayed in the middle of each segment to facilitate users by
distinguishing different links. The type and size of these shapes is set
via the setIntermediateShape(java.lang.String) and setIntermediateShapeSize(float) methods.
The outlines of arrowhead shapes are painted with the pen specified via
setHeadPen(com.mindfusion.drawing.Pen).
Links can have some text associated with them, displayed as specified via
the setText(java.lang.String), DiagramItem.setTextBrush(com.mindfusion.drawing.Brush) and setTextStyle(com.mindfusion.diagramming.LinkTextStyle) methods.
brush, cycleDetected, cycleProtect, modifyDX, modifyDY, modifyHandle, modifying, pen, ptEnd, ptMdfLast, ptOrg, ptSavedEnd, ptSavedOrg, subordinateGroup| Constructor and Description |
|---|
DiagramLink()
Used internally to implement serialization functionality.
|
DiagramLink(Diagram parent)
Initializes a new instance of the DiagramLink class by setting its
properties to the default values defined in the specified diagram.
|
DiagramLink(Diagram parent,
DiagramNode src,
DiagramNode dest)
Initializes a new instance of the DiagramLink class by setting its
properties to the default values defined in the specified diagram,
and setting the specified nodes as link's origin and destination.
|
DiagramLink(Diagram parent,
DiagramNode src,
java.awt.geom.Point2D dest)
Initializes a new instance of the DiagramLink class by setting its
properties to the default values defined in the specified diagram,
and setting the specified nodes as link's origin and destination.
|
DiagramLink(DiagramLink prototype,
DiagramNode src,
DiagramNode dest)
Initializes a new instance of the DiagramLink class by copying its
properties from another link, and setting the specified nodes
as link's origin and destination.
|
DiagramLink(Diagram parent,
java.awt.geom.Point2D src,
DiagramNode dest)
Initializes a new instance of the DiagramLink class by setting its
properties to the default values defined in the specified diagram,
and setting the specified nodes as link's origin and destination.
|
DiagramLink(Diagram parent,
java.awt.geom.Point2D src,
java.awt.geom.Point2D dest)
Initializes a new instance of the DiagramLink class by setting its
properties to the default values defined in the specified diagram,
and setting the specified points as link's origin and destination.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLabel(LinkLabel label)
Adds a new label to this link.
|
LinkLabel |
addLabel(java.lang.String text)
Adds a new label to this link.
|
protected boolean |
allowCreate(java.awt.geom.Point2D current,
InteractionState ist)
|
protected boolean |
allowModify(java.awt.geom.Point2D current,
InteractionState ist)
Invoked during interactive modification of items
to test whether the operation can be completed in
the current context.
|
void |
applyRoute(java.util.ArrayList<java.awt.Point> routePoints,
RouteDescriptor routeDescriptor,
PointList resultPoints) |
protected void |
cancelModify(InteractionState ist)
|
DiagramItem |
clone(boolean clipboard)
Creates a copy of this link.
|
protected void |
completeCreate(java.awt.geom.Point2D end)
|
protected void |
completeModify(java.awt.geom.Point2D end,
InteractionState ist)
Invoked when the item modification has been completed.
|
boolean |
containsPoint(java.awt.geom.Point2D point)
DiagramItem.containsPoint(Point2D) override. |
boolean |
containsPoint(java.awt.geom.Point2D point,
float threshold)
|
protected DiagramItemProperties |
createProperties()
DiagramItem.createProperties() override. |
RouteDescriptor |
createRouteDescriptor() |
protected DiagramItemState |
createState()
DiagramItem.createState() override. |
protected void |
draw(java.awt.Graphics2D graphics,
RenderOptions options)
|
void |
drawArrowhead(java.awt.Graphics2D graphics,
Pen pen,
Brush b,
Shape shape,
java.awt.geom.Point2D pivot,
java.awt.geom.Point2D position,
java.awt.geom.Point2D segmentStart,
double size,
boolean shadow)
Draws an arrowhead shape.
|
protected void |
drawShadow(java.awt.Graphics2D graphics,
RenderOptions options)
|
boolean |
getAllowMoveEnd()
Gets a value indicating whether users are allowed
to move the last control point of a link.
|
boolean |
getAllowMoveStart()
Gets a value indicating whether users are allowed
to move the first control point of a link.
|
boolean |
getAutoRoute()
Gets a value indicating whether a link should automatically find
its way between nodes so that it will not cross other nodes.
|
boolean |
getAutoSnapToNode()
Gets a value indicating whether the end points of a link are
automatically aligned to node borders while a user modifies the link.
|
Brush |
getBaseBrush()
Gets the brush used to fill the arrowhead drawn at the link base.
|
Shape |
getBaseShape()
Gets the shape that is displayed at the origin of a link.
|
float |
getBaseShapeSize()
Gets the size of the shape displayed at the origin of a link.
|
java.awt.geom.Rectangle2D.Float |
getBounds()
Gets the smallest rectangle that bounds all points of a link.
|
Orientation |
getCascadeOrientation()
Gets the orientation of the first segment of a cascading link.
|
PointList |
getControlPoints()
Gets the list of control points of a link.
|
CustomDraw |
getCustomDraw()
Gets the type of custom drawing performed on this link.
|
DiagramNode |
getDestination()
Gets the destination node of a link.
|
int |
getDestinationAnchor()
Gets the index of the anchor point to which
a link is connected at its destination.
|
ConnectionPoint |
getDestinationConnection()
Gets the
ConnectionPoint object representing the link connection to its destination node. |
int |
getDestinationIndex()
Gets the index of the row of a table or the anchor point of a box
to which a link is connected.
|
boolean |
getDynamic()
Gets whether a link should automatically update the position
of its end points while a node related to the link is moved, so that
the link end segments always point to the center of the link's nodes.
|
java.awt.geom.Rectangle2D |
getEditRect(DiagramItem item,
java.awt.geom.Point2D mousePosition)
Implements InplaceEditable.getEditRect.
|
Pen |
getEffectiveHeadPen()
Creates a
Pen object representing the currently
effective head pen of the link. |
java.awt.geom.Point2D.Float |
getEndPoint()
Gets the position of the last control point of this link.
|
HandlesStyle |
getHandlesStyle()
Gets the appearance of the link's selection handles.
|
Brush |
getHeadBrush()
Gets the brush used to fill the arrowhead drawn at the link's destination.
|
Pen |
getHeadPen()
Gets the pen used to draw the arrowhead shapes outlines.
|
Shape |
getHeadShape()
Gets the shape of the arrowhead.
|
float |
getHeadShapeSize()
Gets the size of the arrowhead shape.
|
Brush |
getIntermediateBrush()
Gets the brush used to fill the arrowheads drawn at the middle of link segments.
|
Shape |
getIntermediateShape()
Gets the shape that is displayed at the middle of each segment of a link.
|
float |
getIntermediateShapeSize()
Gets the size of the shape displayed at
the middle of each segment of a link.
|
java.util.ArrayList<LinkLabel> |
getLabels()
Returns the list of all labels displayed by this link.
|
float |
getLength()
Gets the length of this link.
|
int |
getLongestHSegment()
Returns the index of the longest non-vertical segment of the link.
|
DiagramNode |
getOrigin()
Gets the origin node of a link.
|
int |
getOriginAnchor()
Gets the index of the anchor point to which
a link is connected at its origin.
|
ConnectionPoint |
getOriginConnection()
Gets the
ConnectionPoint object representing the link connection to its origin node. |
int |
getOriginIndex()
Gets the index of the row of a table or the anchor point of a box
to which a link is connected.
|
protected java.awt.geom.Rectangle2D |
getRepaintRect(boolean includeConnected)
Gets the repaint region for this item, taking into account
factors such as pen, selection handles and shadow.
|
boolean |
getRetainForm()
Gets a value indicating whether a link should preserve its original
shape while the nodes related to that link are moved around.
|
int |
getSegmentCount()
Gets the number of segments of this link.
|
LinkShape |
getShape()
Gets the shape of a link.
|
java.awt.geom.Point2D.Float |
getStartPoint()
Gets the position of the first control point of this link.
|
java.lang.String |
getText()
Gets the text of the link's label.
|
LinkTextStyle |
getTextStyle()
Gets the link's text placement and orientation.
|
java.lang.String |
getTextToEdit()
Implements InplaceEditable.getTextToEdit.
|
AdjustmentHandle |
hitTestHandle(java.awt.geom.Point2D point)
|
DiagramLinkBuilder |
init()
Returns a DiagramLinkBuilder object used to configure this DiagramLink instance.
|
boolean |
intersects(DiagramLink link)
Checks whether this link intersects the specified link.
|
boolean |
intersects(DiagramNode node)
Determines whether a link intersects the specified node.
|
boolean |
isConnected()
Gets a value indicating whether a link is connected to any nodes.
|
ItemLabel |
labelFromPoint(java.awt.geom.Point2D point)
Returns the label whose layout rectangle contains the specified point.
|
protected void |
loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Loads the link from a JSON object.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Loads the item content from an XML element.
|
protected void |
onAdd()
DiagramItem.onAdd() override. |
protected void |
onChangeFont() |
protected void |
onLoad(Diagram diagram)
|
protected void |
onModify(java.awt.geom.Point2D mousePosition,
int adjustmentHandle)
Called when an item is modified
|
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
void |
reassignAnchorPoints()
Chooses new anchor points for a link.
|
void |
removeLabel(LinkLabel label)
Removes the specified label from this link.
|
protected void |
restoreProperties(DiagramItemProperties props)
|
protected void |
restoreState(DiagramItemState state)
|
boolean |
route()
Sets the link control points so that a link goes between its
related nodes without crossing other nodes.
|
protected void |
saveProperties(DiagramItemProperties props)
|
protected void |
saveState(DiagramItemState state)
|
protected void |
saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Saves the link as a JSON object.
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Saves the item content into an XML element.
|
void |
setAllowMoveEnd(boolean value)
Sets a value indicating whether users are allowed
to move the last control point of a link.
|
void |
setAllowMoveStart(boolean value)
Sets a value indicating whether users are allowed
to move the first control point of a link.
|
void |
setAutoRoute(boolean value)
Sets a value indicating whether a link should automatically find
its way between nodes so that it will not cross other nodes.
|
void |
setAutoSnapToNode(boolean value)
Sets a value indicating whether the end points of a link should be
automatically aligned to node borders while a user modifies the link.
|
void |
setBaseBrush(Brush value)
Sets a brush used to fill the arrowhead drawn at the link base.
|
void |
setBaseShape(Shape value)
Sets the shape that is displayed at the origin of a link.
|
void |
setBaseShape(java.lang.String shapeId)
Sets the shape that is displayed at the origin of a link.
|
void |
setBaseShapeSize(float value)
Sets the size of the shape displayed at the origin of a link.
|
void |
setCascadeOrientation(Orientation value)
Sets the orientation of the first segment of a cascading link.
|
void |
setCustomDraw(CustomDraw value)
Sets the type of custom drawing performed on this link.
|
void |
setDestination(DiagramNode value)
Sets the destination node of a link.
|
void |
setDestinationAnchor(int value)
sets the anchor point to which a link is connected at its destination.
|
void |
setDestinationConnection(ConnectionPoint value)
Sets the
ConnectionPoint object representing the link connection to its destination node. |
void |
setDestinationIndex(int value)
Sets the row of a table or the anchor point of a box
to which a link is connected.
|
void |
setDynamic(boolean value)
Sets whether a link should automatically update the position
of its end points while a node related to the link is moved, so that
the link end segments always point to the center of the link's nodes.
|
void |
setEditedText(java.lang.String newText)
Implements InplaceEditable.setEditedText.
|
void |
setEndPoint(java.awt.geom.Point2D.Float value)
Sets the position of the last control point of this link.
|
void |
setHandlesStyle(HandlesStyle value)
Sets the appearance of the link's selection handles.
|
void |
setHeadBrush(Brush value)
Sets a brush used to fill the arrowhead drawn at the link's destination.
|
void |
setHeadPen(Pen value)
Sets the pen used to draw the arrowhead shapes outlines.
|
void |
setHeadShape(Shape value)
Sets the shape of the arrowhead.
|
void |
setHeadShape(java.lang.String shapeId)
Sets the shape of the arrowhead.
|
void |
setHeadShapeSize(float value)
Sets the size of the arrowhead shape.
|
void |
setIntermediateBrush(Brush value)
Sets a brush used to fill the arrowheads drawn at the middle of link segments.
|
void |
setIntermediateShape(Shape value)
Sets the shape that is displayed at the middle of each segment
of a link.
|
void |
setIntermediateShape(java.lang.String shapeId)
Sets the shape that is displayed at the middle of each segment of a link.
|
void |
setIntermediateShapeSize(float value)
Sets the size of the shape displayed at
the middle of each segment of a link.
|
void |
setOrigin(DiagramNode value)
Sets the origin node of a link.
|
void |
setOriginAnchor(int value)
Sets the anchor point to which a link is connected at its origin.
|
void |
setOriginConnection(ConnectionPoint value)
Sets the
ConnectionPoint object representing the link connection to its origin node. |
void |
setOriginIndex(int value)
Sets the row of a table or the anchor point of a box
to which a link is connected.
|
void |
setRetainForm(boolean value)
Sets a value indicating whether a link should preserve its original
shape while the nodes related to that link are moved around.
|
void |
setSegmentCount(int value)
Sets the number of segments of this link.
|
void |
setShape(LinkShape value)
Sets the shape of a link.
|
void |
setStartPoint(java.awt.geom.Point2D.Float value)
Sets the position of the first control point of this link.
|
void |
setText(java.lang.String value)
Sets the text of the link's label.
|
void |
setTextStyle(LinkTextStyle value)
Sets the link's text placement and orientation.
|
void |
setVisible(boolean value)
Specifies whether the link should be drawn on the screen.
|
protected void |
startCreate(java.awt.geom.Point2D org)
|
protected void |
startModify(java.awt.geom.Point2D org,
AdjustmentHandle handle,
InteractionState ist)
|
protected void |
updateCreate(java.awt.geom.Point2D current)
|
void |
updateFromPoints()
Updates a link after its control point positions are changed programmatically.
|
void |
updateFromPoints(boolean updateGroups)
Updates the link's internal state after the link's control
points have been changed.
|
protected void |
updateModify(java.awt.geom.Point2D current,
InteractionState ist)
|
static DiagramLinkBuilder |
with()
Returns a DiagramLinkBuilder object used to configure and create new DiagramLink instances.
|
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable.
|
as, getBrush, getEffectiveBrush, getEffectiveFont, getEffectivePen, getEffectiveShadowBrush, getEffectiveTextBrush, getFont, getHyperLink, getId, getIgnoreLayout, getLayerIndex, getLayoutTraits, getLocked, getMasterGroup, getMeasureUnit, getOpacity, getParent, getPen, getPrintable, getRuntimeIndex, getSelected, getShadowBrush, getShadowOffsetX, getShadowOffsetY, getStyle, getSubordinateGroup, getTag, getTextBrush, getTextPadding, getToolTip, getValue, getVisible, getWeight, getZIndex, hasSubordinates, hitTest, onChangeTextPadding, onChildModified, onClick, onDoubleClick, onMeasureUnitChanged, onRemove, onStyleChanged, onStyleFontChanged, putSelected, query, repaint, repaint, repaint, setBrush, setDiagramDirty, setFont, setHyperLink, setId, setIgnoreLayout, setLayerIndex, setLocked, setOpacity, setPen, setPrintable, setSelected, setShadowBrush, setShadowOffsetX, setShadowOffsetY, setStyle, setTag, setTextBrush, setTextPadding, setToolTip, setWeight, setZIndex, shouldRender, zBottom, zLevelDown, zLevelUp, zToppublic DiagramLink(Diagram parent)
parent - A Diagram instance whose default link
attributes are copied to this link.public DiagramLink(Diagram parent, DiagramNode src, DiagramNode dest)
parent - A Diagram instance whose default link
attributes are copied to this link.src - A DiagramNode -derived object representing the
link origin node.dest - A DiagramNode -derived object representing the
link destination node.public DiagramLink(Diagram parent, DiagramNode src, java.awt.geom.Point2D dest)
parent - A Diagram instance whose default link
attributes are copied to this link.src - A DiagramNode -derived object representing the
link origin node.dest - A Point2D.Float object representing the
link destination point.public DiagramLink(Diagram parent, java.awt.geom.Point2D src, DiagramNode dest)
parent - A Diagram instance whose default link
attributes are copied to this link.src - A Point2D.Float object representing the
link origin point.dest - A DiagramNode -derived object representing the
link destination node.public DiagramLink(Diagram parent, java.awt.geom.Point2D src, java.awt.geom.Point2D dest)
parent - A Diagram instance whose default link
attributes are copied to this link.src - A Point2D.Float object representing the
link origin point.dest - A Point2D.Float object representing the
link destination point.public DiagramLink(DiagramLink prototype, DiagramNode src, DiagramNode dest)
prototype - An DiagramLink instance whose attributes are
copied to this link.src - A DiagramNode -derived object representing the
link origin node.dest - A DiagramNode -derived object representing the
link destination node.public DiagramLink()
public static DiagramLinkBuilder with()
DiagramLinkBuilder instance.public DiagramLinkBuilder init()
DiagramLinkBuilder instance.public DiagramItem clone(boolean clipboard)
clone in class DiagramItemclipboard - true if the copy will be stored in the OS clipboard, or false otherwise.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class DiagramItemjava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class DiagramItemjava.io.IOExceptionjava.lang.ClassNotFoundExceptionprotected void onAdd()
DiagramItem.onAdd() override.onAdd in class DiagramItemprotected void onLoad(Diagram diagram)
onLoad in class DiagramItemprotected void saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
DiagramItemsaveToXml in class DiagramItemxmlElement - An Element the item's data should be stored into.context - An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.protected void loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
throws javax.xml.transform.TransformerException,
com.mindfusion.common.XmlException
DiagramItemloadFromXml in class DiagramItemxmlElement - An XmlElement containing the item's data.context - An XmlPersistContext object providing contextual
information about the serialization process and some helper serialization methodsjavax.xml.transform.TransformerExceptioncom.mindfusion.common.XmlExceptionprotected void saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
saveToJson in class DiagramItemobj - A JsonObject instance to contain the serialized data.context - A JsonPersistContext object providing contextual information
about the serialization process and helper serialization methods.protected void loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
loadFromJson in class DiagramItemobj - A JsonObject containing the link's data.context - A JsonPersistContext object providing contextual information about
the serialization process and helper serialization methods.protected void startCreate(java.awt.geom.Point2D org)
startCreate in class DiagramItemorg - The initial position of the mouse pointer.protected void updateCreate(java.awt.geom.Point2D current)
updateCreate in class DiagramItemcurrent - The current position of the mouse pointer.protected void completeCreate(java.awt.geom.Point2D end)
completeCreate in class DiagramItemend - The mouse pointer position.protected boolean allowCreate(java.awt.geom.Point2D current,
InteractionState ist)
DiagramItem.allowCreate(java.awt.geom.Point2D, com.mindfusion.diagramming.InteractionState) override.allowCreate in class DiagramItemcurrent - The current mouse pointer position.ist - An InteractionState object containing more information about the current state of the operation.protected boolean allowModify(java.awt.geom.Point2D current,
InteractionState ist)
DiagramItemallowModify in class DiagramItemcurrent - The current mouse pointer position.ist - An InteractionState object containing more information about the current state of the operation.protected void startModify(java.awt.geom.Point2D org,
AdjustmentHandle handle,
InteractionState ist)
DiagramItem.startModify(java.awt.geom.Point2D, com.mindfusion.diagramming.AdjustmentHandle, com.mindfusion.diagramming.InteractionState) override. Invoked when the user starts modifying this link interactively.startModify in class DiagramItemorg - The initial position of the mouse pointer.handle - The adjustment handle used to modify this item.ist - An InteractionState object containing more information about the current state of the operation.protected void updateModify(java.awt.geom.Point2D current,
InteractionState ist)
DiagramItem.updateModify(java.awt.geom.Point2D, com.mindfusion.diagramming.InteractionState) override. Invoked during interactive modification of this link.updateModify in class DiagramItemcurrent - The current position of the mouse pointer.ist - An InteractionState object containing more information about the current state of the operation.protected void completeModify(java.awt.geom.Point2D end,
InteractionState ist)
DiagramItemcompleteModify in class DiagramItemend - The mouse pointer position.ist - An InteractionState object containing more information about the current state of the operation.protected void cancelModify(InteractionState ist)
DiagramItem.cancelModify(com.mindfusion.diagramming.InteractionState) override. Invoked when the interactive modification of this link has been canceled.cancelModify in class DiagramItemist - An InteractionState object containing more information about the current state of the operation.protected void onModify(java.awt.geom.Point2D mousePosition,
int adjustmentHandle)
mousePosition - Specifies the mouse position.adjustmentHandle - The adjustment handle used to modify the node.protected void draw(java.awt.Graphics2D graphics,
RenderOptions options)
DiagramItem.draw(java.awt.Graphics2D, com.mindfusion.diagramming.RenderOptions) override. Draws this link on the specified Graphics2D surface.draw in class DiagramItemg - A java.awt.Graphics2D instance.options - Provides options for the drawing operation.protected void drawShadow(java.awt.Graphics2D graphics,
RenderOptions options)
DiagramItem.drawShadow(java.awt.Graphics2D, com.mindfusion.diagramming.RenderOptions) override. Draws the link's shadow on the specified Graphics2D surface.drawShadow in class DiagramItemgraphics - A java.awt.Graphics2D instance.options - Provides options for the drawing operation.public void drawArrowhead(java.awt.Graphics2D graphics,
Pen pen,
Brush b,
Shape shape,
java.awt.geom.Point2D pivot,
java.awt.geom.Point2D position,
java.awt.geom.Point2D segmentStart,
double size,
boolean shadow)
graphics - A Graphics2D surface on which to draw the shape.pen - A Pen instance used to draw the shape outline.b - A Brush instance used to fill the shape.shape - A Shape instance that defines the arrowhead geometry.pivot - A Point specified in percents that corresponds to the arrowhead tip position within the Shape geometry.position - A point on the drawing surface where the arrowhead tip should be located.segmentStart - A point specifying the arrowhead direction.size - A double value that specifies the arrowhead size.public void setVisible(boolean value)
setVisible in class DiagramItemvalue - true if the link should be visible,
otherwise false.public boolean isConnected()
true if the link is connected to any node,
false otherwise.public DiagramNode getOrigin()
DiagramNode.public void setOrigin(DiagramNode value)
value - A DiagramNode object representing the link origin.public DiagramNode getDestination()
DiagramNode.public void setDestination(DiagramNode value)
value - A DiagramNode object representing the link destination.public ConnectionPoint getOriginConnection()
ConnectionPoint object representing the link connection to its origin node.ConnectionPoint or a derived class.public void setOriginConnection(ConnectionPoint value)
ConnectionPoint object representing the link connection to its origin node.value - An instance of ConnectionPoint or a derived class.public ConnectionPoint getDestinationConnection()
ConnectionPoint object representing the link connection to its destination node.ConnectionPoint or a derived class.public void setDestinationConnection(ConnectionPoint value)
ConnectionPoint object representing the link connection to its destination node.value - An instance of ConnectionPoint or a derived class.public int getOriginIndex()
public void setOriginIndex(int value)
value - An integer value specifying the index of the origin anchor point.public int getDestinationIndex()
public void setDestinationIndex(int value)
value - An integer value specifying the index of the destination anchor point.public int getOriginAnchor()
public void setOriginAnchor(int value)
value - An integer value specifying the index of the origin anchor point.public int getDestinationAnchor()
public void setDestinationAnchor(int value)
value - An integer value specifying the index of the destination anchor point.public int getSegmentCount()
public void setSegmentCount(int value)
value - An integer value specifying the number of segments in the link.public PointList getControlPoints()
PointList containing the link's control points.public void updateFromPoints()
public void updateFromPoints(boolean updateGroups)
throws java.lang.Error
updateGroups - true to update the positions of nodes attached to the link; otherwise, false.java.lang.Errorpublic java.awt.geom.Point2D.Float getStartPoint()
public void setStartPoint(java.awt.geom.Point2D.Float value)
value - A Point2D.Float instance.public java.awt.geom.Point2D.Float getEndPoint()
public void setEndPoint(java.awt.geom.Point2D.Float value)
value - A Point2D.Float instance.public boolean getDynamic()
true if the link updates its end points
automatically, otherwise false.public void setDynamic(boolean value)
value - true if the link should update its end points
positions automatically, otherwise false.public boolean getRetainForm()
true if the link should preserve its
shape, otherwise false.public void setRetainForm(boolean value)
value - true if the link should preserve its
shape, otherwise false.public Orientation getCascadeOrientation()
Orientation enumeration.public void setCascadeOrientation(Orientation value)
value - A member of the Orientation enumeration.public boolean getAllowMoveStart()
true if the first control point can be moved,
otherwise false.public void setAllowMoveStart(boolean value)
value - true if the first control point can be moved,
otherwise false.public boolean getAllowMoveEnd()
true if the last control point can be moved,
otherwise false.public void setAllowMoveEnd(boolean value)
value - true if the last control point can be moved,
otherwise false.public LinkShape getShape()
LinkShape enumeration.public void setShape(LinkShape value)
value - A member of the LinkShape enumeration.public Pen getHeadPen()
Pen object.public void setHeadPen(Pen value)
value - A Pen object representing the arrowhead pen.public Pen getEffectiveHeadPen()
Pen object representing the currently
effective head pen of the link.
This method returns a pen corresponding to the link's
HeadPen if it is not
null, or a pen with the
HeadStroke and
HeadStrokeThickness
properties of the link's style.public java.lang.String getText()
String containing the label text.public void setText(java.lang.String value)
value - A String containing the label text.public LinkLabel addLabel(java.lang.String text)
text - The label's text.LinkLabel instance.public void addLabel(LinkLabel label)
label - A LinkLabel instance.public void removeLabel(LinkLabel label)
label - A LinkLabel instance.public ItemLabel labelFromPoint(java.awt.geom.Point2D point)
labelFromPoint in class DiagramItempoint - A Point2D instance.LinkLabel that contains the specified point.public java.util.ArrayList<LinkLabel> getLabels()
public LinkTextStyle getTextStyle()
LinkTextStyle enumeration.public void setTextStyle(LinkTextStyle value)
value - A member of the LinkTextStyle enumeration.public Shape getHeadShape()
ArrowHeads constants.public void setHeadShape(java.lang.String shapeId)
shapeId - A string specifying the Shape id.public void setHeadShape(Shape value)
value - One of the ArrowHeads constants.public Shape getBaseShape()
ArrowHeads constants.public void setBaseShape(java.lang.String shapeId)
shapeId - A string specifying the Shape id.public void setBaseShape(Shape value)
value - One of the ArrowHeads constants.public Shape getIntermediateShape()
ArrowHeads constants.public void setIntermediateShape(java.lang.String shapeId)
shapeId - A string specifying the Shape id.public void setIntermediateShape(Shape value)
value - One of the ArrowHeads constants.public float getHeadShapeSize()
public void setHeadShapeSize(float value)
value - A float value specifying the shape size.public float getBaseShapeSize()
public void setBaseShapeSize(float value)
value - A float value specifying the shape size.public float getIntermediateShapeSize()
public void setIntermediateShapeSize(float value)
value - A float value specifying the shape size.public HandlesStyle getHandlesStyle()
HandlesStyle enumeration.public void setHandlesStyle(HandlesStyle value)
value - A member of the HandlesStyle enumeration.public boolean containsPoint(java.awt.geom.Point2D point)
DiagramItem.containsPoint(Point2D) override. Checks whether this link
contains the specified point. This method is called during hit-testing to determine
if the mouse pointer is over the link.containsPoint in class DiagramItempoint - The point to check.public boolean containsPoint(java.awt.geom.Point2D point,
float threshold)
DiagramItem.containsPoint(Point2D, float) override. Checks whether this link
contains the specified point. This method is called during hit-testing to determine
if the mouse pointer is over the link.containsPoint in class DiagramItempoint - The point to check.threshold - Specifies the size of the area around the link outlines where the point is still considered inside.public AdjustmentHandle hitTestHandle(java.awt.geom.Point2D point)
DiagramItem.hitTestHandle(java.awt.geom.Point2D) override. Determines whether a selection handle of this link is located at the specified point.hitTestHandle in class DiagramItempoint - A Point2D instance specifying the location where to look for adjustment handles.LinkAdjustmentHandle instance representing the adjustment
handle found at the specified location, or null if there is none.public java.awt.geom.Rectangle2D.Float getBounds()
getBounds in class DiagramItemRectangle2D.Float object representing the
link's bounding rectangle.protected java.awt.geom.Rectangle2D getRepaintRect(boolean includeConnected)
DiagramItemgetRepaintRect in class DiagramItemincludeConnected - true if related items should be considered too; otherwise, false.public boolean getAutoRoute()
true if the link is routed automatically,
otherwise false.public void setAutoRoute(boolean value)
value - true if the link should be routed
automatically, otherwise false.public boolean route()
public void reassignAnchorPoints()
public RouteDescriptor createRouteDescriptor()
createRouteDescriptor in interface Routablepublic void applyRoute(java.util.ArrayList<java.awt.Point> routePoints,
RouteDescriptor routeDescriptor,
PointList resultPoints)
applyRoute in interface Routableprotected DiagramItemState createState()
DiagramItem.createState() override.createState in class DiagramItemprotected void saveState(DiagramItemState state)
saveState in class DiagramItemprotected void restoreState(DiagramItemState state)
restoreState in class DiagramItempublic boolean intersects(DiagramNode node)
node - The DiagramNode object to test intersection with.true if the link intersects the specified node,
otherwise false.public boolean intersects(DiagramLink link)
link - The DiagramLink object to test intersection with.true if the links intersect; otherwise false.public int getLongestHSegment()
public float getLength()
public boolean getAutoSnapToNode()
true if the link ends are aligned to node
borders, otherwise false.public void setAutoSnapToNode(boolean value)
value - true if the link ends should be aligned to
node borders, otherwise false.protected void onChangeFont()
onChangeFont in class DiagramItemprotected DiagramItemProperties createProperties()
DiagramItem.createProperties() override.createProperties in class DiagramItemprotected void saveProperties(DiagramItemProperties props)
saveProperties in class DiagramItemprops - A DiagramItemProperties-derived object where
the item's properties should be saved.protected void restoreProperties(DiagramItemProperties props)
restoreProperties in class DiagramItemprops - A DiagramItemProperties -derived object containing a
snapshot of the item's properties.public java.lang.String getTextToEdit()
getTextToEdit in interface InplaceEditablepublic void setEditedText(java.lang.String newText)
setEditedText in interface InplaceEditablenewText - The new text of this link.public java.awt.geom.Rectangle2D getEditRect(DiagramItem item, java.awt.geom.Point2D mousePosition)
getEditRect in interface InplaceEditableitem - A reference to this link.mousePosition - A Point2D instance specifying the current pointer position.public CustomDraw getCustomDraw()
CustomDraw enumeration.public void setCustomDraw(CustomDraw value)
value - A member of the CustomDraw enumeration.public Brush getBaseBrush()
Brush -derived class. The default value is null.public void setBaseBrush(Brush value)
value - An instance of a Brush -derived class. The default value is null.public Brush getHeadBrush()
Brush -derived class. The default value is null.public void setHeadBrush(Brush value)
value - An instance of a Brush -derived class. The default value is null.public Brush getIntermediateBrush()
Brush -derived class. The default value is null.