Packagecom.yworks.graph.model
Classpublic class DefaultLabel
InheritanceDefaultLabel Inheritance AbstractModelItem
ImplementsILabel, ITagOwner

A simple mutable implementation of the ILabel interface that can be used stand-alone.



Public Properties
 PropertyDefined by
  labelModelParameter : ILabelModelParameter
Gets the label model's parameter that determines the positioning of this label.
DefaultLabel
  layout : IOrientedRectangle
[read-only] Provides access to the layout of a label.
DefaultLabel
  owner : ILabeledItem
Gets the owner of this label.
DefaultLabel
  preferredSize : ISize
Gets the preferred size of the label with respect to its current contents and the implementation of the visualization.
DefaultLabel
  style : ILabelStyle
Returns the style that is responsible for the visual representation of this label.
DefaultLabel
  tag : Object
Gets or sets the tag associated with this instance.
DefaultLabel
  text : String
Gets the text string associated with this label.
DefaultLabel
Protected Properties
 PropertyDefined by
 Inherited_lookupMap : IMapper
AbstractModelItem
Public Methods
 MethodDefined by
  
DefaultLabel(modelParameter:ILabelModelParameter, text:String, lookup:ILookup = null)
Initializes a new instance of the DefaultLabel class using the provided parameter and text.
DefaultLabel
 Inherited
Returns the currently set ILookup delegate.
AbstractModelItem
  
lookup(type:Class):Object
Simple lookup implementation that tries to find a registered lookup.
DefaultLabel
 Inherited
registerLookup(type:Class, instance:Object):void
Register an implementation for the given type that should be returned when lookup is called with this given type.
AbstractModelItem
 Inherited
Sets the ILookup implementation used for lookup calls on this instance.
AbstractModelItem
Property detail
labelModelParameterproperty
labelModelParameter:ILabelModelParameter  [read-write]

Gets the label model's parameter that determines the positioning of this label.

In order to set a different parameter for this label, use IGraph's setLabelModelParameter method.

Implementation
    public function get labelModelParameter():ILabelModelParameter
    public function set labelModelParameter(value:ILabelModelParameter):void
layoutproperty 
layout:IOrientedRectangle  [read-only]

Provides access to the layout of a label.

Labels have a ISize 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 LabelModelParameter for this label or modify its associated instance.

Implementation
    public function get layout():IOrientedRectangle
ownerproperty 
owner:ILabeledItem  [read-write]

Gets the owner of this label.

Typically this will yield an instance of INode or IEdge.

Implementation
    public function get owner():ILabeledItem
    public function set owner(value:ILabeledItem):void
preferredSizeproperty 
preferredSize:ISize  [read-write]

Gets the preferred size of the label with respect to its current contents and the implementation of the visualization.

Often times the Layout 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 setPreferredSize method.

Implementation
    public function get preferredSize():ISize
    public function set preferredSize(value:ISize):void
styleproperty 
style:ILabelStyle  [read-write]

Returns the style that is responsible for the visual representation of this label.

In order to set the style on an instance, use the IGraph's setStyle method.

Implementation
    public function get style():ILabelStyle
    public function set style(value:ILabelStyle):void
tagproperty 
tag:Object  [read-write]

Gets or sets the tag associated with this instance.

The implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.

Implementation
    public function get tag():Object
    public function set tag(value:Object):void
textproperty 
text:String  [read-write]

Gets the text string associated with this label.

It is up to the visualization engine to interpret this property for the visualization of the label. Normally it will render the text into the layout of this instance.

Implementation
    public function get text():String
    public function set text(value:String):void
Constructor detail
DefaultLabel()constructor
public function DefaultLabel(modelParameter:ILabelModelParameter, text:String, lookup:ILookup = null)

Initializes a new instance of the DefaultLabel class using the provided parameter and text.

Parameters
modelParameter:ILabelModelParameter — The model parameter.
 
text:String — The text.
 
lookup:ILookup (default = null) — The lookup delegate used by lookup(). If null, a DefaultBendLookup instance is used.
Method detail
lookup()method
public override function lookup(type:Class):Object

Simple lookup implementation that tries to find a registered lookup. If no such lookup is registered, returns this if this is assignable to the provided type.

This implementation tries to find an implementation of the given type in the following order:

Parameters
type:Class — The query type

Returns
Object — An implementation of type or null.