Class: Link

Link(oLinks, oLinkOptsopt)

The Link object holds information(options) about a link within the control.

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

caption {string}, 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
Parameters:
Name Type Attributes Description
oLinks Links Indicates an object of Links type that's the owner collection of this link
oLinkOpts object <optional>
Specifies the options to create the link, as an object of Surface.LinkOptions type

Methods

aCP() → {Surface.LinkControlPointEnum}

The aCP/allowControlPoint() method gets the link's current AllowControlPoint property (not null)
Since:
  • 1.3
Returns:
Returns a combination of one or more values of Surface.LinkControlPointEnum type, that defines the control points for an individual link (the user can use to customize the link)
Type
Surface.LinkControlPointEnum
The EndUpdateLink() method adds programmatically updated properties of the link to undo/redo queue. You can use the StartBlockUndoRedo / EndBlockUndoRedo methods to group multiple Undo/Redo operations into a single-block. The AllowUndoRedo property specifies whether the control supports undo/redo operations for objects (links, links, ...). No entry is added to the Undo/Redo queue if no property is changed for the current link.
Parameters:
Name Type Description
startUpdateLink any Holds the result of a StartUpdateLink() method
Since:
  • 2.0

EnsureVisible()

The EnsureVisible() method scrolls the control's content to ensure that the link fits the control's visible area (expands its from/to elements if case)
Since:
  • 2.0

GetAllowControlPoint() → {Surface.LinkControlPointEnum}

The GetAllowControlPoint() method gets the control points for an individual link.
Returns:
Returns a combination of one or more values of Surface.LinkControlPointEnum type, that defines the control points for an individual link (the user can use to customize the link)
Type
Surface.LinkControlPointEnum

GetCaption() → {string}

The GetCaption() method returns the link's caption
Returns:
Returns link's exHTML caption
Type
string

GetCustomPath() → {any}

The GetCustomPath() method gets the link's custom path, as a string of x,y proportions separated by comma.
Returns:
Returns 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 instance, "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).
Type
any

GetFrom() → {any}

The GetFrom() method indicates the index, identifier/key or reference of the element the link starts from (in-element).
Returns:
Returns the index, identifier/key or reference of the element the link starts from (in-element).
Type
any

GetIndex() → {number}

The GetIndex() method retrieves the link's index.
Returns:
Returns the link's index (0-based)
Type
number

GetKey() → {string}

The GetKey() method returns the link's key.
Returns:
Returns the link's exHTML key it displays
Type
string
The GetLink() method gets the appearance of the link between elements.
Returns:
Returns the appearance of the link between elements. The link object includes any of the following:
  • type {exontrol.TypeEnum}, specifies the type of the link 0 (rectangular), 1 (direct), 2(straight) or 3(round)
  • dir {number}, specifies whether the link's direction is shown or hidden as 0 (hidden), 1(shows the direction/arrow where the link begins), 2(shows the direction where the link ends, default) or 3 shows the arrows in both sides
  • width {number}, specifies the link's width or size (1 by default)
  • color {string}, indicates the link's color (partial-black by default)
  • arrow {string}, indicates the arrow's color. If it is missing or not specified the arrow is shown using the link's color (gray by default)
  • arrowSize {number}, indicates the arrow's size. If it is missing or not specified the arrow's size is defined by link's width (1 by default) (@since 2.2)
  • arrowShape {object}, defines an object of exontrol.Def.Shape type to customize the shape of the link's arrow (for instance shows the link's arrow as a circle instead of a triangle) (@since 2.2)
  • style {array}, specifies the link's dash pattern to show the lines (solid by default)
  • startPos {any}, indicates the list of corners of in-element, the link can start from
  • endPos {any}, indicates the list of corners of out-element, the link can end to
Type
DisplayLinkType

GetOptions() → {Surface.LinkOptions}

The GetOptions() method returns the link's options at once
Returns:
Returns an object of Surface.LinkOptions type
Type
Surface.LinkOptions

GetTo() → {any}

The GetTo() method indicates the index, identifier/key or reference of the element the link ends to (out-element).
Returns:
Returns the index, identifier/key or reference of the element the link ends to (out-element).
Type
any

GetVisible() → {boolean}

The GetVisible() method returns whether the link is visible or hidden
Returns:
Returns true if the link is visible, or false if the link is not visible
Type
boolean

isO() → {boolean}

The isO/IsOrtho() method determines whether the current link is orthogonal
Since:
  • 1.3
Returns:
Returns true if the current link is orthogonal (includes just horizontal or vertical lines)
Type
boolean

Remove()

The Remove() method removes the link itself from its collection

SetAllowControlPoint(value)

The SetAllowControlPoint() method sets the control points for an individual link
Parameters:
Name Type Description
value Surface.LinkControlPointEnum Specifies a combination of one or more values of Surface.LinkControlPointEnum type, that defines the control points for an individual link (the user can use to customize the link)

SetCaption(value)

The SetCaption() method changes the link's caption
Parameters:
Name Type Description
value string Specifies a new ex-HTML caption to be assigned to the link
Example
null {null}, indicates no caption
 "caption" {string}, declares a plain-caption
 "&lt;b>text&lt;/b>" {string}, displays the text in bold
 "&lt;img>logo&lt;/img>" {string}, displays the "logo" image. The image can be added using the exontrol.HTMLPicture.Add() method
The SetCollapsedLink() method changes the appearance of the link between collapsed elements.
Parameters:
Name Type Description
value DisplayLinkType Specifies the appearance of the link between collapsed elements. The link object includes any of the following:
  • type {exontrol.TypeEnum}, specifies the type of the link 0 (rectangular), 1 (direct), 2(straight) or 3(round)
  • dir {number}, specifies whether the link's direction is shown or hidden as 0 (hidden), 1(shows the direction/arrow where the link begins), 2(shows the direction where the link ends, default) or 3 shows the arrows in both sides
  • width {number}, specifies the link's width or size (1 by default)
  • color {string}, indicates the link's color (partial-black by default)
  • arrow {string}, indicates the arrow's color. If it is missing or not specified the arrow is shown using the link's color (gray by default)
  • arrowSize {number}, indicates the arrow's size. If it is missing or not specified the arrow's size is defined by link's width (1 by default) (@since 2.2)
  • arrowShape {object}, defines an object of exontrol.Def.Shape type to customize the shape of the link's arrow (for instance shows the link's arrow as a circle instead of a triangle) (@since 2.2)
  • style {array}, specifies the link's dash pattern to show the lines (solid by default)
  • startPos {any}, indicates the list of corners of in-element, the link can start from
  • endPos {any}, indicates the list of corners of out-element, the link can end to

    SetCustomPath(value)

    The SetCustomPath() method sets the link's custom path, as a string of x,y proportions separated by comma
    Parameters:
    Name Type Description
    value any 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 instance, "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).
    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)

    SetFrom(value)

    The SetFrom() method defines the index, identifier/key or reference of the element the link starts from (in-element).
    Parameters:
    Name Type Description
    value any Specifies the index, identifier/key or reference of the element the link starts from (in-element).

    SetKey(value)

    The SetKey() method assigns a new key to the link
    Parameters:
    Name Type Description
    value string Specifies a new key to be assigned to the link
    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.
    The SetLink() method changes the appearance of the link between elements.
    Parameters:
    Name Type Description
    value DisplayLinkType Specifies the appearance of the link between elements. The link object includes any of the following:
    • type {exontrol.TypeEnum}, specifies the type of the link 0 (rectangular), 1 (direct), 2(straight) or 3(round)
    • dir {number}, specifies whether the link's direction is shown or hidden as 0 (hidden), 1(shows the direction/arrow where the link begins), 2(shows the direction where the link ends, default) or 3 shows the arrows in both sides
    • width {number}, specifies the link's width or size (1 by default)
    • color {string}, indicates the link's color (partial-black by default)
    • arrow {string}, indicates the arrow's color. If it is missing or not specified the arrow is shown using the link's color (gray by default)
    • arrowSize {number}, indicates the arrow's size. If it is missing or not specified the arrow's size is defined by link's width (1 by default) (@since 2.2)
    • arrowShape {object}, defines an object of exontrol.Def.Shape type to customize the shape of the link's arrow (for instance shows the link's arrow as a circle instead of a triangle) (@since 2.2)
    • style {array}, specifies the link's dash pattern to show the lines (solid by default)
    • startPos {any}, indicates the list of corners of in-element, the link can start from
    • endPos {any}, indicates the list of corners of out-element, the link can end to

      SetOptions(oOpts)

      The SetOptions() method changes the link's options (visibility, caption, ...) at once
      Parameters:
      Name Type Description
      oOpts Surface.LinkOptions Specifies an object of Surface.LinkOptions type that holds information about the link, such as caption, image and so on. If the oOpts parameter is not-of object type it indicates the link's caption instead

      SetTo(value)

      The SetTo() method defines the index, identifier/key or reference of the element the link ends to (out-element).
      Parameters:
      Name Type Description
      value any Specifies the index, identifier/key or reference of the element the link ends to (out-element).

      SetVisible(value)

      The SetVisible() method shows or hides the link
      Parameters:
      Name Type Description
      value boolean Indicates a boolean expression that specifies whether the link is visible or hidden
      Example
      false {boolean}, hides the link
       true {boolean}, shows the link
      The StartUpdateLink() method starts changing properties of the link, so EndUpdateLink method adds programmatically updated properties to undo/redo queue. You can use the StartBlockUndoRedo / EndBlockUndoRedo methods to group multiple Undo/Redo operations into a single-block. The AllowUndoRedo property specifies whether the control supports undo/redo operations for objects (links, links, ...). No entry is added to the Undo/Redo queue if no property is changed for the current link.
      Since:
      • 2.0
      Returns:
      Returns undefined (no undo/redo is allowed) or an object to be passed to EndUpdateLink method.
      Type
      object
      The UpdateLink() method records the changes of link's properties into control's Undo/Redo queue. The UpdateLink() method calls StartUpdateLink / EndUpdateLink methods.
      Parameters:
      Name Type Description
      callback callback Specifies a function of callback() type
      thisArg any Indicates the value of "this" keyword during the callback, or the object itself if missing