IBM ILOG Dojo Diagrammer 1.1 API Documentation
Legend: Array Boolean Constructor Date DomNode Error Function Namespace Number Object RegExp Singleton String

ibm_ilog.diagram.BasicPort (version 1.1-SNAPSHOT)

Object » ibm_ilog.diagram.PortBase » ibm_ilog.diagram.BasicPort
dojo.require("ibm_ilog.diagram.Port");

The default position is { x: 0.5, y: 0.5 }, and the default offset is { x: 0, y: 0 }.

Method Summary

  • computeConnectionPoint(link, parent, referencePoint, connectionPoint, originPoint, start) Implements the calculation of the connection and origin points for the BasicPort class.
  • constructor() Creates a new BasicPort with a default position set to the center of the node.
  • getBaseShape() Gets the shape contained in the owner node's template to which links should be connected.
  • getClipOnShape() Gets the flag that determines whether the connection point is "clipped" on the base shape of the node.
  • getConnectionBounds(parent) Gets the bounds of the owner node's base shape used to compute the connection point.
  • getConnectionPoint(link, parent, referencePoint, connectionPoint, originPoint, start) Gets the connection point and the origin point for this port.
  • getLinks() Gets the links connected to this port.
  • getLinksCount() Gets the number of links connected to this port.
  • getOffset() Gets the offset of this port.
  • getOwner() Gets the owner Node of this port.
  • getPosition() Gets the position of this port.
  • invalidateLinks() Invalidates the shape of all the links connected to this port.
  • isMovable() Gets the movable state of this port.
  • needsReferencePoint() Indicates whether or not this port needs a reference point to compute the connection point.
  • setClipOnShape(clipOnShape) Determines whether the connection point is "clipped" on the base shape of the node.
  • setMovable(m) Sets the movable state of this port. The ports are movable by default.
  • setOffset(offset) Sets the offset of this port.
  • setPosition(position) Sets the position of this port.

Attached Objects

Methods

computeConnectionPoint
The 'connectionPoint' argument.

The connection point is computed based on the position and offset properties. The origin point is always the center of the node.

ParameterTypeDescription
link
parent
referencePoint
connectionPoint
originPoint
start
constructor

The default position is { x: 0.5, y: 0.5 }, and the default offset is { x: 0, y: 0 }.

getBaseShape

The base shape is used by getConnectionBounds to compute the default connection bounds, and also when clipOnShape is true to clip the connection point if the base shape is non-rectangular. By default the base shape is determined by calling the getBaseShape() of the owner node, but this can be overridden to connect links to a different template part of the node.

getClipOnShape
True if the connection point is clipped on the node's shape, or false otherwise.

If clipOnShape is true, the getConnectionPoint method will extend the segment defined by the reference point and the connection point so that the connection point is on the outline of the node's shape, so that the connection point always "touches" the node shape even if the node is not rectangular (for example, if the node has an elliptical of polygonal shape). If clipOnShape is false, the getConnectionPoint always returns the return of computeConnectionPoint without modifying it, and the point may not be exactly on the boundary on the node shape.

getConnectionBounds
A rectangle (with 'x', 'y', 'width' and 'height' properties) containing the bounds used to compute the connection point.

This method returns the bounds that will be used by the port to compute the connection and origin points. The default implementation returns the bounds of the base shape returned by getBaseShape(). This method can be overridden to return different bounds.

ParameterTypeDescription
parentTheparent object (usually a Graph) that determines the coordinate space the bounds are relative to.
getConnectionPoint
The 'connectionPoint' argument.

This is the central method of the PortBase class and is called by the Link object to get its start and end points. This method calls computeConnectionPoint, which is the method that actually calculates the connection point in the PortBase subclasses. Then, getConnectionPoint applies the clipping if getClipOnShape() is true. So, getConnectionPoint should not be overridden in subclasses, computeConnectionPoint is the method that is overridden instead.

ParameterTypeDescription
linkibm_ilog.diagram.Link:The Link that is (or will be) connected to this port.
parentTheparent object (usually a Graph) that determines the coordinate space the connection point is relative to.
referencePointTheopposite point of the segment connected to this port.
connectionPointAnobject (with 'x' and 'y' properties) into which the connection point will be stored. The connection point is the point where the link will start or end.
originPointAnobject (with 'x' and 'y' properties) into which the origin point will be stored. The origin point is the point towards which the link will 'aim' (typically the center of the node), and is used to determine the shape of orthogonal links for example.
start
getLinks
An array of Links connected to this port.

Note that this method always returns a newly allocated array.

getLinksCount
Gets the number of links connected to this port.
getOffset
An object with 'x' and 'y' properties representing horizontal/vertical offsets in pixels.
Gets the offset of this port.
getOwner
The Node to which this port belongs.
Gets the owner Node of this port.
getPosition
An object with 'x' and 'y' properties representing a ratio (between 0 and 1) of the node width/height.
Gets the position of this port.
invalidateLinks

Invalidates the shape of all the links connected to this port. This method must be called by PortBase subclasses when a change of the port causes the connection point to change.

isMovable
True if graph layout and user interaction are allowed to change the position of the port. False if graph layout and user interaction are not allowed to change the position of the port.
Gets the movable state of this port.
needsReferencePoint
True if this port needs a reference point to compute the connection point, or false otherwise.

This method is used by a PortBase subclass implementation to signal whether or not it needs (and uses) the referencePoint argument passed to the getConnectionPoint method. A subclass must return true if it actually uses the referencePoint, or false if it does not use it. If needsReferencePoint returns true, the caller of the getConnectionPoint method (usually the Link object) must pass a valid referencePoint. If needsReferencePoint returns false, the PortBase subclass guarantees that the referencePoint will never be used or referenced, so the caller may pass an invalid point, or a null or undefined object. By default the method returns true if getClipOnShape() returns true, of false otherwise. PortBase subclasses that always need a reference point must override this method and return true.

setClipOnShape

If clipOnShape is true, the getConnectionPoint method will extend the segment defined by the reference point and the connection point so that the connection point is on the outline of the node's shape, so that the connection point always "touches" the node shape even if the node is not rectangular (for example, if the node has an elliptical of polygonal shape). If clipOnShape is false, the getConnectionPoint always returns the return of computeConnectionPoint without modifying it, and the point may not be exactly on the boundary on the node shape.

ParameterTypeDescription
clipOnShapeIftrue, the connection point is clipped on the node's shape, otherwise the connection point is the point returned by computeConnectionPoint.
setMovable
Sets the movable state of this port. The ports are movable by default.
ParameterTypeDescription
mBoolean:If 'm' is true, graph layout and user interaction are allowed to change the position of the port. If 'm' is false, graph layout and user interaction are not allowed to change the position of the port.
setOffset
Sets the offset of this port.
ParameterTypeDescription
offsetAnobject with 'x' and 'y' properties representing horizontal/vertical offsets in pixels.
setPosition
Sets the position of this port.
ParameterTypeDescription
positionAnobject with 'x' and 'y' properties representing a ratio (between 0 and 1) of the node width/height.