LinkOptions class (Swimlane)

LinkOptions()

new LinkOptions()

The LinkOptions class holds all options a link can display or own. A link is a line that connects two elements on the surface control, representing a relationship or association between them. The LinkOptions is used to define the properties and appearance of links between elements on the surface control. By configuring the LinkOptions, you can customize how links are displayed, including their captions, alignment, formatting, and the types of connections they represent between elements.

Every option of the LinkOptions type has associated a property of the link. For instance, the option:

caption, defines the link's caption
is associated with the property:
Caption {string}, defines the link's caption
which means that the following statements are equivalent:
oLink.Options = {caption: "name"}
oLink.SetOptions({caption: "name"})
oLink.Caption = "name"
oLink.SetCaption("name")
where oLink is an object of Link type

Members

(static) allowControlPoint :object

The allowControlPoint field specifies the control points available for that specific link. Control points allow the user to customize the link's path by dragging them to new positions. The customPath field defines the link's custom path, as a string of x,y proportions separated by comma. When defined, the allowControlPoint field overrides the control-wide allowLinkControlPoint field and applies only to the current link. The user can drag and drop the displayed control points to change the link's path, or remove intermediate control points by dragging them onto another control point. The control points are displayed only if the showLinks field is different from 0. The allowControlPoint field has effect only if the "link-cp" action is included in the allowActions field and the control is not read-only.

The Swimlane.LinkControlPointEnum type defines the following flags:

  • exNoControlPoint(0), the link displays no control points
  • exStartControlPoint(1), the link shows control point that changes the link's startPos field (the exStartControlPoint point is marked with black squares)
  • exEndControlPoint(2), the link shows control point that changes the link's endPos field (the exEndControlPoint point is marked with black squares)
  • exControlPoint(4), defines the corners of the link's path. You can remove a exControlPoint points by dragging to another, so intermediate exControlPoint points are removed. You can move all control points of the link at once, if SHIFT key is pressed (the exControlPoint points are marked black circles)
  • exMiddleControlPoint(8), defines the link's middle control points that are displayed between two exControlPoint points, to let the use add new exControlPoint points, to redefine the link's path (The exMiddleControlPoint points are marked with gray circles)
  • exOrthoArrange(0x10), specifies that the lines of the link are orthogonal arranged when the user drags and drops the middle or control-points of the path (excludes the start/end control-points)
  • exAllowChangeFrom(0x20), allows the user to adjust the link's from element by dragging and dropping the start control point (requires the exStartControlPoint flag)
  • exAllowChangeTo(0x40), indicates that the user can adjust the link's to element by dragging and dropping the end control point (requires the exEndControlPoint flag)

The allowControlPoint field is mapped to the Link.AllowControlPoint property, which means that the following statements are equivalent:

oLink.Options = {allowControlPoint: exontrol.Swimlane.LinkControlPointEnum.exStartControlPoint | exontrol.Swimlane.LinkControlPointEnum.exEndControlPoint}
oLink.SetOptions({allowControlPoint: exontrol.Swimlane.LinkControlPointEnum.exStartControlPoint | exontrol.Swimlane.LinkControlPointEnum.exEndControlPoint})
oLink.AllowControlPoint = exontrol.Swimlane.LinkControlPointEnum.exStartControlPoint | exontrol.Swimlane.LinkControlPointEnum.exEndControlPoint
oLink.SetAllowControlPoint(exontrol.Swimlane.LinkControlPointEnum.exStartControlPoint | exontrol.Swimlane.LinkControlPointEnum.exEndControlPoint)
Type:
  • object
Example
0 or exontrol.Swimlane.LinkControlPointEnum.exNoControlPoint {number}, displays no link's control points
3 or exontrol.Swimlane.LinkControlPointEnum.exStartControlPoint | exontrol.Swimlane.LinkControlPointEnum.exEndControlPoint {number}, displays link's start and end control points only
allowControlPoint

(static) caption :object

The caption field defines the link's caption. The captionAlign field specifies the alignment of the link's caption. The caption can include plain text or ex-HTML tags to format the text or display images. For example, you can use <b> tags to make the caption bold, or <img> tags to display an image as the caption. The caption field allows you to provide descriptive text for the link, enhancing the user experience by making it clear what the link represents or where it leads. By using ex-HTML tags, you can further customize the appearance of the caption to make it more visually appealing and informative.

The caption field is mapped to the Link.Caption property, which means that the following statements are equivalent:

oLink.Options = {caption: "name"}
oLink.SetOptions({caption: "name"})
oLink.Caption = "name"
oLink.SetCaption("name")
Type:
  • object
Example
null {null}, indicates no caption
"caption" {string}, declares a plain-caption
"&lt;b&gt;text&lt;/b&gt;" {string}, displays the text in bold
"&lt;img&gt;logo&lt;/img&gt;" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add method
caption

(static) captionAlign :object

The captionAlign field specifies the alignment of the link's caption. The caption field defines the link's caption. The caption can be aligned to the left, right, top, or bottom of the link. By default, the caption is centered on the link. This property allows you to control the placement of the caption in relation to the link, enabling you to create visually appealing designs that suit your application's needs. For example, aligning the caption to the left can create a more traditional layout, while aligning it to the top can give a more modern look.

The captionAlign field is mapped to the Link.CaptionAlign property, which means that the following statements are equivalent:

oLink.Options = {captionAlign: "left"}
oLink.SetOptions({captionAlign: "left"})
oLink.CaptionAlign = "left"
oLink.SetCaptionAlign("left")
Type:
  • object
Since:
  • 3.4
Example
null {null}, (default) the link's caption is displayed in the center
"left" {string}, exontrol.AlignEnum.exAlignLeft {exontrol.AlignEnum} or exontrol.AlignEnum.exAlignTop {exontrol.AlignEnum}, indicates that the link's caption is displayed at the starting element
"alignr" {string}, exontrol.AlignEnum.exAlignRight {exontrol.AlignEnum} or exontrol.AlignEnum.exAlignBottom {exontrol.AlignEnum}, indicates that the link's caption is displayed at the ending element
captionAlign

(static) captionFormat :object

The captionFormat field specifies the format/flags to display the caption of the link. The caption field defines the link's caption. The captionAlign field specifies the alignment of the link's caption. The caption can include plain text or ex-HTML tags to format the text or display images. The captionFormat field allows you to apply specific formatting options to the caption, such as text alignment, word wrapping, and other text display features.

The captionFormat field is mapped to the Link.CaptionFormat property, which means that the following statements are equivalent:

oLink.Options = {captionFormat: "left,vcenter"}
oLink.SetOptions({captionFormat: "left,vcenter"})
oLink.CaptionFormat = "left,vcenter"
oLink.SetCaptionFormat("left,vcenter")
Type:
  • object
Since:
  • 3.4
Example
null {null}, (default) the link's caption is displayed in the center of the alignment point
"left,vcenter" {string}, exontrol.DrawTextFormatEnum.exTextAlignLeft | exontrol.DrawTextFormatEnum.exTextAlignVCenter {exontrol.DrawTextFormatEnum} , the link's caption is centered and aligned to the left of the alignment point
captionFormat
The collapsedLink field specifies the appearance of the link between collapsed elements. The Element.Expand property indicates whether an element is expanded or collapsed. When an element is collapsed, the links connecting it to other elements can be displayed differently to visually indicate that the element is in a collapsed state. The link field specifies the appearance of the link between elements. The Swimlane.CollapsedLink property defines the default appearance for links between collapsed elements, while the Link.CollapsedLink property allows you to set a custom appearance for a specific link when it is between collapsed elements.

The collapsedLink field is mapped to the Link.CollapsedLink property, which means that the following statements are equivalent:

oLink.Options = {collapsedLink: {color: "gray", width: 1}}
oLink.SetOptions({collapsedLink: {color: "gray", width: 1}})
oLink.CollapsedLink = {color: "gray", width: 1}
oLink.SetCollapsedLink({color: "gray", width: 1})
Type:
  • object
Example
null {null}, the link between collapsed elements is displayed with the control's default appearance
{color: "gray", width: 1} {DisplayLinkType}, the link between collapsed elements is displayed with a gray color and a thickness of 1 pixel
collapsedLink

(static) customPath :object

The customPath field defines the link's custom path, as a string of x,y proportions separated by comma. Specifies the proportions of link's control-points, as a "x,y,x,y,x,y,...". The x, y are proportions of link's control-points relative to the start/end points of the link. The 0,0 indicates the link's start point, while 1,1 indicates the link's end point. For example, "0.5,0,0.5,1" defines the link to go from start (0,0) to (0.5,0), then (0.5,1), and finally to the end (1,1). The customPath field is considered only if the allowControlPoint field is different from 0 and the "link-cp" action is included in the allowActions field.

The customPath field is mapped to the Link.CustomPath property, which means that the following statements are equivalent:

oLink.Options = {customPath: "0.5,0,0.5,1"}
oLink.SetOptions({customPath: "0.5,0,0.5,1"})
oLink.CustomPath = "0.5,0,0.5,1"
oLink.SetCustomPath("0.5,0,0.5,1")
Type:
  • object
Example
"0.5,0,0.5,1" defines the link to go from start (0,0) to (0.5,0), then (0.5,1), and finally to the end (1,1)
customPath

(static) from :object

The from field indicates the index, identifier/key or reference of the element the link starts from (in-element). The to field indicates the index, identifier/key or reference of the element the link ends to (out-element). The from and to fields define the connection between two elements on the surface control, with from representing the starting point of the link and to representing the ending point.

The field can be of one of the following types:

  • {number}, indicates a numeric value that defines the index of the element
  • {string}, specifies a string expression that defines the identifier/key/plain-caption of the element
  • {Element}, specifies the object reference to the element

The from field is mapped to the Link.From property, which means that the following statements are equivalent:

oLink.Options = {from: 0}
oLink.SetOptions({from: 0})
oLink.From = 0
oLink.SetFrom(0)
Type:
  • object
Example
0 {number}, indicates that the link starts from the element with the index 0
"key" {string}, specifies that the link starts from the element with the giving key
from

(static) key :object

The key field specifies the key associated with the link. If no key is provided, the link's plain-caption can be used to request an item. The plain-caption includes no ex-HTML tags, such as <b>, <fgcolor> and so on. The key field allows you to assign a unique identifier to the link, making it easier to reference and manipulate the link programmatically.

The key field is mapped to the Link.Key property, which means that the following statements are equivalent:

oLink.Options = {key: "logo"}
oLink.SetOptions({key: "logo"})
oLink.Link.Key = "logo"
oLink.SetKey("logo")
Type:
  • object
Example
"logo" {string}, defines the link with the giving key (logo). You can use the Root.Item("logo") method to request the link giving its key.
key
The link field specifies the appearance of the link between elements. The collapsedLink field specifies the appearance of the link between collapsed elements. The Swimlane.GetLink() method returns the link's default appearance, while the Link.Link property sepcifies the link's custom appearance if it is defined. By default, the link field is set to null, which means that the link will use the control's default appearance. If you want to customize the appearance of a specific link, you can set the link field to a custom DisplayLinkType object that defines the visual options of the link, such as its color, thickness, and style.

The link field is mapped to the Link.Link property, which means that the following statements are equivalent:

oLink.Options = {link: {color: "red", width: 2}}
oLink.SetOptions({link: {color: "red", width: 2}})
oLink.Link = {color: "red", width: 2}
oLink.SetLink({color: "red", width: 2})
Type:
  • object
Example
null {null}, the link is displayed with the control's default appearance
{color: "red", width: 2} {DisplayLinkType}, the link is displayed with a red color and a thickness of 2 pixels
link

(static) to :object

The to field indicates the index, identifier/key or reference of the element the link ends to (out-element). The from field indicates the index, identifier/key or reference of the element the link starts from (in-element). The from and to fields define the connection between two elements on the surface control, with from representing the starting point of the link and to representing the ending point.

The field can be of one of the following types:

  • {number}, indicates a numeric value that defines the index of the element
  • {string}, specifies a string expression that defines the identifier/key/plain-caption of the element
  • {Element}, specifies the object reference to the element

The to field is mapped to the Link.To property, which means that the following statements are equivalent:

oLink.Options = {to: 0}
oLink.SetOptions({to: 0})
oLink.To = 0
oLink.SetTo(0)
Type:
  • object
Example
0 {number}, indicates that the link ends to the element with the index 0
"key" {string}, specifies that the link ends to the element with the giving key
to

(static) visible :object

The visible field indicates whether the link is visible or hidden. The showLinks field of the control specifies whether links are displayed on the surface control. If showLinks is set to a non-zero value, all links will be visible regardless of their individual visible settings. However, if showLinks is set to 0, all links will be hidden, even if their individual visible settings are set to true. By default, the visible field is set to true, meaning that links are visible unless explicitly hidden.

The visible field is mapped to the Link.Visible property, which means that the following statements are equivalent:

oLink.Options = {visible: false}
oLink.SetOptions({visible: false})
oLink.Visible = false
oLink.SetVisible(false)
Type:
  • object
Example
false {boolean}, hides the link
true {boolean}, shows the link
visible