public class SimpleNode extends Object implements INode
INode
interface that can be used stand-alone.
Note that this class is not the one used as the default implementation of a DefaultGraph
's INode
s and
casting them to SimpleNode
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 node into a graphics context: Simply create a
SimpleNode
, associate a style with it and use the style's renderer instance to obtain a rendering for the
node.
Constructor and Description |
---|
SimpleNode()
Creates a default node with default
lookup , an instance of
VoidNodeStyle , empty Layout and no labels or ports. |
Modifier and Type | Method and Description |
---|---|
IListEnumerable<ILabel> |
getLabels()
Gets the collection for the labels.
|
IRectangle |
getLayout()
Returns a live view of the layout of the node.
|
ILookup |
getLookupImplementation()
Gets the
ILookup implementation used for calls to lookup(Class) on this instance. |
IListEnumerable<IPort> |
getPorts()
Provides access to a collection of
ports that are owned by this instance. |
INodeStyle |
getStyle()
Returns the style that is responsible for the visual representation of this node 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 |
setLabels(IListEnumerable<ILabel> value)
Sets the collection for the labels.
|
void |
setLayout(IRectangle value)
Returns a live view of the layout of the node.
|
void |
setLookupImplementation(ILookup value)
Sets the
ILookup implementation used for calls to lookup(Class) on this instance. |
void |
setPorts(IListEnumerable<IPort> value)
Provides access to a collection of
ports that are owned by this instance. |
void |
setStyle(INodeStyle value)
Returns the style that is responsible for the visual representation of this node in a
CanvasControl . |
void |
setTag(Object value)
Sets the tag associated with this instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookup
public final IListEnumerable<ILabel> getLabels()
getLabels
in interface ILabelOwner
setLabels(IListEnumerable)
public final IRectangle getLayout()
INode
The layout of a node is a rectangle in the world coordinate system that describes the bounding box of the representation
of a node. Since this method will yield a live view, it is up to the client to copy the values of the instance if a
snapshot of the state is needed. In order to modify the layout of a node, use the various methods
in IGraph
.
public final ILookup getLookupImplementation()
ILookup
implementation used for calls to lookup(Class)
on this instance.setLookupImplementation(ILookup)
public final IListEnumerable<IPort> getPorts()
IPortOwner
ports
that are owned by this instance.
This gives access to a read-only live view of the ports, i.e. the collection can change over time, as well as the ports contained in it. If a snapshot of the current state is needed, one needs to copy the collection.
getPorts
in interface IPortOwner
public final INodeStyle getStyle()
INode
CanvasControl
.
In order to set the style on an instance, use the IGraph.setStyle(INode, INodeStyle)
method. Note that the style instance associated with a node instance may be shared between multiple node instances and
that the modification of this style will result in a change of the appearance of all nodes that are associated with the
same style instance.
public final Object getTag()
ITagOwner
The implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.
getTag
in interface ITagOwner
ITagOwner.setTag(Object)
public <TLookup> TLookup lookup(Class<TLookup> type)
ILookup
null
.
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 setLabels(IListEnumerable<ILabel> value)
value
- The Labels to set.getLabels()
public final void setLayout(IRectangle value)
The layout of a node is a rectangle in the world coordinate system that describes the bounding box of the representation
of a node. Since this method will yield a live view, it is up to the client to copy the values of the instance if a
snapshot of the state is needed. In order to modify the layout of a node, use the various methods
in IGraph
.
value
- The Layout to set.getLayout()
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 setPorts(IListEnumerable<IPort> value)
ports
that are owned by this instance.
This gives access to a read-only live view of the ports, i.e. the collection can change over time, as well as the ports contained in it. If a snapshot of the current state is needed, one needs to copy the collection.
value
- The Ports to set.getPorts()
public final void setStyle(INodeStyle value)
CanvasControl
.
In order to set the style on an instance, use the IGraph.setStyle(INode, INodeStyle)
method. Note that the style instance associated with a node instance may be shared between multiple node instances and
that the modification of this style will result in a change of the appearance of all nodes that are associated with the
same style instance.
value
- The Style to set.getStyle()
public final void setTag(Object value)
ITagOwner
The implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.
setTag
in interface ITagOwner
value
- The user object associated with this instance.ITagOwner.getTag()