Ports
Ports are structural elements since edges connect to ports at their source and target end. They always have to belong to a node or edge, or, more generally, to a port owner. The port owner is modeled by the IPortOwner interface which is a super interface for both INode and IEdge.
Note that a port owner can hold an arbitrary number of ports. Also note that ports can exist without edges linking to them, e.g. to provide potential connection points in an interactive scenario.
Besides their structural role they also provide a geometry, i.e. a location, and a style (i.e. a visual information, although ports are invisible by default):
Property | Setter Method | Description |
---|---|---|
Similar to the other graph items, you can only create or remove ports using methods provided by IGraph.
- addPortAt
- addPort
- Creates a new port for the given owner. The new port’s properties will get the default values as defined in the port defaults if they are not passed as parameters.
- remove(item: IModelItem): void
- Removes the given port from the graph. Before the port is removed all adjacent edges are removed, too.
You can only modify or remove ports which are part of the current graph instance. Trying to modify or remove a port which already has been removed will result in an exception. Also, if your use case involves several IGraph instances (especially if you are using filtering or folding) take care to modify and remove ports only with the graph the port belongs to.