Packagecom.yworks.graph.drawing
Classpublic class TemplateStyle
InheritanceTemplateStyle Inheritance Object
Implements ITemplateStyle
Subclasses TemplateLabelStyle, TemplateNodeStyle

Abstract base class for all yFiles FLEX styles that use a template class to define the visual appearance of the items.



Public Properties
 PropertyDefined By
  contextPropertyName : String
[read-only] The name of the property of the template class to write the context to.
TemplateStyle
  dataPropertyName : String
[read-only] The name of the property of the template class to write the user data to.
TemplateStyle
  hideSelectionPaintable : Boolean
Whether this style should return a void implementation when it is queried for an ISelectionPaintable implementation.
TemplateStyle
  styleRenderer : IStyleRenderer
[read-only] Gets the renderer implementation that has been supplied to this instance upon creation.
TemplateStyle
  styleTag : Object
A user tag which is associated with that style instance.
TemplateStyle
  templateClass : Class
[read-only] The template class which is used to render the item.
TemplateStyle
  userTagProvider : IUserTagProvider
The IUserTagProvider to retrieve user defined data which is associated with the model item.
TemplateStyle
Public Methods
 MethodDefined By
  
TemplateStyle(templateClass:Class, styleRenderer:AbstractStyleRenderer, dataPropertyName:String = null, contextPropertyName:String = null, hideSelectionPaintable:Boolean = false)
Creates a new instance.
TemplateStyle
  
clone():Object
Creates a clone of this instance.
TemplateStyle
  
install(canvas:CanvasComponent, group:ICanvasObjectGroup, modelItem:IModelItem):Array
Prepares the rendering of an IModelItem in a CanvasComponent by adding ICanvasObject's to the provided canvas.
TemplateStyle
Protected Methods
 MethodDefined By
  
Creates a new instance of this.
TemplateStyle
Property Detail
contextPropertyNameproperty
contextPropertyName:String  [read-only]

The name of the property of the template class to write the context to.

The default value is context.


Implementation
    public function get contextPropertyName():String
dataPropertyNameproperty 
dataPropertyName:String  [read-only]

The name of the property of the template class to write the user data to.

The default value is dataObject.


Implementation
    public function get dataPropertyName():String
hideSelectionPaintableproperty 
hideSelectionPaintable:Boolean

Whether this style should return a void implementation when it is queried for an ISelectionPaintable implementation.

If a template component implements it's own selection state visualization, set this property to true, in order to hide the default selection paintable.


Implementation
    public function get hideSelectionPaintable():Boolean
    public function set hideSelectionPaintable(value:Boolean):void

See also

styleRendererproperty 
styleRenderer:IStyleRenderer  [read-only]

Gets the renderer implementation that has been supplied to this instance upon creation.


Implementation
    public function get styleRenderer():IStyleRenderer
styleTagproperty 
styleTag:Object

A user tag which is associated with that style instance.

An arbitrary user-defined object.


Implementation
    public function get styleTag():Object
    public function set styleTag(value:Object):void
templateClassproperty 
templateClass:Class  [read-only]

The template class which is used to render the item.


Implementation
    public function get templateClass():Class
userTagProviderproperty 
userTagProvider:IUserTagProvider

The IUserTagProvider to retrieve user defined data which is associated with the model item.


Implementation
    public function get userTagProvider():IUserTagProvider
    public function set userTagProvider(value:IUserTagProvider):void
Constructor Detail
TemplateStyle()Constructor
public function TemplateStyle(templateClass:Class, styleRenderer:AbstractStyleRenderer, dataPropertyName:String = null, contextPropertyName:String = null, hideSelectionPaintable:Boolean = false)

Creates a new instance.

Parameters
templateClass:Class — The template class. Must be a subclass of UIComponent.
 
styleRenderer:AbstractStyleRenderer — The name of the property of the template class to set the user object to.
 
dataPropertyName:String (default = null) — The name of the property of the template class to set the context to.
 
contextPropertyName:String (default = null) — Whether to hide the ISelectionPaintable. If set to true, no selection paintable will be drawn. In this case, the component itself has to take care of the selection highlighting.
 
hideSelectionPaintable:Boolean (default = false) — The style renderer to use with this style. If none is provided, a new instance of TemplateNodeStyleRenderer will be created.
Method Detail
clone()method
public function clone():Object

Creates a clone of this instance.

Returns
Object — A clone of this instance.
createClone()method 
protected function createClone():TemplateStyle

Creates a new instance of this.

Subclasses have to override this to return a new instance of them.

Returns
TemplateStyle
install()method 
public function install(canvas:CanvasComponent, group:ICanvasObjectGroup, modelItem:IModelItem):Array

Prepares the rendering of an IModelItem in a CanvasComponent by adding ICanvasObject's to the provided canvas.

Implementations may add zero or more ICanvasObject instances to the given CanvasComponent. The group parameter can be used as a hint for implementations. They can add their newly created canvas objects to the given group. However they are not obliged to do that.

Parameters

canvas:CanvasComponent — The canvas to install the canvas objects in.
 
group:ICanvasObjectGroup — A hint that tells the implementation where to add the canvas objects.
 
modelItem:IModelItem — The item to install a visual representation for.

Returns
Array — An array of zero or more canvas objects that have been installed in the canvas by this method or null if nothing was installed.