Packagecom.yworks.graph.model
Classpublic class DefaultLabel
InheritanceDefaultLabel Inheritance AbstractModelItem Inheritance Object
Implements ILabel, ITagOwner, com.yworks.graph.model.IZOrderOwner, IMarkupExtensionFactory

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
  zOrder : int
The z-order of a model item which determines its render order in comparison to other model items.
DefaultLabel
Protected Properties
 PropertyDefined By
 Inherited_lookupMap : IMapper
The map which is used by registerLookup() to store instances in.
AbstractModelItem
Public Methods
 MethodDefined By
  
DefaultLabel(modelParameter:ILabelModelParameter, text:String, lookup:ILookup = null, preferredSize:ISize = null)
Initializes a new instance of the DefaultLabel class using the provided parameter and text.
DefaultLabel
  
Creates a markup extension that can be used instead of the original class.
DefaultLabel
 Inherited
Returns the currently set ILookup delegate.
AbstractModelItem
  
lookup(type:Class):Object
[override] Returns an instance that implements the given type or null.
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
  
toString():String
Returns a String representation of this instance.
DefaultLabel
Property Detail
labelModelParameterproperty
labelModelParameter:ILabelModelParameter

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

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

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

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

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

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
zOrderproperty 
zOrder:int

The z-order of a model item which determines its render order in comparison to other model items.


Implementation
    public function get zOrder():int
    public function set zOrder(value:int):void
Constructor Detail
DefaultLabel()Constructor
public function DefaultLabel(modelParameter:ILabelModelParameter, text:String, lookup:ILookup = null, preferredSize:ISize = 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().
 
preferredSize:ISize (default = null) — The label's preferred size If null, a DefaultBendLookup instance is used.
Method Detail
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
lookup()method 
override 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
toString()method 
public function toString():String

Returns a String representation of this instance.

Returns
String — A String representation of this instance.