public class SimplePort extends Object implements IPort
IPort interface that can be used stand-alone.
Note that this class is not the one used as the default implementation of a DefaultGraph's IPorts and
casting them to SimplePort will fail. Instances of this class can be used without an accompanying graph
instance. All of the properties are mutable. An example of a possible use case would be the rendering of a port into a
graphics context: Simply create a
SimplePort, associate a style with it and use the style's renderer instance to obtain a rendering for the
port.
| Constructor and Description |
|---|
SimplePort(IPortOwner owner,
IPortLocationModelParameter locationParameter)
Creates a port with a
default lookup using the given location and owner. |
| Modifier and Type | Method and Description |
|---|---|
IPortLocationModelParameter |
getLocationParameter()
Gets the
IPortLocationModelParameter that is used to determine the location of this port. |
ILookup |
getLookupImplementation()
Gets the
ILookup implementation used for calls to lookup(Class) on this instance. |
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. |
Object |
getTag()
Gets the tag associated with this instance.
|
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null. |
void |
setLocation(PointD location)
Sets the location of this port.
|
void |
setLocationParameter(IPortLocationModelParameter value)
Sets the
IPortLocationModelParameter that is used to determine the location of this port. |
void |
setLookupImplementation(ILookup value)
Sets the
ILookup implementation used for calls to lookup(Class) on this instance. |
void |
setOwner(IPortOwner value)
Returns the owner of this port.
|
void |
setStyle(IPortStyle value)
Returns the style that is responsible for the visual representation of this port in a
CanvasControl. |
void |
setTag(Object value)
Sets the tag associated with this instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDynamicLocation, getLocationcreateDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookuppublic SimplePort(IPortOwner owner, IPortLocationModelParameter locationParameter)
default lookup using the given location and owner.
While technically the owner can be null here, this can cause issues, e.g. with port location models
that position the port relative to its owner.
owner - The port's owner.locationParameter - The port's location model parameter.public final IPortLocationModelParameter getLocationParameter()
IPortIPortLocationModelParameter 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 IPort.getLocation() and IPort.getDynamicLocation().
Note that parameters may be shared across port instances.
getLocationParameter in interface IPortIGraph.setPortLocationParameter(IPort, IPortLocationModelParameter),
IPort.getLocation(),
IPort.getDynamicLocation()public final ILookup getLookupImplementation()
ILookup implementation used for calls to lookup(Class) on this instance.setLookupImplementation(ILookup)public final IPortOwner getOwner()
IPort
In traditional IGraph implementations, this will be an INode
and can safely be cast to one. In order to get to the IEdges that connect to this
instance, use IGraph's IGraph.edgesAt(IPort, com.yworks.yfiles.graph.AdjacencyTypes)
method.
public final IPortStyle getStyle()
IPortCanvasControl.
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.
public final Object getTag()
ITagOwnerThe implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.
getTag in interface ITagOwnerITagOwner.setTag(Object)public <TLookup> TLookup lookup(Class<TLookup> type)
ILookupnull.
Typically, this method will be called in order to obtain a different view or
aspect of the current instance. This is quite similar to casting or using
a super type or interface of this instance, but is not limited to inheritance or
compile time constraints. An instance implementing this method is not
required to return non-null implementations for the types, nor does it
have to return the same instance any time. Also it depends on the
type and context whether the instance returned stays up to date or needs to
be reobtained for subsequent use.public final void setLocation(PointD location)
public final void setLocationParameter(IPortLocationModelParameter value)
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 IPort.getLocation() and IPort.getDynamicLocation().
Note that parameters may be shared across port instances.
value - The LocationParameter to set.IGraph.setPortLocationParameter(IPort, IPortLocationModelParameter),
IPort.getLocation(),
IPort.getDynamicLocation(),
getLocationParameter()public final void setLookupImplementation(ILookup value)
ILookup implementation used for calls to lookup(Class) on this instance.value - The LookupImplementation to set.getLookupImplementation()public final void setOwner(IPortOwner value)
In traditional IGraph implementations, this will be an INode
and can safely be cast to one. In order to get to the IEdges that connect to this
instance, use IGraph's IGraph.edgesAt(IPort, com.yworks.yfiles.graph.AdjacencyTypes)
method.
value - The Owner to set.getOwner()public final void setStyle(IPortStyle value)
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.
value - The Style to set.getStyle()public final void setTag(Object value)
ITagOwnerThe implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.
setTag in interface ITagOwnervalue - The user object associated with this instance.ITagOwner.getTag()