IBM ILOG Dojo Diagrammer 1.1 API Documentation
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

ibm_ilog.diagram.Link

Object » graphCreator » dojox.gfx.Group » ibm_ilog.diagram.GraphElement » ibm_ilog.diagram.Link
dojo.require("ibm_ilog.diagram.Link");

The link is a templatable object that connects two nodes. A link is created by calling graph.createLink(template), where 'graph' is an ibmilog.diagram.Graph instance, and 'template' is a GFX definition of the shapes that make up the link. The template must contain at least a GFX shape that will represent the polyline shape of the link. This shape must have a "dojoAttachPoint: 'path'" property. The template can contain one or two shapes representing the start and/or end arrows of the link, with "dojoAttachPoint: 'startArrow'" and "dojoAttachPoint: 'endArrow'" properties. The template can also contain decorations, that is, shapes that will placed placed automatically along the link's path. Decorations are identified by a isDecoration property which must be set to true. Additional properties can be specified to define how a decoration is placed and aligned on the path. See the getDecorations() method for more details.

Property Summary

  • TID Graph element Type ID, used to distinguish basic graph element types: N = Node S = Subgraph L = Link Usually used as a very fast index into maps based on ibm_diagram graph element types.
  • defaultTemplate
  • nodeType

Method Summary

Attached Objects

Properties

TID
Graph element Type ID, used to distinguish basic graph element types: N = Node S = Subgraph L = Link Usually used as a very fast index into maps based on ibm_diagram graph element types.
defaultTemplate
nodeType

Methods

addConnection
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
this method should be called on every dojo.connect done to the graph element that should be disconnected on dispose.
ParameterTypeDescription
connection
afterDisposing
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement

This function free all possible listeners

ParameterTypeDescription
graphElement
applyLayout
applyPath
ParameterTypeDescription
path
points
curveTension
applyPathToArrows
ParameterTypeDescription
target
beforeDisposing
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
This function is called before disposing the GraphElement
ParameterTypeDescription
graphElement
byShape
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
Returns the GraphElement that contains the specified shape, or null.
ParameterTypeDescription
shape
connect
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
override gfx.connect to add the handle to the internal list
constructor
Overrides dojox.gfx.Group, ibm_ilog.diagram.GraphElement
Constructor.
disconnectAll
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
This function is disconnect every dojo.connect attached to this element
dispose
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement

This function should be called when the GraphElement is completely deleted, that is, when it is removed from its parent graph and it will never be used again.

ParameterTypeDescription
optionsoptions.noRecurse:Do not recurse children
getBounds
A rectangle (i.e. an object with x/y/width/height properties) containing the bounds of the node in the specified coordinate space.
Returns the bounds of this node in the coordinate space of the specified parent.
ParameterTypeDescription
parentdojox.gfx.GroupThe parent object that determines the coordinate space the bounds are relative to. If null or undefined, the bounds of the node relative to its parent are returned.
getCurveTension
number: The curve tension.

See setCurveTension.

getDecorations
Array: An array of GFX shapes.

The link can contain shapes called "decorations". Decorations are automatically placed along the link path. To be considered as a decoration, a child shape must have the "isDecoration" set to true. The decoration can have the following properties that define their placement on the link: - position: A number that defines the position of the decoration along the link. The meaning of the position depends on the positionType property. The default position is 0.5, and The default positionType is ibmilog.diagram.LinkDecorationPositionType.Relative, so by default a decoration is placed at the middle of the link. - positionType: Defines the way the position is interpreted. Possible values are: ibmilog.diagram.LinkDecorationPositionType.Relative: The position property is a ratio between 0 and 1 that defines a relative position on the link (0 = start of the link, 1 = of the link, 0.5 = middle of the link, etc). ibmilog.diagram.LinkDecorationPositionType.AnsoluteFromStart: The position is a fixed length that defines an offset from the start of the link (going forward from the start to the end of the link). ibmilog.diagram.LinkDecorationPositionType.AnsoluteFromMiddle: The position is a fixed length that defines an offset from the middle of the link (going forward from the start to the end of the link). ibmilog.diagram.LinkDecorationPositionType.AnsoluteFromEnd: The position is a fixed length that defines an offset from the end of the link (going backward from the end to the start of the link). The default positionType is ibmilog.diagram.LinkDecorationPositionType.Relative, and the default position is 0.5, so by default a decoration is placed at the middle of the link. - orthogonalAlignment: Defines the alignment of the decoration orthogonally to the link path. Possible values are: ibmilog.diagram.LinkDecorationOrthogonalAlignment.Left: The decoration is placed on the "left" of the link, looking towards the end of the link (for example, if the link is horizontal and pointing to the right, the decoration will be above the link). The spacing between the decoration and the link is defined by the distance property. ibmilog.diagram.LinkDecorationOrthogonalAlignment.Center: The decoration is centered on the link. ibmilog.diagram.LinkDecorationOrthogonalAlignment.Start: The decoration is placed on the "right" of the link, looking towards the end of the link (for example, if the link is horizontal and pointing to the right, the decoration will be below the link). The spacing between the decoration and the link is defined by the distance property. The default orthogonalAlignment is ibmilog.diagram.LinkDecorationOrthogonalAlignment.Center. - parallelAlignment: Defines the alignment of the decoration along the link. Possible values are: ibmilog.diagram.LinkDecorationParallelAlignment.Start: The side of the decoration that is closest to the start of the link is aligned on the point defined by the position and positionType. ibmilog.diagram.LinkDecorationParallelAlignment.Middle: The middle of the decoration is aligned on the point defined by the position and positionType. ibmilog.diagram.LinkDecorationParallelAlignment.Start: The side of the decoration that is closest to the end of the link is aligned on the point defined by the position and positionType. The default parallelAlignment is ibmilog.diagram.LinkDecorationParellelAlignment.Middle. - distance: Defines the distance between the decoration and the link when orthogonalAlignment is ibmilog.diagram.LinkDecorationOrthogonalAlignment.Left or ibmilog.diagram.LinkDecorationOrthogonalAlignment.Right. The default distance is 0. - autoRotate: If autoRotate is true, the decoration is rotated according to the orientation of the link segment that contains the decoration position. By default, autoRotate is false.

getEndNode
A ibm_ilog.diagram.Node object.

If a end port has been specified, this function returns the owner of the end port, otherwise it returns null.

getEndPort
The PortBase object that defines the end point of the link.
Gets the end port of the link.
getFallbackEndPoint
An object with 'x' and 'y' properties.

The end point is used only when no end port is specified.

getFallbackStartPoint
An object with 'x' and 'y' properties.

The start point is used only when no start port is specified.

getHitTolerance
getId
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
getIntermediatePoints
An array of objects with 'x' and 'y' properties.

The intermediate points define the additional points of the link (i.e., the points between the start and end points, which are always determined by the setStartPort()/setEndPort() or setFallbackStartPoint/setFallbackEndPoint() functions) when the link shape type is ibmilog.diagram.LinkShapeType.Free or ibmilog.diagram.LinkShapeType.OrthogonalEditable. For other shape types, the intermediate points are ignored since the link path is computed automatically.

getNodeDistance
A distance in pixels.

This property is used when the link shape type is Orthogonal, OrthogonalEditable or Oblique, and determines the minimum distance kept between the link and its start or end nodes. The default distance is 20.

getPoints

This function calls validateLinkShape() and returns the points that have been computed.

getShapeType
One of the values defined in the ibm_ilog.diagram.LinkShapeType enumeration.

The shape type determines if and how the link automatically computes its shape based on its start and end port or points, and possibly its intermediate points.

getStartNode
A ibm_ilog.diagram.Node object.

If a start port has been specified, this function returns the owner of the start port, otherwise it returns null.

getStartPort
The PortBase object that defines the start point of the link.
Gets the start port of the link.
hitTest
ParameterTypeDescription
p
graph
tolerance
invalidate
invalidateLinkShape

This function ensures that the shape of the link will be recomputed before the next redisplay of the link. This function is called automatically when the start or end port change, or their owner nodes change, or when a property of the link that determines the shape (such as the intermediate points) is changed. In most cases you do not need to call this function explicitly.

isEndArrowVisible
True if the end arrow is defined in the link template and visible. False if the end arrow is either not defined in the link template or invisible.
Gets the visibility of the end arrow.
isStartArrowVisible
True if the start arrow is defined in the link template and visible. False if the start arrow is either not defined in the link template or invisible.
Gets the visibility of the start arrow.
layoutShape
ParameterTypeDescription
target
revalidateLinkShape
Recomputes the shape of this link.
setCurveTension

This properties allows to draw curved links. By default, the curve tension is 0, which draws a plain polyline (not curved). If the curve tension is set to a value greater than 0, the link is drawn as a smooth spline that goes through the start point, then through the middle of each link segment (as computed according to the link shape type), and then to the end point. The curve tension determines the shape of the curve: small values will produce sharper bends, larger values will produce a smoother curve. The curve tension must be greater than 0 and less than 1 (0.5 usually provides nicest results). NOTE: If the _path part of the link template was a GFX Polyline shape, setting the curve tension to a value greater than 0 automatically replaces it by a GFX Path shape.

ParameterTypeDescription
tnumbernumber: The curve tension, between 0 and 1.
setEndArrowVisible
Makes the end arrow visible or invisible.
ParameterTypeDescription
vBoolean:If no end arrow is defined in the link template (that is, if the template contains no shape with "dojoAttachPoint: '_endArrow'"), this method does nothing. Otherwise, if 'v' is true, the end arrow is shown (i.e., added to the link), and if 'v' is false, the end arrow is hidden (i.e. removed from the link).
setEndNode

If a end port has been specified, this function returns the owner of the end port, otherwise it returns null.

ParameterTypeDescription
nodeibm_ilog.diagram.NodeA ibm_ilog.diagram.Node object.
setEndPort
Sets the end port of the link.
ParameterTypeDescription
portibm_ilog.diagram.PortBase:The PortBase object that defines the end point of the link.
setFallbackEndPoint

The end point is used only when no end port is specified.

ParameterTypeDescription
pointAnobject with 'x' and 'y' properties.
setFallbackStartPoint

The start point is used only when no start port is specified.

ParameterTypeDescription
pointAnobject with 'x' and 'y' properties.
setHitTolerance
ParameterTypeDescription
tolerance
setIntermediatePoints

The intermediate points define the additional points of the link (i.e., the points between the start and end points, which are always determined by the setStartPort()/setEndPort() or setFallbackStartPoint/setFallbackEndPoint() functions) when the link shape type is ibmilog.diagram.LinkShapeType.Free or ibmilog.diagram.LinkShapeType.OrthogonalEditable. For other shape types, the intermediate points are ignored since the link path is computed automatically.

ParameterTypeDescription
pointsAnarray of objects with 'x' and 'y' properties (can be null to remove all intermediate points).
setNodeDistance

This property is used when the link shape type is Orthogonal, OrthogonalEditable or Oblique, and determines the minimum distance kept between the link and its start or end nodes.

ParameterTypeDescription
distancenumbernumber: A distance in pixels.
setShapeType

The shape type determines if and how the link automatically computes its shape based on its start and end port or points, and possibly its intermediate points.

ParameterTypeDescription
shapeTypeintint: One of the values defined in the ibm_ilog.diagram.LinkShapeType enumeration.
setStartArrowVisible
Makes the start arrow visible or invisible.
ParameterTypeDescription
vBoolean:If no start arrow is defined in the link template (that is, if the template contains no shape with "dojoAttachPoint: '_startArrow'"), this method does nothing. Otherwise, if 'v' is true, the start arrow is shown (i.e., added to the link), and if 'v' is false, the start arrow is hidden (i.e. removed from the link).
setStartNode

If a start port has been specified, this function returns the owner of the start port, otherwise it returns null.

ParameterTypeDescription
nodeibm_ilog.diagram.NodeA ibm_ilog.diagram.Node object.
setStartPort
Sets the start port of the link.
ParameterTypeDescription
portibm_ilog.diagram.PortBase:The PortBase object that defines the start point of the link.
toString
Defined by dojox.gfx.Group, ibm_ilog.diagram.GraphElement
validateLinkShape

This function is called automatically when invalidateLinkShape() has been called, and before the link is redisplayed. In most cases you do not need to call this function explicitly.