Packagecom.yworks.canvas.model
Classpublic class ModelManager
InheritanceModelManager Inheritance Object
Subclasses CollectionModelManager, FocusPaintManager, HighlightPaintManager, SelectionPaintManager

An abstract implementation of a utility class that manages the visual representations of items in a CanvasComponent



Public Properties
 PropertyDefined By
  canvas : CanvasComponent
[read-only] Gets the canvas instance this instance is managing.
ModelManager
Protected Properties
 PropertyDefined By
  _canvas : CanvasComponent
The canvas instance this instance is managing.
ModelManager
Public Methods
 MethodDefined By
  
Creates a new instance that will manage the items for the given canvas.
ModelManager
  
Adds an item to the canvas.
ModelManager
  
Checks whether this descriptor is currently being managed by this instance.
ModelManager
  
Removes the canvas objects associated with the given descriptor handle.
ModelManager
  
Updates the item in the canvas by uninstalling and reinstalling it into the canvas.
ModelManager
Protected Methods
 MethodDefined By
  
install(member:Object):Array
Abstract method that actually adds the visual representation of an item to the canvas.
ModelManager
  
uninstall(descriptor:IModelItemDescriptor, canvasObjects:Array):void
Simple implementation that removes all of the given canvasObjects.
ModelManager
Property Detail
_canvasproperty
protected var _canvas:CanvasComponent

The canvas instance this instance is managing.

canvasproperty 
canvas:CanvasComponent  [read-only]

Gets the canvas instance this instance is managing.


Implementation
    public function get canvas():CanvasComponent
Constructor Detail
ModelManager()Constructor
public function ModelManager(canvas:CanvasComponent)

Creates a new instance that will manage the items for the given canvas.

Parameters
canvas:CanvasComponent — The canvas to manage.
Method Detail
add()method
public function add(item:Object):IModelItemDescriptor

Adds an item to the canvas.

This method will call the install( Object ) method and create a IModelItemDescriptor handle that can later be used to remove or update the item's visual representation from or in the canvas.

Parameters

item:Object — The item to add to the canvas.

Returns
IModelItemDescriptor — A handle that can be used for the removeDescriptor and updateDescriptor methods.
containsDescriptor()method 
public function containsDescriptor(descriptor:IModelItemDescriptor):Boolean

Checks whether this descriptor is currently being managed by this instance.

Parameters

descriptor:IModelItemDescriptor — The descriptor handle.

Returns
Boolean — Whether the descriptor is actively managed by this instance.
install()method 
protected function install(member:Object):Array

Abstract method that actually adds the visual representation of an item to the canvas.

Parameters

member:Object — The item whose visual representation is to be added to the canvas.

Returns
Array — An array of canvas objects this instance has added to the canvas for the given item.
removeDescriptor()method 
public function removeDescriptor(descriptor:IModelItemDescriptor):void

Removes the canvas objects associated with the given descriptor handle.

Parameters

descriptor:IModelItemDescriptor — The handle as obtained from add( Object ).

uninstall()method 
protected function uninstall(descriptor:IModelItemDescriptor, canvasObjects:Array):void

Simple implementation that removes all of the given canvasObjects.

Parameters

descriptor:IModelItemDescriptor — The descriptor as obtained from a previous add call.
 
canvasObjects:Array — The canvas objects that have been associated with the descriptor.

updateDescriptor()method 
public function updateDescriptor(descriptor:IModelItemDescriptor):Boolean

Updates the item in the canvas by uninstalling and reinstalling it into the canvas.

Parameters

descriptor:IModelItemDescriptor — The descriptor to update.

Returns
Boolean