public interface ILabel extends IModelItem
IGraph
implementation for labels.
This interface provides read-only access to the properties of a label. In order to modify the state of an instance use
the various methods provided by the IGraph
this instance belongs to. Labels are stored in
IListEnumerable<ILabel>
s, that can be obtained from ILabelOwner
implementations' Labels
property. Typical owners of a label are INode
and IEdge
instances. 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.
Some useful static methods can be found inGraphExtensions
.Modifier and Type | Method and Description |
---|---|
default int |
getIndex()
Gets the index of the label at its
Owner . |
default IOrientedRectangle |
getLayout()
Gets a snapshot of the current layout of the label.
|
ILabelModelParameter |
getLayoutParameter()
Gets the label model's parameter that determines the positioning of this label.
|
ILabelOwner |
getOwner()
Gets the owner of this label.
|
SizeD |
getPreferredSize()
Gets the preferred size of the label with respect to its current contents and the implementation of the visualization.
|
ILabelStyle |
getStyle()
Returns the style that is responsible for the visual representation of this node in a
CanvasControl . |
String |
getText()
Gets the text string associated with this label.
|
createDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, lookup, safeLookup
default int getIndex()
Owner
.Labels
list; -1
if the label is not
part of a label owner.default IOrientedRectangle getLayout()
Labels have a size
and are anchored at a given location in world coordinate
space. The anchor is the point around which the oriented rectangle is rotated in the world coordinate system. If the
oriented rectangle has default orientation, i.e. its up vector points north (<0,-1>
), it coincides with its
lower left corner. The positioning of the label is determined using a pair of ILabelModel
and ILabelModelParameter
. In order to modify the layout of a label instance, set another LayoutParameter
for this label or modify its associated instance.
ILabelModelParameter getLayoutParameter()
In order to set a different parameter for this label, use IGraph
's IGraph.setLabelLayoutParameter(ILabel, ILabelModelParameter)
method. Note that the label model parameter instance associated with a label instance may be shared between multiple
label instances and that the modification of this instance or its Model
will
result in a change of the positioning of all labels that are associated with the same parameter or model instance.
ILabelOwner getOwner()
SizeD getPreferredSize()
Often times the layout's
size will be the same as the preferred size, but it's up to the
implementation of the ILabelModel
to interpret it differently. In order to
set a different preferred size for this label instance use IGraph
's IGraph.setLabelPreferredSize(ILabel, SizeD)
method.
ILabelStyle getStyle()
CanvasControl
.
In order to set the style on an instance, use the IGraph.setStyle(ILabel, ILabelStyle)
method. Note that the style instance associated with a label instance may be shared between multiple label instances and
that the modification of this style will result in a change of the appearance of all labels that are associated with the
same style instance.