Links class (Surface)

Links(oSurfaceView)

The Links object holds a collection of Link type (link of the control)
Parameters:
Name Type Description
oSurfaceView SV Indicates an object of exontrol.Surface.SV type
Links

Methods

Add(oLinkOpts) → {Link}

The Add() method creates and adds a new link into the control
Parameters:
Name Type Description
oLinkOpts Surface.LinkOptions Specifies the options to create the new link as an object of Surface.LinkOptions type
Returns:
Returns the newly created link, as an object of Link type, or null if adding the new link fails
Type
Link
Add

Clear()

The Clear() method removes all links of the control and inits the control's scroll-bars
Clear

GetCount() → {number}

The GetCount() method returns the number of links within the collection
Returns:
Returns the number of links within the collection
Type
number
GetCount

Item(id) → {Link}

The Item() method gets the link giving its index, identifier/key or reference
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the link to request
  • id {string}, specifies a string expression that defines the identifier/key/plain-caption of the link to request
  • id {Link}, specifies the object reference to the link to request for
Returns:
Returns null if the link is not found, or an object of Link type, if the links collection contains the giving id.
Type
Link
Item

Load(value)

The Load() method loads control's links from a string representation.
Parameters:
Name Type Description
value string Indicates a string to load links from. The format of the links'string representation is (everything between () refers to children, and everything between [] refers to flags):
"link1[flag=value]...[flag=value],...,linkn[flag=value]...[flag=value]"
The link1, ... linkn defines the caption for each link. The string representation supports the following flags:
  • [link] {string} (required), indicates the link's in-out elements in "from-to" format, where from/to indicates the element's key, plain-caption or index (0-based). For instance, [link=11-1], links the elements with index 11 and 1, or [link=root-1] links the element with the key "root" or plain-caption "root" with the element of index 1.
  • [key] {string}, specifies the link's key (Key/GetKey()/SetKey(value) methods of exontrol.Surface.Link). For instance, [key=root], specifies that the link's key is "root"
  • [vis]/[hid] {number}, shows or hides the link (Visible/GetVisible()/SetVisible(value) methods of exontrol.Surface.Link). For instance, [hid] or [vis=0], hides the link, while [vis=1] shows the link
  • [type] {number}, specifies the type of the link as a value of 0 (rectangular), 1 (direct), 2(straight) or 3(round). For instance, [type=3] defines a round-link
  • [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. For instance, [dir=3] shows the arrows in both-directions of the link.
  • [width] {number}, specifies the link's width or size. For instance, [width=4] shows a wider link.
  • [color] {string}, indicates the link's color. For instance, [color=red] specifies a red-link.
  • [arrow] {string}, indicates the arrow's color. For instance, [arrow=#808080] shows the link's arrow in gray.
  • [style] {number}, specifies the link's dash pattern to show the lines. For instance, [style=2] shows a dotted-link
  • [startPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of in-element, where the link can start from. For instance, [startPos=TR,MR,BR] specifies that the link can start anywhere on the in-element's right-side
  • [endPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of out-element, where the link can end into. For instance, [endPos=TL,ML,BL] specifies that the link can end anywhere on the out-element's left-side
The following flags have effect only when the link is shown between collapsed-elements
  • [coll-type] {number}, specifies the type of the link as a value of 0 (rectangular), 1 (direct), 2(straight) or 3(round). For instance, [coll-type=3] defines a round-link
  • [coll-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. For instance, [coll-dir=3] shows the arrows in both-directions of the link.
  • [coll-width] {number}, specifies the link's width or size. For instance, [coll-width=4] shows a wider link.
  • [coll-color] {string}, indicates the link's color. For instance, [coll-color=red] specifies a red-link.
  • [coll-arrow] {string}, indicates the arrow's color. For instance, [coll-arrow=#808080] shows the link's arrow in gray.
  • [coll-style] {number}, specifies the link's dash pattern to show the lines. For instance, [coll-style=2] shows a dotted-link
  • [coll-startPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of in-element, where the link can start from. For instance, [coll-startPos=TR,MR,BR] specifies that the link can start anywhere on the in-element's right-side
  • [coll-endPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of out-element, where the link can end into. For instance, [coll-endPos=TL,ML,BL] specifies that the link can end anywhere on the out-element's left-side
Load

OnCreate(oCreateOpts) → {boolean}

The OnCreate() method customizes the options for the newly created link by drag.
Parameters:
Name Type Description
oCreateOpts Surface.LinkOptions Specifies the options to create the link as an object of Surface.LinkOptions type. The oCreateOpts contains "from" and "to" fields, that defines link's in and out elements.
Returns:
Returns false to create the link, or true to prevent creating a new link
Type
boolean
OnCreate

Remove(id)

The Remove() method removes a link from the collection.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the link to request
  • id {string}, specifies a string expression that defines the identifier/key/plain-caption of the link to request
  • id {Link}, specifies the object reference to the link to request for
Remove

RemoveRange(range)

The RemoveRange() method removes multiple-links at once
Parameters:
Name Type Description
range Link | Array.<Link> Indicates a link of Link type, an array [Link], or exontrol.Arr.
RemoveRange

Save() → {string}

The Save() method saves the control's links to a string representation.
Returns:
Returns the control's links into a string representation. The format of the links'string representation is (everything between () refers to children, and everything between [] refers to flags):
"link1[flag=value]...[flag=value],...,linkn[flag=value]...[flag=value]"
The link1, ... linkn defines the caption for each link. The string representation supports the following flags:
  • [link] {string} (required), indicates the link's in-out elements in "from-to" format, where from/to indicates the element's key, plain-caption or index (0-based). For instance, [link=11-1], links the elements with index 11 and 1, or [link=root-1] links the element with the key "root" or plain-caption "root" with the element of index 1.
  • [key] {string}, specifies the link's key (Key/GetKey()/SetKey(value) methods of exontrol.Surface.Link). For instance, [key=root], specifies that the link's key is "root"
  • [vis]/[hid] {number}, shows or hides the link (Visible/GetVisible()/SetVisible(value) methods of exontrol.Surface.Link). For instance, [hid] or [vis=0], hides the link, while [vis=1] shows the link
  • [type] {number}, specifies the type of the link as a value of 0 (rectangular), 1 (direct), 2(straight) or 3(round). For instance, [type=3] defines a round-link
  • [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. For instance, [dir=3] shows the arrows in both-directions of the link.
  • [width] {number}, specifies the link's width or size. For instance, [width=4] shows a wider link.
  • [color] {string}, indicates the link's color. For instance, [color=red] specifies a red-link.
  • [arrow] {string}, indicates the arrow's color. For instance, [arrow=#808080] shows the link's arrow in gray.
  • [style] {number}, specifies the link's dash pattern to show the lines. For instance, [style=2] shows a dotted-link
  • [startPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of in-element, where the link can start from. For instance, [startPos=TR,MR,BR] specifies that the link can start anywhere on the in-element's right-side
  • [endPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of out-element, where the link can end into. For instance, [endPos=TL,ML,BL] specifies that the link can end anywhere on the out-element's left-side
The following flags have effect only when the link is shown between collapsed-elements
  • [coll-type] {number}, specifies the type of the link as a value of 0 (rectangular), 1 (direct), 2(straight) or 3(round). For instance, [coll-type=3] defines a round-link
  • [coll-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. For instance, [coll-dir=3] shows the arrows in both-directions of the link.
  • [coll-width] {number}, specifies the link's width or size. For instance, [coll-width=4] shows a wider link.
  • [coll-color] {string}, indicates the link's color. For instance, [coll-color=red] specifies a red-link.
  • [coll-arrow] {string}, indicates the arrow's color. For instance, [coll-arrow=#808080] shows the link's arrow in gray.
  • [coll-style] {number}, specifies the link's dash pattern to show the lines. For instance, [coll-style=2] shows a dotted-link
  • [coll-startPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of in-element, where the link can start from. For instance, [coll-startPos=TR,MR,BR] specifies that the link can start anywhere on the in-element's right-side
  • [coll-endPos] {string}, indicates a list of corners separated by comma(,) which can be any of "TL", "TC", "TR", "ML", "MR", "BL", "BC" or "BR" of out-element, where the link can end into. For instance, [coll-endPos=TL,ML,BL] specifies that the link can end anywhere on the out-element's left-side
Type
string
Save