Packagecom.yworks.graph.drawing
Classpublic class TemplateNodeStyle
InheritanceTemplateNodeStyle Inheritance TemplateStyle Inheritance Object
Implements INodeStyle

A node style that uses a template class to define the visual appearance of the node.

The template class is aware of the current context.

If a TemplateNodeStyle component uses a resource that is loaded asynchronously, printing and image export might not work as expected, because the printing/image export might be executed before the component is ready. Therefore, component implementations can provide a "complete" property that reflects whether the component can be considered completely rendered. If this property exists and the value of the property is false, the component is expected to dispatch a complete event (a flash.events.Event of type flash.events.Event.COMPLETE) when the component is ready for export/printing.

View the examples



Public Properties
 PropertyDefined By
 InheritedcontextPropertyName : String
[read-only] The name of the property of the template class to write the context to.
TemplateStyle
 InheriteddataPropertyName : String
[read-only] The name of the property of the template class to write the user data to.
TemplateStyle
 InheritedhideSelectionPaintable : Boolean
Whether this style should return a void implementation when it is queried for an ISelectionPaintable implementation.
TemplateStyle
 InheritedstyleRenderer : IStyleRenderer
[read-only] Gets the renderer implementation that has been supplied to this instance upon creation.
TemplateStyle
 InheritedstyleTag : Object
A user tag which is associated with that style instance.
TemplateStyle
 InheritedtemplateClass : Class
[read-only] The template class which is used to render the item.
TemplateStyle
 InheriteduserTagProvider : IUserTagProvider
The IUserTagProvider to retrieve user defined data which is associated with the model item.
TemplateStyle
Public Methods
 MethodDefined By
  
TemplateNodeStyle(templateClass:Class, dataPropertyName:String = dataObject, contextPropertyName:String = context, hideSelectionPaintable:Boolean = false, styleRenderer:TemplateNodeStyleRenderer = null)
Creates a new instance.
TemplateNodeStyle
 Inherited
clone():Object
Creates a clone of this instance.
TemplateStyle
 Inherited
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
  
[override] Creates a new instance of this.
TemplateNodeStyle
Constructor Detail
TemplateNodeStyle()Constructor
public function TemplateNodeStyle(templateClass:Class, dataPropertyName:String = dataObject, contextPropertyName:String = context, hideSelectionPaintable:Boolean = false, styleRenderer:TemplateNodeStyleRenderer = null)

Creates a new instance.

Parameters
templateClass:Class — The template class. Must be a subclass of UIComponent.
 
dataPropertyName:String (default = dataObject) — The name of the property of the template class to set the user object to.
 
contextPropertyName:String (default = context) — The name of the property of the template class to set the context to.
 
hideSelectionPaintable:Boolean (default = false) — 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.
 
styleRenderer:TemplateNodeStyleRenderer (default = null) — The style renderer to use with this style. If none is provided, a new instance of TemplateNodeStyleRenderer will be created.
Method Detail
createClone()method
override protected function createClone():TemplateStyle

Creates a new instance of this.

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

Returns
TemplateStyle
Examples
Using the complete property for delayed printing/image export of a TemplateNodeStyle component:
   <fx:Script><![CDATA[
      public var complete:Boolean = false;
   
      private function setComplete():void {
        complete = true;
        dispatchEvent(new Event(Event.COMPLETE));
      }
    ]]></fx:Script>
    <s:VGroup width="100%" height="100%">
      <mx:Image source="http://www.yworks.com/img/yfiles_web/yfilesflex-orgchart.png" complete="setComplete()"/>
    </s:VGroup>
   

Note that this style can not be used with the CollapsibleNodeStyle. Instead, to add expand/collapse functionality for group nodes, a button should be added directly to the templateClass. This makes it easy to customize the visual appearance of the expand/collapse button.