| Package | com.yworks.graph.model |
| Class | public class GenericLabelModel |
| Implements | ILabelModel, ILabelModelParameterProvider |
ILabelModel that can be used to create custom label models
out of existing ILabelModelParameter instances.
This class holds a number of parameters and serves as a container for these parameters. Custom models can easily be created that way:
GenericLabelModel glm = new GenericLabelModel(InteriorLabelModel.Center); glm.AddParameter(ExteriorLabelModel.North); glm.AddParameter(ExteriorLabelModel.South); glm.AddParameter(InteriorStretchLabelModel.East); glm.AddParameter(InteriorStretchLabelModel.West);
See also
| Property | Defined by | ||
|---|---|---|---|
| parameters : ArrayList
[read-only]
Gets the parameter list.
| GenericLabelModel | ||
| Method | Defined by | ||
|---|---|---|---|
|
GenericLabelModel(defaultParameter:ILabelModelParameter)
Create a new generic label model using the provided parameter as the default parameter.
| GenericLabelModel | ||
|
Adds another parameter to this models collection of parameters.
| GenericLabelModel | ||
|
Creates a default parameter that can be used for this model.
| GenericLabelModel | ||
|
Creates a new GenericParameter to wrap the ModelParameter in
| GenericLabelModel | ||
|
Calculates the geometry in form of an
IOrientedRectangle
for a given label using the given model parameter. | GenericLabelModel | ||
|
Returns an iterator over a set of possible
ILabelModelParameter
instances that can be used for the given label and model. | GenericLabelModel | ||
|
lookup(type:Class):Object
Returns an instance that implements the given type or
null. | GenericLabelModel | ||
| parameters | property |
parameters:ArrayList [read-only]Gets the parameter list.
Implementation public function get parameters():ArrayList
| GenericLabelModel | () | constructor |
public function GenericLabelModel(defaultParameter:ILabelModelParameter)Create a new generic label model using the provided parameter as the default parameter.
The parameter is stored by reference.
ParametersdefaultParameter:ILabelModelParameter — The parameter to use as the default.
|
See also
| addParameter | () | method |
public function addParameter(parameter:ILabelModelParameter):ILabelModelParameterAdds another parameter to this models collection of parameters.
Note that the parameter will be wrapped by this class and the resulting parameter which will use
this model instance as its ILabelModelParameter.model will be returned.
The parameter is stored by reference and subsequent modification of the parameter or its associated model
will be reflected by this instance.
parameter:ILabelModelParameter — The parameter to add to this instance.
|
ILabelModelParameter —
A new parameter that wraps the provided parameter and uses this instance as its model.
|
See also
| createDefaultParameter | () | method |
public function createDefaultParameter():ILabelModelParameterCreates a default parameter that can be used for this model.
ReturnsILabelModelParameter —
A parameter for this model instance.
|
| createParameter | () | method |
public function createParameter(parameter:ILabelModelParameter):ILabelModelParameterCreates a new GenericParameter to wrap the ModelParameter in
Parametersparameter:ILabelModelParameter — The Parameter to be wrapped in the GenericParameter
|
ILabelModelParameter —
A new parameter that wraps the provided parameter and uses this instance as its model.
|
| 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.
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
|
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
Returns an iterator over a set of possible ILabelModelParameter
instances that can be used for the given label and model.
label:ILabel — The label instance to use.
|
|
model:ILabelModel — The model to provide parameters for.
|
Iterator —
A possibly empty iterator over a set of label model parameters.
|
| 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.
type:Class — the type for which an instance shall be returned
|
Object — an instance that is assignable to type or null
|