public interface IPort extends IModelItem
IGraph
implementation for IEdge
s to connect to.
This interface provides read-only access to the properties of a port. In order to modify the state of an instance use
the various methods provided by the IGraph
this instance belongs to. Ports are owned by
IPortOwners
, normally an INode
, but this can also be an IEdge
in special graph
implementations. To obtain the IEdge
instances that are connected to a certain port instance, applications need
to use the IGraph.edgesAt(IPort, AdjacencyTypes)
method provided by IGraph
or the corresponding
convenience extension methods in GraphExtensions
. Zero or more edges may be connected to a port, depending on
the implementation of the graph. Like all items in an IGraph
, this item supports the ILookup.lookup(java.lang.Class)
method that can be used to query additional aspects of the item.
The graph model with all relevant types and their relationships is presented in detail in the section The Graph Model.
Using the look-up mechanism is explained in the section Service Locator Pattern: Lookup.
Modifier and Type | Method and Description |
---|---|
default IPoint |
getDynamicLocation()
Gets a live view of the location of the port in world coordinates.
|
default PointD |
getLocation()
Gets a snapshot of the current location of the port.
|
IPortLocationModelParameter |
getLocationParameter()
Gets the
IPortLocationModelParameter that is used to determine the location of this port. |
IPortOwner |
getOwner()
Returns the owner of this port.
|
IPortStyle |
getStyle()
Returns the style that is responsible for the visual representation of this port in a
CanvasControl . |
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, lookup, safeLookup
default IPoint getDynamicLocation()
The location is the anchor for the edges, that connect to this port, however it is up to the visualization logic where
exactly the visual part of an edge will end. As this will yield a live view, it is up to the client to copy the values
if a snapshot of the state is needed. In order to modify the location of a port, use the IGraph.setPortLocationParameter(IPort, IPortLocationModelParameter)
in IGraph
.
getLocationParameter()
default PointD getLocation()
Unlike getDynamicLocation()
this does not return a dynamic point that always refers to the current location.
IPortLocationModelParameter getLocationParameter()
IPortLocationModelParameter
that is used to determine the location of this port.
The port location can be calculated using the Model
's IPortLocationModel.getLocation(IPort, IPortLocationModelParameter)
method or the convenience methods getLocation()
and getDynamicLocation()
.
Note that parameters may be shared across port instances.
IGraph.setPortLocationParameter(IPort, IPortLocationModelParameter)
,
getLocation()
,
getDynamicLocation()
IPortOwner getOwner()
In traditional IGraph
implementations, this will be an INode
and can safely be cast to one. In order to get to the IEdge
s that connect to this
instance, use IGraph
's IGraph.edgesAt(IPort, com.yworks.yfiles.graph.AdjacencyTypes)
method.
IPortStyle getStyle()
CanvasControl
.
In order to set the style on an instance, use the IGraph.setStyle(IPort, IPortStyle)
method. Note that the style instance associated with a port instance may be shared between multiple port instances and
that the modification of this style will result in a change of the appearance of all ports that are associated with the
same style instance.