isValidLink method

bool isValidLink([
  1. Node? fromnode,
  2. GraphObject? fromport,
  3. Node? tonode,
  4. GraphObject? toport,
])

This predicate should be true when it is logically valid to connect a new link from one node/port to another node/port. When this is called by the RelinkingTool, that tool sets #originalLink to be the Link being reconnected.

For a more general discussion of validation, see Introduction to Validation.

This method may be overridden, although it is usually much easier to just set #linkValidation or Node#linkValidation in order to add some application-specific link validation. Please read the Introduction page on Extensions for how to override methods and how to call this base method. @expose @param {Node} fromnode the "from" Node. @param {GraphObject} fromport the "from" GraphObject port. @param {Node} tonode the "to" Node. @param {GraphObject} toport the "to" GraphObject port. @return {boolean} False if #isValidFrom is false for the "from" node/port. False if #isValidTo is false for the "to" node/port. False if #isInSameNode is true unless GraphObject#fromLinkableSelfNode and GraphObject#toLinkableSelfNode are true for the two ports. False if #isLinked is true unless GraphObject#fromLinkableDuplicates and GraphObject#toLinkableDuplicates are true for the two ports. False if trying to link to the link's own label node(s). If Node#linkValidation is a predicate on either or both of the "from" node and the "to" node, the predicate is called and if it returns false, this predicate returns false. If #linkValidation is a predicate and if it returns false, this predicate returns false. Otherwise this predicate is true.

Implementation

_i2.bool isValidLink([
  _i3.Node? fromnode,
  _i3.GraphObject? fromport,
  _i3.Node? tonode,
  _i3.GraphObject? toport,
]) =>
    _i4.callMethod(
      this,
      'isValidLink',
      [
        fromnode ?? _i5.undefined,
        fromport ?? _i5.undefined,
        tonode ?? _i5.undefined,
        toport ?? _i5.undefined,
      ],
    );