Packagecom.yworks.graph.drawing
Classpublic class ImageNodeStyle
InheritanceImageNodeStyle Inheritance flash.events.EventDispatcher
Implements INodeStyle

A node style than can use bitmap and vector images for the visual representation of a node.

This style supports the vector-based FXG, SVG, and SWF formats, as well as GIF, JPEG and PNG bitmap images.

The following types are supported to specify the image that will be displayed be the style:

If an url is passed, this style will delegate the painting to its fallbackStyle until the image is completely loaded. The default fallback style is a ShapeNodeStyle instance.

yFiles.NET users should note that this style does not correspond to the yFiles.NET ImageNodeStyle. Instead, the BitmapNodeStyle is (de)serialized to/from the yFiles.NET ImageNodeStyle.

See also

com.yworks.io.graphml.writer.serializer.ImageNodeStyleSerializer
com.yworks.io.graphml.reader.deserializer.ImageNodeStyleDeserializer
BitmapNodeStyle
com.yworks.graph.drawing.compat.JavaImageNodeStyle


Public Properties
 PropertyDefined By
  fallbackStyle : INodeStyle
The fallback style that is painted until an image located at a given url is completely loaded.
ImageNodeStyle
  image : DisplayObject
Get or set the image display object that is used for the associated node.
ImageNodeStyle
  imageClass : Class
Set the image class that can be used as a factory to create copies of the image that is to be painted by this style.
ImageNodeStyle
  imageClassName : String
[read-only] The name of the image class, if available
ImageNodeStyle
  loaded : Boolean
[read-only] Whether the image associated with this style is completely loaded.
ImageNodeStyle
  styleRenderer : IStyleRenderer
[read-only] Gets the renderer implementation that has been supplied to this instance upon creation.
ImageNodeStyle
  url : String
The URL this image is to be loaded from.
ImageNodeStyle
Public Methods
 MethodDefined By
  
ImageNodeStyle(image:Object = null, styleRenderer:ImageNodeStyleRenderer = null)
Creates a new instance.
ImageNodeStyle
  
clone():Object
Creates a clone of this instance.
ImageNodeStyle
  
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.
ImageNodeStyle
Protected Methods
 MethodDefined By
  
Callback that creates the cloned instance for the clone() method.
ImageNodeStyle
Events
 Event Summary Defined By
  Dispatched when the Image data (loaded from an URL or embedded SWF) is loaded.ImageNodeStyle
Property Detail
fallbackStyleproperty
fallbackStyle:INodeStyle

The fallback style that is painted until an image located at a given url is completely loaded.

If the fallback style is null, nothing is painted while loading the image.


Implementation
    public function get fallbackStyle():INodeStyle
    public function set fallbackStyle(value:INodeStyle):void
imageproperty 
image:DisplayObject

Get or set the image display object that is used for the associated node.


Implementation
    public function get image():DisplayObject
    public function set image(value:DisplayObject):void
imageClassproperty 
imageClass:Class

Set the image class that can be used as a factory to create copies of the image that is to be painted by this style.


Implementation
    public function get imageClass():Class
    public function set imageClass(value:Class):void
imageClassNameproperty 
imageClassName:String  [read-only]

The name of the image class, if available


Implementation
    public function get imageClassName():String
loadedproperty 
loaded:Boolean  [read-only]

Whether the image associated with this style is completely loaded.


Implementation
    public function get loaded():Boolean
styleRendererproperty 
styleRenderer:IStyleRenderer  [read-only]

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


Implementation
    public function get styleRenderer():IStyleRenderer
urlproperty 
url:String

The URL this image is to be loaded from.

Setting an image url causes this style to load the image from the given url.

While the image is being loaded, this style will delegate the painting to its fallbackStyle. If the fallbackStyle is null, nothing is painted while loading.


Implementation
    public function get url():String
    public function set url(value:String):void
Constructor Detail
ImageNodeStyle()Constructor
public function ImageNodeStyle(image:Object = null, styleRenderer:ImageNodeStyleRenderer = null)

Creates a new instance.

Parameters
image:Object (default = null) — the image to be used for the associated node. The following types are allowed to specify the image that will be displayed be the style:
  • SpriteVisualElement (embedded scalable image: FXG)
  • SpriteAsset (embedded scalable image: SVG or SWF)
  • BitmapAsset (embedded bitmap image)
  • Class (embedded scalable or bitmap image, or FXG Class)
  • String (url to an image file that will be loaded at runtime)
  • BitmapData
  • DisplayObject

If a DisplayObject instance is passed that does not extend SpriteAsset, SpriteVisualElement or BitmapAsset and that does not implement ICloneable, the style instance can not be shared and printing may not work properly.

If a CloneableBitmap or BitmapData instance is passed, (de)serialization of the style instance will not work. For these cases, it is recommended to use BitmapNodeStyle instead of ImageNodeStyle.

 
styleRenderer:ImageNodeStyleRenderer (default = null)
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():ImageNodeStyle

Callback that creates the cloned instance for the clone() method.

Returns
ImageNodeStyle
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.
Event Detail
complete Event
Event Object Type: flash.events.Event
Event.type property = flash.events.Event.COMPLETE

Dispatched when the Image data (loaded from an URL or embedded SWF) is loaded.