Interface used by IGraph to declare and obtain the defaults for ports at nodes and edges.
Inheritance Hierarchy
IPortDefaults
Remarks
Note that changing these defaults does not change properties of already created model items. Rather, only items created after the change are affected.
Examples
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.IPortDefaults
See Also
IPort,
INodeDefaults.ports,
IEdgeDefaults.ports,
IGraph.nodeDefaults,
IGraph.edgeDefaults,
Placing Ports,
Setting Defaults for new Items
Properties
Gets or sets whether unused ports should automatically be removed from their owners as soon as no further edge is connected to them.
Gets or sets the defaults for labels at ports.
Examples
graph.nodeDefaults.ports.labels.layoutParameter =
new FreePortLabelModel().createDefaultParameter()
See Also
Gets or sets the location model parameter to use for ports.
Remarks
Depending on the setting of shareLocationParameterInstance, the getLocationParameterInstance method should return a clone of this instance or the very same instance.
Examples
graph.nodeDefaults.ports.style = new NodeStylePortStyleAdapter(
new ShapeNodeStyle({ shape: ShapeNodeShape.ELLIPSE })
)
graph.nodeDefaults.ports.locationParameter =
FreeNodePortLocationModel.NODE_CENTER_ANCHORED
See Also
Gets or sets the style to use for ports.
Remarks
Depending on the setting of shareStyleInstance, the getStyleInstance method should return a clone of this instance or the very same instance.
Examples
graph.nodeDefaults.ports.style = new NodeStylePortStyleAdapter(
new ShapeNodeStyle({ shape: ShapeNodeShape.ELLIPSE })
)
graph.nodeDefaults.ports.locationParameter =
FreeNodePortLocationModel.NODE_CENTER_ANCHORED
See Also
Methods
Factory method that returns a location model parameter instance for use with newly created ports.
Remarks
Most implementations will yield either, a clone of or the locationParameter property, if shareLocationParameterInstance is enabled, but they might use more complicated logic, too.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- owner - IPortOwner
- The owner of the port that will be created.
Returns
- ↪IPortLocationModelParameter
- The parameter to use, which for most implementations is either a clone of or the locationParameter property, if shareLocationParameterInstance is enabled.
Factory method that returns a style instance for use with newly created ports.
Remarks
Most implementations will yield either, a clone of or the style property, if shareStyleInstance is enabled, but they might use more complicated logic, too.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- owner - IPortOwner
- The owner of the port that will be created.
Returns
- ↪IPortStyle
- The style to use, which for most implementations is either a clone of or the style property, if shareStyleInstance is enabled.