Package | com.yworks.graph.model |
Class | public class GenericLabelModel |
Inheritance | GenericLabelModel Object |
Implements | ILabelModel, ILabelModelParameterProvider, ILabelCandidateDescriptorProvider |
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, descriptor:ILabelCandidateDescriptor = null)
Create a new generic label model using the provided parameter as the default parameter. | GenericLabelModel | ||
addParameter(parameter:ILabelModelParameter, descriptor:ILabelCandidateDescriptor = null):ILabelModelParameter
Adds another parameter to this models collection of parameters. | GenericLabelModel | ||
Creates a default parameter that can be used for this model. | GenericLabelModel | ||
createParameter(parameter:ILabelModelParameter, descriptor:ILabelCandidateDescriptor = null):ILabelModelParameter
Creates a new GenericParameter to wrap the ModelParameter in
| GenericLabelModel | ||
GenericLabelModel | |||
Yields the ILabelCandidateDescriptor that has been associated with the instance
during addParameter. | 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.
public function get parameters():ArrayList
GenericLabelModel | () | Constructor |
public function GenericLabelModel(defaultParameter:ILabelModelParameter, descriptor:ILabelCandidateDescriptor = null)
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.
| |
descriptor:ILabelCandidateDescriptor (default = null ) — The descriptor to associate with the default parameter.
|
See also
addParameter | () | method |
public function addParameter(parameter:ILabelModelParameter, descriptor:ILabelCandidateDescriptor = null):ILabelModelParameter
Adds 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.
Also the methods allows for associating a ILabelCandidateDescriptor
with each
parameter that can later be retrieved via the getDescriptor
method.
Parameters
parameter:ILabelModelParameter — The parameter to add to this instance.
| |
descriptor:ILabelCandidateDescriptor (default = null ) — The descriptor to associate with the parameter.
|
ILabelModelParameter — A new parameter that wraps the provided parameter and uses this instance as its model.
|
See also
createDefaultParameter | () | method |
public function createDefaultParameter():ILabelModelParameter
Creates a default parameter that can be used for this model.
ReturnsILabelModelParameter — A parameter for this model instance.
|
createParameter | () | method |
public function createParameter(parameter:ILabelModelParameter, descriptor:ILabelCandidateDescriptor = null):ILabelModelParameter
Creates a new GenericParameter to wrap the ModelParameter in
Parameters
parameter:ILabelModelParameter — The Parameter to be wrapped in the GenericParameter
| |
descriptor:ILabelCandidateDescriptor (default = null )
|
ILabelModelParameter — A new parameter that wraps the provided parameter and uses this instance as its model.
|
getContext | () | method |
public function getContext(label:ILabel, parameter:ILabelModelParameter):ILookup
Parameters
label:ILabel | |
parameter:ILabelModelParameter |
ILookup |
getDescriptor | () | method |
public function getDescriptor(label:ILabel, parameter:ILabelModelParameter):ILabelCandidateDescriptor
Yields the ILabelCandidateDescriptor
that has been associated with the instance
during addParameter
.
Parameters
label:ILabel — The label instance to use.
| |
parameter:ILabelModelParameter — The parameter to get the descriptor for.
|
ILabelCandidateDescriptor — The descriptor instance that has been added to this instance during addParameter .
|
See also
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
|
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.
Parameters
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.
Parameters
type:Class — the type for which an instance shall be returned
|
Object — an instance that is assignable to type or null
|