Packagecom.yworks.graph.model
Interfacepublic interface ILabelModel extends ILookup
Implementors CompositeLabelModel, DescriptorWrapperLabelModel, ExteriorLabelModel, FreeEdgeLabelModel, FreeNodeLabelModel, GenericLabelModel, InteriorLabelModel, InteriorStretchLabelModel, RotatedSideSliderEdgeLabelModel, RotatedSliderEdgeLabelModel, RotatingEdgeLabelModel, SliderEdgeLabelModel, StretchStripeLabelModel, StripeLabelModel

Yields the geometry of ILabel instances.

Label models can be used to describe the geometry of labels, respecting their ILabel.preferredSize and a ILabelModelParameter instance associated with a label.

Typically, a label model is used as a factory for label model parameters that can be associated with different label instances, e.g. using the IGraph.setLabelModelParameter method. Label model instances are designed to be shared for multiple model parameters, which themselves can be shared for multiple label instances.

This interface supports the ILookup.lookup method that can be used to query additional aspects of the implementation.



Public Methods
 MethodDefined By
  
Creates a default parameter that can be used for this model.
ILabelModel
  
Provides a lookup context for the given combination of label and parameter.
ILabelModel
  
Calculates the geometry in form of an IOrientedRectangle for a given label using the given model parameter.
ILabelModel
 Inherited
lookup(type:Class):Object
Returns an instance that implements the given type or null.
ILookup
Method Detail
createDefaultParameter()method
public function createDefaultParameter():ILabelModelParameter

Creates a default parameter that can be used for this model.

Returns
ILabelModelParameter — A parameter for this model instance.
getContext()method 
public function getContext(label:ILabel, parameter:ILabelModelParameter):ILookup

Provides a lookup context for the given combination of label and parameter.

Parameters

label:ILabel — The label to use in the context.
 
parameter:ILabelModelParameter — The parameter to use for the label in the context.

Returns
ILookup — An implementation of the ILookup interface that can be used to query additional aspects of the label/parameter combination.
getGeometry()method 
public function getGeometry(modelParameter:ILabelModelParameter, label:ILabel):IOrientedRectangle

Calculates the geometry in form of an IOrientedRectangle for a given label using the given model parameter.

Parameters

modelParameter:ILabelModelParameter — A parameter that has been created by this model. This is typically the parameter that yielded this instance through its ILabelModelParameter.model property.
 
label:ILabel — The label to calculate the geometry for

Returns
IOrientedRectangle — An instance that describes the geometry. This is typically an instance designed as a flyweight, so clients should not cache the instance but store the values if they need a snapshot for later use