Home > @jsplumbtoolkit/core > Selection
Selection class
A selection is a group of vertices and edges, upon which you can perform bulk operations.
Signature:
export declare class Selection<T = Node | Edge | Group> extends AbstractFilterableDataset implements DataSource
Extends: AbstractFilterableDataset
Implements: DataSource
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(toolkit, params) | Constructs a new instance of the Selection class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
_edges | Array<Edge> | ||
_groups | Array<Group> | ||
_loading | boolean | ||
_nodes | Array<Node> | ||
autoFill | boolean | ||
capacityPolicy | string | ||
dataSource | DataSource | ||
debugEnabled | boolean | ||
DISCARD_EXISTING | static | string | |
DISCARD_NEW | static | string | |
edgeFactory | ObjectFactory | ||
generator | Function | ||
maxEdges | number | ||
maxGroups | number | ||
maxNodes | number | ||
onBeforeReload | Function | ||
onClear | Function | ||
onReload | Function | ||
toolkit | JsPlumbToolkit |
Methods
Method | Modifiers | Description |
---|---|---|
_fireListEvent(obj, suffix) | ||
_pushToList(obj) | ||
addEdge(params, source, doNotFireEvent) | ||
addPort(node, data, doNotFireEvent) | ||
addToGroup(node, group, sourceGroup, position) | ||
append(obj, evtPipe) | Appends the given object to the selection. | |
batch(fn) | ||
beforeConnect(source, target, data) | ||
beforeDetach(source, target, edge) | ||
beforeMoveConnection(source, target, edge) | ||
beforeStartConnect(source, type) | ||
beforeStartDetach(source, edge) | ||
clear(doNotFireEvent) | ||
containsVertex(id) | Returns whether or not the vertex (node/group) with the given id is in the selection. | |
eachEdge(fn) | Iterates the Edges in the selection, calling the supplied callback for each item. The callback's signature should be function(index, item) . | |
eachGroup(fn) | Iterates the Groups in the selection, calling the supplied callback for each item. The callback's signature should be function(index, item) . | |
eachNode(fn) | Iterates the Nodes in the selection, calling the supplied callback for each item. The callback's signature should be function(index, item) . | |
eachVertex(fn) | Iterates the Nodes and the Groups in the selection, calling the supplied callback for each item. The callback's signature should be function(index, item) . | |
edgeMoved(edge, obj, index) | ||
getAll() | Gets all the nodes, edges and groups. | |
getAllEdgesFor(node, filter) | Gets all Edges for the given Node or Group. | |
getEdge(edgeId) | ||
getEdgeAt(idx) | Gets the Edge at the given index. | |
getEdgeCount() | Get the current number of Edges in the selection. | |
getEdges() | Gets all the edges in the selection | |
getEdgeType(edgeData) | ||
getGraph() | ||
getGroup(id) | Gets the Group with the given ID, if it is in the selection. | |
getGroupAt(idx) | Gets the Group at the given index. | |
getGroupCount() | Get the current number of Groups in the selection. | |
getGroups() | Gets all the Groups in the Selection. | |
getModel() | ||
getNode(id) | Gets the Node with the given ID, if it is in the current selection | |
getNodeAt(idx) | Gets the node at the given index. | |
getNodeCount() | Get the current number of Nodes in the selection. | |
getNodeId(node) | ||
getNodes() | Gets all the Nodes in the Selection. | |
getNodeType(nodeData) | ||
getObjectInfo(obj) | ||
getPortId(port) | ||
getPortType(port) | ||
getSourceEdgesFor(v) | Gets all source Edges for the given Node or Group. | |
getVertex(id) | Returns the vertex with the given id, if it is in the selection. | |
reload() | Reloads the content of this Selection, if a generator was supplied to the constructor. Otherwise does nothing. A data load start event is fired first, followed by a call to the generator to repopulate, and then a data load end event is fired. So calling this method on a Selection that you are rendering to a Surface will cause the Surface to repaint itself. | |
remove(obj, evtPipe) | Removes the given object from the selection. | |
removeEdge(edge) | ||
removeFromGroup(node, doNotFireEvent, targetGroup, source) | ||
setCapacityPolicy(policy) | Sets the action taken when appending an edge or node that would take the selection above its limit for that given type. | |
setEdgeGeometry(edge, geometry, renderer) | ||
setMaxEdges(_maxEdges) | Sets the maximum number of edges the selection can hold. The action taken when appending an edge that would take the selection above its limit depends on the current capacityPolicy , which can be either Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW. | |
setMaxGroups(_maxGroups) | Sets the maximum number of groups the selection can hold. The action taken when appending a group that would take the selection above its limit depends on the current capacityPolicy , which can be either Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW. | |
setMaxNodes(_maxNodes) | Sets the maximum number of nodes the selection can hold. The action taken when appending a node that would take the selection above its limit depends on the current capacityPolicy , which can be either Selection.DISCARD_EXISTING (the default) or Selection.DISCARD_NEW. | |
setSuspendGraph(v) | ||
toggle(obj, evtPipe) | Toggles the given object's membership in the current selection. If obj is a Path, then the individual members of the Path are toggled independently. |