new Endpoint()
- Source:
- endpoint-api.js, line 1
Extends
Members
-
canvas
-
The Endpoint's drawing area
- Source:
- endpoint-api.js, line 5
-
connections
-
List of Connections for the Endpoint.
- Source:
- endpoint-api.js, line 7
-
overlays
-
List of Overlays for this component.
- Inherited From:
- Source:
- overlaycomponent.js, line 3
-
scope
-
Scope descriptor for the Endpoint.
- Source:
- endpoint-api.js, line 9
Methods
-
addClass(class)
-
Adds a class or some classes to the visual elements for the given component.
Parameters:
Name Type Description classString The class(es) to add. The values are appended as given, meaning you can supply a space separated string of several classes if you wish.
- Inherited From:
- Source:
- uicomponent.js, line 11
-
addOverlay(overlaySpec)
-
Adds an Overlay to the component.
Parameters:
Name Type Description overlaySpecObject Specification of the Overlay to add.
- Inherited From:
- Source:
- overlaycomponent.js, line 29
-
addType(typeId, params, doNotRepaint)
-
Adds a type to the component. Note this is distinct from jsPlumbUIComponent#setType, which overrides all current types - this function just adds a type to the existing list.
Parameters:
Name Type Argument Default Description typeIdString Id of the type to add.
paramsObject <optional>
Optional params to use when applying the type.
doNotRepaintBoolean <optional>
false Tells jsPlumb not to repaint after adding the type.
- Inherited From:
- Source:
- uicomponent.js, line 23
-
bind(event, listener)
-
Binds a listener to an event.
Parameters:
Name Type Description eventString Name of the event to bind to.
listenerFunction Function to execute.
- Inherited From:
- Source:
- util-api.js, line 21
-
cleanupListeners()
-
Removes all listeners.
- Inherited From:
- Source:
- util-api.js, line 28
-
detach(connection)
-
Detach and cleanup a connection.
Parameters:
Name Type Description connectionConnection - Source:
- endpoint-api.js, line 18
-
detachAll(fireEvent)
-
Detach all connections for this endpoint.
Parameters:
Name Type Argument Default Description fireEventBoolean <optional>
true Whether or not to fire an event for each detach.
- Source:
- endpoint-api.js, line 20
-
detachFrom(targetEndpoint, fireEvent)
-
Detach from the given target endpoint.
Parameters:
Name Type Argument Default Description targetEndpointEndpoint Endpoint between which and this Endpoint to detach all connections.
fireEventBoolean <optional>
true Whether or not to fire an event.
- Source:
- endpoint-api.js, line 22
-
detachFromConnection(connection)
-
Detach from the given connection, without cleaning up or destroying the connection.
Parameters:
Name Type Description connectionConnection - Source:
- endpoint-api.js, line 16
-
Endpoint(params)
-
You never instantiate an Endpoint directly, but, with the exception of
source, all of the constructor parameters described here are valid in the params object you pass to ajsPlumb.addEndpoint,jsPlumb.makeSourceorjsPlumb.makeTargetcall.Parameters:
Name Type Description paramsObject Constructor parameters.
Properties
Name Type Argument Default Description anchorString | Array <optional>
Definition of the Anchor for the endpoint. See the jsPlumb documentation for a discussion of this.
endpointString | Array <optional>
Endpoint definition. See the jsPlumb documentation for a discussion of this.
enabledBoolean <optional>
true Whether or not the Endpoint should be enabled for mouse events (drag/drop).
paintStyleObject <optional>
null Endpoint style, a js object. may be null.
hoverPaintStyleObject <optional>
null Style to use when the mouse is hovering over the Endpoint. A js object. may be null; defaults to null.
cssClassString <optional>
null CSS class to set on the display element associated with this Endpoint.
hoverClassString <optional>
null CSS class to set on the display element associated with this Endpoint when it is in hover state.
sourceString | Selector | Element Element the Endpoint is attached to, of type String (an element id), element selector, or element. Required.
containerString | Selector | Element <optional>
Id or selector instructing jsPlumb where to attach the element it creates for this endpoint. you should read the documentation for a full discussion of this.
connectionsConnection[] <optional>
List of Connections to configure the Endpoint with.
isSourceBoolean <optional>
false Indicates the endpoint can act as a source of new connections. Optional; defaults to false.
maxConnectionsInteger <optional>
1 A value of -1 means no upper limit.
dragOptionsObject <optional>
If
isSourceis set to true, you can supply arguments for the underlying library's drag method. Optional; defaults to null.connectorStyleObject <optional>
If
isSourceis set to true, this is the paint style for Connections from this Endpoint. Optional; defaults to null.connectorHoverStyleObject <optional>
If
isSourceis set to true, this is the hover paint style for Connections from this Endpoint. Optional; defaults to null.connectorString | Object <optional>
Connector type to use. Like
endpoint, this may be either a single string nominating a known Connector type (eg."Bezier","Straight"), or an array containing [name, params], eg.[ "Bezier", { curviness:160 } ].connectorOverlaysObject[] <optional>
Array of Overlay definitions that will be applied to any Connection from this Endpoint.
connectorClassString <optional>
CSS class to set on Connections emanating from this Endpoint.
connectorHoverClassString <optional>
CSS class to set on to set on Connections emanating from this Endpoint when they are in hover state.
connectionsDetachableBoolean <optional>
true Sets whether connections to/from this Endpoint should be detachable or not.
isTargetBoolean <optional>
false Indicates the endpoint can act as a target of new connections. Optional; defaults to false.
dropOptionsObject <optional>
If
isTargetis set to true, you can supply arguments for the underlying library's drop method with this parameter. Optional; defaults to null.reattachBoolean <optional>
false Determines whether or not the Connections reattach after they have been dragged off an Endpoint and left floating. defaults to false: Connections dropped in this way will just be deleted.
parametersObject <optional>
{} JS object containing parameters to set on the Endpoint. These parameters are then available via the getParameter method. When a connection is made involving this Endpoint, the parameters from this Endpoint are copied into that Connection. Source Endpoint parameters override target Endpoint parameters if they both have a parameter with the same name.
connector-pointer-eventsString <optional>
A value for the 'pointer-events' property of any SVG elements that are created to render connections from this endoint.
- Source:
- endpoint-api.js, line 3
-
getElement() → {Element}
-
- Source:
- endpoint-api.js, line 24
Returns:
The DOM element this Endpoint is attached to.
- Type
- Element
-
getLabel()
-
Returns the label text for this component (or a function if you are labelling with a function). This does not return the overlay itself; this is a convenience method which is a pair with
setLabel; together they allow you to add and access a Label Overlay without having to create the Overlay object itself. For access to the underlying label overlay that jsPlumb has created, usegetLabelOverlay.- Inherited From:
- Source:
- overlaycomponent.js, line 5
- See:
-
- #getOverlay
- #getLabelOverlay
-
getLabelOverlay() → {Overlay}
-
- Inherited From:
- Source:
- overlaycomponent.js, line 7
- See:
-
- #setLabel
Returns:
The underlying internal label overlay, which will exist if you specified a label on a
connectcall, or have calledsetLabelat any stage. Otherwise it will be null.- Type
- Overlay
-
getOverlay(overlayId) → {Overlay}
-
Gets an overlay, by ID. Note: by ID. You would pass an 'id' parameter in to the Overlay's constructor arguments, and then use that to retrieve it via this method.
Parameters:
Name Type Description overlayIdString Id of the overlay to retrieve.
- Inherited From:
- Source:
- overlaycomponent.js, line 9
Returns:
The overlay stored against the given id, null if not found.
- Type
- Overlay
-
getOverlays() → {Array}
-
Gets all the overlays for this component.
- Inherited From:
- Source:
- overlaycomponent.js, line 11
Returns:
List of the component's overlays.
- Type
- Array
-
getParameter(name) → {Object}
-
Gets a parameter from the component
Parameters:
Name Type Description nameString Name of the parameter to get
- Inherited From:
- Source:
- uicomponent.js, line 3
Returns:
The given parameter's value, null if not found.
- Type
- Object
-
getParameters() → {Object}
-
Gets all parameters from the component. Note that you are given the actual parameters object, not a copy, so you can alter their values directly, and if you hold the reference to the parameters object you could cause a memory leak.
- Inherited From:
- Source:
- uicomponent.js, line 7
Returns:
All of the component's parameters.
- Type
- Object
-
getType() → {String[]}
-
Gets the current type - or types - for this component.
- Inherited From:
- Source:
- uicomponent.js, line 17
Returns:
The current list of types, empty if none registered.
- Type
- String[]
-
getUuid() → {String}
-
- Source:
- endpoint-api.js, line 26
Returns:
The UUID for this Endpoint, if there is one. Otherwise returns null.
- Type
- String
-
hasType(typeId) → {Boolean}
-
Returns whether or not the component currently has the given type.
Parameters:
Name Type Description typeIdString Id of the type to check for
- Inherited From:
- Source:
- uicomponent.js, line 21
Returns:
True if the component has the type, false if not.
- Type
- Boolean
-
hideOverlay(overlayId)
-
Hides the overlay specified by the given id.
Parameters:
Name Type Description overlayIdString Id of the overlay to hide.
- Inherited From:
- Source:
- overlaycomponent.js, line 13
-
hideOverlays()
-
Hides all Overlays for this component.
- Inherited From:
- Source:
- overlaycomponent.js, line 15
-
isEnabled() → {Boolean}
-
- Source:
- endpoint-api.js, line 28
Returns:
True if the Endpoint is enabled for drag/drop connections enabled, false otherwise.
- Type
- Boolean
-
isFull() → {Boolean}
-
- Source:
- endpoint-api.js, line 30
Returns:
True if the Endpoint cannot accept any more Connections, false otherwise.
- Type
- Boolean
-
isHover() → {Boolean}
-
Returns whether or not the object is currently in hover state
- Inherited From:
- Source:
- uicomponent.js, line 29
Returns:
True if in hover state, false if not.
- Type
- Boolean
-
isSuspendEvents() → {Boolean}
-
- Inherited From:
- Source:
- util-api.js, line 27
Returns:
True if events are suspended, false otherwise.
- Type
- Boolean
-
isVisible() → {Boolean}
-
- Source:
- endpoint-api.js, line 32
Returns:
Whether or not the Endpoint is currently visible.
- Type
- Boolean
-
reapplyTypes(params)
-
Reapplies the current list of types with the given (optional) parameters. See the jsPlumb documentation for a full discussion of types.
Parameters:
Name Type Argument Description paramsObject <optional>
Optional params to use when reapplying types.
- Inherited From:
- Source:
- uicomponent.js, line 19
-
removeAllOverlays()
-
Removes all overlays from the component, and then repaints.
- Inherited From:
- Source:
- overlaycomponent.js, line 21
-
removeClass(class)
-
Removes a class or some classes from the visual elements for the given component. You can supply a space separated string of several classes if you wish.
Parameters:
Name Type Description classString The class(es) to remove.
- Inherited From:
- Source:
- uicomponent.js, line 13
-
removeOverlay(overlayId)
-
Removes an overlay by ID. Note: by ID. this is a string you set in the overlay spec.
Parameters:
Name Type Description overlayIdString Id of the overlay to remove.
- Inherited From:
- Source:
- overlaycomponent.js, line 23
-
removeOverlays(overlayIds)
-
Removes a set of overlays by ID. Note: by ID. This is a string you set in the overlay spec.
Parameters:
Name Type Argument Description overlayIdsString <repeatable>
This function takes an arbitrary number of arguments, each of which is a single overlay id.
- Inherited From:
- Source:
- overlaycomponent.js, line 25
-
removeType(typeId, doNotRepaint)
-
Removes the given type from the component.
Parameters:
Name Type Argument Default Description typeIdString Id of the type to remove.
doNotRepaintBoolean <optional>
false Tells jsPlumb not to repaint after removing the type.
- Inherited From:
- Source:
- uicomponent.js, line 25
-
setAnchor(anchorParams, doNotRepaint) → {Endpoint}
-
Sets the anchor to use for this Endpoint.
anchorParamsis an object in the same form that you would pass as theanchorparameter tojsPlumb.addEndpointorjsPlumb.connect.Parameters:
Name Type Argument Default Description anchorParamsobject Parameters for the anchor
doNotRepaintboolean <optional>
false Instructs jsPlumb to not repaint after setting the new anchor.
- Source:
- endpoint-api.js, line 12
Returns:
The Endpoint.
- Type
- Endpoint
-
setDragAllowedWhenFull(allowed)
-
Sets whether or not connections can be dragged from this Endpoint once it is full. You would use this in a UI in which you're going to provide some other way of breaking connections, if you need to break them at all. This property is by default true; use it in conjunction with the 'reattach' option on a connect call.
Parameters:
Name Type Description allowedBoolean Whether drag is allowed or not when the Endpoint is full.
- Source:
- endpoint-api.js, line 34
-
setElement(el) → {Endpoint}
-
Sets the DOM element this Endpoint is attached to.
Parameters:
Name Type Description elString | Selector | Element Element id, DOM element or selector identifying the new element param {String|Selector|Element} [container] Specifies the actual parent element to use as the parent for this Endpoint's visual representation. See the jsPlumb documentation for a discussion about this.
- Source:
- endpoint-api.js, line 36
Returns:
The Endpoint.
- Type
- Endpoint
-
setEnabled(enabled)
-
Sets whether or not the Endpoint is enabled for drag/drop connections.
Parameters:
Name Type Description enabledBoolean Whether or not the Endpoint is enabled.
- Source:
- endpoint-api.js, line 38
-
setEndpoint(ep)
-
Sets the underlying visual representation to use for this Endpoint.
epis an object in the same form that you would pass as theendpointparameter tojsPlumb.addEndpointorjsPlumb.makeSource.Parameters:
Name Type Description epObject Parameters for the endpoint
- Source:
- endpoint-api.js, line 14
-
setHover(hover, ignoreAttachedElements)
-
Sets/unsets the hover state of this component.
Parameters:
Name Type Argument Default Description hoverBoolean Hover state boolean
ignoreAttachedElementsBoolean <optional>
false If true, does not notify any attached elements of the change in hover state. Used mostly by jsPlumb internally, to avoid infinite loops.
- Inherited From:
- Source:
- uicomponent.js, line 33
-
setHoverPaintStyle(style, doNotRepaint)
-
Sets the paint style to use when the mouse is hovering over the component. This is null by default. The hover paint style is applied as extensions to the paintStyle; it does not entirely replace it. This is because people will most likely want to change just one thing when hovering, say the color for example, but leave the rest of the appearance the same.
Parameters:
Name Type Argument Description styleObject Style to use when the mouse is hovering.
doNotRepaintBoolean <optional>
If true, the component will not be repainted. Useful when setting things up initially.
- Inherited From:
- Source:
- uicomponent.js, line 31
-
setLabel(label)
-
Sets the component's label.
Parameters:
Name Type Description labelString | Function | Object Label to set. May be a String, a Function that returns a String, or a params object containing { "label", "labelStyle", "location", "cssClass" }. Note that this uses innerHTML on the label div, so keep that in mind if you need escaped HTML.
- Inherited From:
- Source:
- overlaycomponent.js, line 27
-
setPaintStyle(style, doNotRepaint)
-
Sets the component's paint style and then repaints the component.
Parameters:
Name Type Argument Default Description styleObject Style to use.
doNotRepaintBoolean <optional>
false If true, the component will not be repainted.
- Inherited From:
- Source:
- uicomponent.js, line 35
-
setParameter(name, value)
-
Sets a parameter on the component
Parameters:
Name Type Description nameString Name of the parameter to set
valueObject Value to set
- Inherited From:
- Source:
- uicomponent.js, line 5
-
setParameters(params)
-
Sets all parameters on the component.
Parameters:
Name Type Description paramsObject Parameters to set.
- Inherited From:
- Source:
- uicomponent.js, line 9
-
setType(typeId, params, doNotRepaint)
-
This function sets a
typefor the given component. It replaces all existing types. For a full discussion of the concept of types, see the jsPlumb documentation.Parameters:
Name Type Argument Default Description typeIdString Id of the type to set.
paramsObject <optional>
Optional parameter object to expand.
doNotRepaintBoolean <optional>
false Tells jsPlumb not to repaint after setting the type.
- Inherited From:
- Source:
- uicomponent.js, line 15
-
setVisible(visible, doNotChangeConnections, doNotNotifyOtherEndpoint)
-
Sets whether or not the Endpoint is currently visible.
Parameters:
Name Type Argument Default Description visibleBoolean Whether or not the Endpoint should be visible.
doNotChangeConnectionsBoolean <optional>
false Instructs jsPlumb to not pass the visible state on to any attached Connections.
doNotNotifyOtherEndpointBoolean <optional>
false Instructs jsPlumb to not pass the visible state on to Endpoints at the other end of any attached Connections.
- Source:
- endpoint-api.js, line 40
-
showOverlay(overlayId)
-
Shows the overlay specified by the given id.
Parameters:
Name Type Description overlayIdString Id of the overlay to show.
- Inherited From:
- Source:
- overlaycomponent.js, line 18
-
showOverlays()
-
Shows all Overlays for this component.
- Inherited From:
- Source:
- overlaycomponent.js, line 20
-
suspendEvents(val)
-
Sets whether or not events are suspended.
Parameters:
Name Type Description valBoolean Whether or not to suspend events.
- Inherited From:
- Source:
- util-api.js, line 26
-
toggleType(typeId, params, doNotRepaint)
-
Toggles the given type on the component.
Parameters:
Name Type Argument Default Description typeIdString Id of the type to toggle.
paramsObject <optional>
Optional params to use if the type does not exist and jsPlumb applies it.
doNotRepaintBoolean <optional>
false Tells jsPlumb not to repaint after toggling the type.
- Inherited From:
- Source:
- uicomponent.js, line 27
-
unbind(event)
-
Clears either all listeners, or listeners for some specific event.
Parameters:
Name Type Argument Description eventString <optional>
Optional. constrains the clear to just listeners for this event.
- Inherited From:
- Source:
- util-api.js, line 25