Packagecom.yworks.graph.model
Classpublic class CompositeLabelModel
InheritanceCompositeLabelModel Inheritance Object
Implements ILabelModel, ILabelModelParameterProvider, ILabelModelParameterFinder, Iterable, IMarkupExtensionFactory

This label model can be used as a composite of other ILabelModels.

Its implementation of the ILabelModelParameterProvider returns all parameters of all composed label models that do implement this interface on their part. The implementation of the ILabelModelParameterFinder collects the best parameters of all composed label models that do implement this interface on their part and returns the best of these. To add an ILabelModel it just has to be added to the labelModels collection.



Public Properties
 PropertyDefined By
  labelModels : Collection
[read-only] A Collection of the ILabelModels that shall be combined.
CompositeLabelModel
Public Methods
 MethodDefined By
  
CompositeLabelModel
  
Creates a default parameter that can be used for this model.
CompositeLabelModel
  
Creates a markup extension that can be used instead of the original class.
CompositeLabelModel
  
Tries to find a parameter that best matches the given layout for the provided label instance.
CompositeLabelModel
  
Provides a lookup context for the given combination of label and parameter.
CompositeLabelModel
  
Calculates the geometry in form of an IOrientedRectangle for a given label using the given model parameter.
CompositeLabelModel
  
The parameters of all composed ILabelModel in labelModels are returned.
CompositeLabelModel
  
Returns an iterator over a set of elements.
CompositeLabelModel
  
lookup(type:Class):Object
Returns an instance that implements the given type or null.
CompositeLabelModel
Property Detail
labelModelsproperty
labelModels:Collection  [read-only]

A Collection of the ILabelModels that shall be combined. All label models added to this collection will be used by the CompositeLabelModel.


Implementation
    public function get labelModels():Collection
Constructor Detail
CompositeLabelModel()Constructor
public function CompositeLabelModel()



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.
createMarkupExtension()method 
public function createMarkupExtension(context:ILookup):MarkupExtension

Creates a markup extension that can be used instead of the original class.

Parameters

context:ILookup — The context that shall be considered when creating the markup extension.

Returns
MarkupExtension
findBestParameter()method 
public function findBestParameter(label:ILabel, model:ILabelModel, labelLayout:IOrientedRectangle):ILabelModelParameter

Tries to find a parameter that best matches the given layout for the provided label instance.

This method may not necessarily find a parameter that matches the provided layout exactly. It uses the parameter of all its composed ILabelModels and picks the best one.

Parameters

label:ILabel — The label to find a parameter for.
 
model:ILabelModel — The model instance to use. This should be the instance this instance has been obtained from.
 
labelLayout:IOrientedRectangle — The anticipated layout for the label.

Returns
ILabelModelParameter — A non-null parameter that can be used for the label to approximate the provided layout.

See also

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
getParameters()method 
public function getParameters(label:ILabel, model:ILabelModel):Iterator

The parameters of all composed ILabelModel in labelModels are returned. Returns an iterator over a set of possible ILabelModelParameter instances that can be used for the given label and model.

Parameters

label:ILabel — The label instance to use.
 
model:ILabelModel — The model to provide parameters for.

Returns
Iterator — A possibly empty iterator over a set of label model parameters.
iterator()method 
public function iterator():Iterator

Returns an iterator over a set of elements.

Returns
Iterator — an Iterator.
lookup()method 
public function lookup(type:Class):Object

Returns an instance that implements the given type or 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.

Parameters

type:Class — the type for which an instance shall be returned

Returns
Object — an instance that is assignable to type or null