Skip to content
Phil Beauvoir edited this page Feb 23, 2024 · 3 revisions

Note

Attributes and methods described in this section are available only on Diagram Connections

Contents

.addRelativeBendpoint()
.deleteAllBendpoints()
.deleteBendpoint()
.labelVisible
.relativeBendpoints
.setRelativeBendpoint
.source
.specialization
.style
.target


.addRelativeBendpoint()

Add a bendpoint to a relative position on a connection at index position.

connection.addRelativeBendpoint(bendpoint, index)

Example:

// New bendpoint 1
var bp1 = {
    startX: 200,
    startY: 200,
    endX: 10,
    endY: 10
}

// New bendpoint 2
var bp2 = {
    startX: 100,
    startY: 100,
    endX: 20,
    endY: 30
}

// Select the first connection in an opened View
var connection = selection.filter("relationship").first();

// Add bendpoints at index positions
connection.addRelativeBendpoint(bp1, 0);
connection.addRelativeBendpoint(bp2, 1);

.deleteAllBendpoints()

Delete all bendpoints on a connection.

connection.deleteAllBendpoints()

.deleteBendpoint()

Delete a bendpoint at index position on a connection.

connection.deleteBendpoint(index);

Throws an ArchiScriptException if index position is out of bounds.

.labelVisible

Get/set the visibility of a connection label.

connection.labelVisible = false;
var isVisible = connection.labelVisible;

.relativeBendpoints

Get the relative bendpoint positions of a connection.

Returns an array list of bendpoints in this format:

endY:
endX:
startY:
startX:
connection.relativeBendpoints

Example:

var bendpoints = connection.getRelativeBendpoints();
var bendpoints = connection.relativeBendpoints;

.setRelativeBendpoint()

Set a connection's existing bendpoint to a new position.

connection.setRelativeBendpoint(bendpoint, index)

Example:

// New bendpoint position
var bp = {
    startX: 200,
    startY: 200,
    endX: 10,
    endY: 10
}

// Select a connection which has some bendpoints
var connection = ...;

// Set the bendpoint at index position 0 to new bendpoint
// Will throw an exception if index is out of range
connection.setRelativeBendpoint(bp, 0);

.source

Get the source of a Connection.

connection.source // => return the diagram object/connection which is the source of the connection

.specialization

See .specialization

.style

Set the style of a non-ArchiMate Connection.

connection.style = styleBits;

Allowed values are defined as constants and can be OR'd together with the | operator:

CONNECTION_STYLE.LINE_SOLID (value of 0)
CONNECTION_STYLE.ARROW_FILL_TARGET (value of 1)
CONNECTION_STYLE.LINE_DASHED (value of 2)
CONNECTION_STYLE.LINE_DOTTED (value of 4)
CONNECTION_STYLE.ARROW_NONE (value of 0)
CONNECTION_STYLE.ARROW_FILL_SOURCE (value of 8)
CONNECTION_STYLE.ARROW_HOLLOW_TARGET (value of 16)
CONNECTION_STYLE.ARROW_HOLLOW_SOURCE (value of 32)
CONNECTION_STYLE.ARROW_LINE_TARGET (value of 64)
CONNECTION_STYLE.ARROW_LINE_SOURCE (value of 128)

Example:

connection.style = CONNECTION_STYLE.LINE_DASHED | CONNECTION_STYLE.ARROW_HOLLOW_SOURCE | CONNECTION_STYLE.ARROW_FILL_TARGET;

.target

Get the target of a Connection.

connection.target // => return the diagram object/connection which is the target of the connection